diff mbox series

[v2,08/15] libtracefs: Have make clean output cleaner

Message ID 20211217055041.19559-9-rostedt@goodmis.org (mailing list archive)
State Accepted
Commit afc33b0c0b2a90fdf15711b337fa629ad637e8e1
Headers show
Series libtracefs: Updates to the Makefile | expand

Commit Message

Steven Rostedt Dec. 17, 2021, 5:50 a.m. UTC
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

Instead of showing the files being removed by make clean, just output a
command stating what directory the clean is happening in.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile         | 13 +++++++------
 samples/Makefile |  2 +-
 scripts/utils.mk |  8 ++++++++
 src/Makefile     |  2 +-
 utest/Makefile   |  2 +-
 5 files changed, 18 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 2bd23c955d9a..bf085bfdb800 100644
--- a/Makefile
+++ b/Makefile
@@ -373,11 +373,12 @@  samples: $(LIBTRACEFS_STATIC) force
 	$(Q)$(call descend,$(src)/samples,all)
 
 clean:
-	$(MAKE) -C $(src)/utest clean
-	$(MAKE) -C $(src)/src clean
-	$(MAKE) -C $(src)/samples clean
-	$(RM) $(TARGETS) $(bdir)/*.a $(bdir)/*.so $(bdir)/*.so.* $(bdir)/*.o $(bdir)/.*.d
-	$(RM) $(PKG_CONFIG_FILE)
-	$(RM) $(VERSION_FILE)
+	$(Q)$(MAKE) -C $(src)/utest clean
+	$(Q)$(MAKE) -C $(src)/src clean
+	$(Q)$(MAKE) -C $(src)/samples clean
+	$(Q)$(call do_clean, \
+	  $(TARGETS) $(bdir)/*.a $(bdir)/*.so $(bdir)/*.so.* $(bdir)/*.o $(bdir)/.*.d \
+	  $(PKG_CONFIG_FILE) \
+	  $(VERSION_FILE))
 
 .PHONY: clean
diff --git a/samples/Makefile b/samples/Makefile
index 1e4fe7fb2144..033f1ca735f4 100644
--- a/samples/Makefile
+++ b/samples/Makefile
@@ -66,4 +66,4 @@  $(bdir)/%.o: $(bdir)/%.c
 	$(CC) -g -Wall -c $(CFLAGS) -o $@ $^ -I../include/ $(LIBTRACEEVENT_INCLUDES)
 
 clean:
-	$(RM) $(bdir)/*
+	$(Q)$(call do_clean,$(bdir)/*)
diff --git a/scripts/utils.mk b/scripts/utils.mk
index 404b929a2b5f..c9b908f1c5d9 100644
--- a/scripts/utils.mk
+++ b/scripts/utils.mk
@@ -2,9 +2,11 @@ 
 
 # Utils
 
+ PWD		:= $(shell /bin/pwd)
  GOBJ		= $(notdir $(strip $@))
  BASE1		= $(notdir $(strip $1))
  BASE2		= $(notdir $(strip $2))
+ BASEPWD	= $(notdir $(strip $(PWD)))
 
 
 ifeq ($(VERBOSE),1)
@@ -27,6 +29,7 @@  ifeq ($(findstring 1,$(SILENT)$(VERBOSE)),1)
   print_uninstall =
   print_update =
   print_descend =
+  print_clean =
 else
   print_compile =		echo '  COMPILE            '$(GOBJ);
   print_app_build =		echo '  BUILD              '$(GOBJ);
@@ -39,6 +42,7 @@  else
   print_uninstall =		echo '  UNINSTALL     $(DESTDIR_SQ)$1';
   print_update =		echo '  UPDATE             '$(GOBJ);
   print_descend =		echo '  DESCEND            '$(BASE1) $(BASE2);
+  print_clean =			echo '  CLEAN              '$(BASEPWD);
 endif
 
 do_fpic_compile =					\
@@ -78,6 +82,10 @@  do_python_plugin_build =			\
 	($(print_plugin_build)			\
 	$(CC) $< -shared $(LDFLAGS) $(PYTHON_LDFLAGS) -o $@)
 
+do_clean =					\
+	($(print_clean)				\
+	$(RM) $1)
+
 ifneq ($(findstring $(MAKEFLAGS), w),w)
 PRINT_DIR = --no-print-directory
 else
diff --git a/src/Makefile b/src/Makefile
index cda0a0cda6e3..8f258a218f97 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -61,7 +61,7 @@  $(OBJS): | $(bdir)
 $(DEPS): | $(bdir)
 
 clean:
-	$(RM) $(OBJS)
+	$(Q)$(call do_clean,$(OBJS))
 
 dep_includes := $(wildcard $(DEPS))
 
diff --git a/utest/Makefile b/utest/Makefile
index 48993650660c..d168b01a328c 100644
--- a/utest/Makefile
+++ b/utest/Makefile
@@ -40,4 +40,4 @@  dep_includes := $(wildcard $(DEPS))
 test: $(TARGETS)
 
 clean:
-	$(RM) $(TARGETS) $(bdir)/*.o $(bdir)/.*.d
+	$(Q)$(call do_clean,$(TARGETS) $(bdir)/*.o $(bdir)/.*.d)