diff mbox series

[v2,07/15] libtracefs: Add "DESCEND" output when descending into directories during build

Message ID 20211217055041.19559-8-rostedt@goodmis.org (mailing list archive)
State Accepted
Commit bed758faad930befddb1c825d3e4efc58b86f2ee
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>

Copy from the Linux kernel a "DESCEND" output when descending into a
directory during the build. This makes the output of the build a little
more informative knowing what directory the build is currently in.

Also add the target and not just the directory, as the build will descend
into the src directory twice with different targets, and just showing that
it goes into the src directory twice looks weird.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile         | 16 ++++++++--------
 scripts/utils.mk | 20 ++++++++++++++++++++
 2 files changed, 28 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 07c9496364bd..2bd23c955d9a 100644
--- a/Makefile
+++ b/Makefile
@@ -182,7 +182,7 @@  test: force $(LIBTRACEFS_STATIC)
 ifneq ($(CUNIT_INSTALLED),1)
 	$(error CUnit framework not installed, cannot build unit tests))
 endif
-	$(Q)$(MAKE) -C $(src)/$(UTEST_DIR) $@
+	$(Q)$(call descend,$(src)/$(UTEST_DIR),$@)
 
 test_mem: test
 ifeq (, $(VALGRIND))
@@ -279,13 +279,13 @@  install_pkgconfig: $(PKG_CONFIG_FILE)
 		$(call do_install_pkgconfig_file,$(prefix))
 
 doc:
-	$(MAKE) -C $(src)/Documentation all
+	$(Q)$(call descend,$(src)/Documentation,all)
 
 doc_clean:
-	$(MAKE) -C $(src)/Documentation clean
+	$(Q)$(call descend,$(src)/Documentation,clean)
 
 install_doc:
-	$(MAKE) -C $(src)/Documentation install
+	$(Q)$(call descend,$(src)/Documentation,install)
 
 define build_uninstall_script
 	$(Q)mkdir $(BUILD_OUTPUT)/tmp_build
@@ -358,19 +358,19 @@  $(VERSION_FILE): force
 
 $(LIBTRACEFS_STATIC): force
 	$(Q)mkdir -p $(bdir)
-	$(Q)$(MAKE) -C $(src)/src $@
+	$(Q)$(call descend,$(src)/src,$@)
 
 $(bdir)/libtracefs.so.$(TRACEFS_VERSION): force
 	$(Q)mkdir -p $(bdir)
-	$(Q)$(MAKE) -C $(src)/src libtracefs.so
+	$(Q)$(call descend,$(src)/src,libtracefs.so)
 
 samples/sqlhist: $(LIBTRACEFS_STATIC)
-	$(Q)$(MAKE) -C $(src)/samples sqlhist
+	$(Q)$(call descend,$(src)/samples,sqlhist)
 
 sqlhist: samples/sqlhist
 
 samples: $(LIBTRACEFS_STATIC) force
-	$(Q)$(MAKE) -C $(src)/samples all
+	$(Q)$(call descend,$(src)/samples,all)
 
 clean:
 	$(MAKE) -C $(src)/utest clean
diff --git a/scripts/utils.mk b/scripts/utils.mk
index 0b3c0675b714..404b929a2b5f 100644
--- a/scripts/utils.mk
+++ b/scripts/utils.mk
@@ -3,6 +3,8 @@ 
 # Utils
 
  GOBJ		= $(notdir $(strip $@))
+ BASE1		= $(notdir $(strip $1))
+ BASE2		= $(notdir $(strip $2))
 
 
 ifeq ($(VERBOSE),1)
@@ -24,6 +26,7 @@  ifeq ($(findstring 1,$(SILENT)$(VERBOSE)),1)
   print_install =
   print_uninstall =
   print_update =
+  print_descend =
 else
   print_compile =		echo '  COMPILE            '$(GOBJ);
   print_app_build =		echo '  BUILD              '$(GOBJ);
@@ -35,6 +38,7 @@  else
   print_install =		echo '  INSTALL     '$1'	to	$(DESTDIR_SQ)$2';
   print_uninstall =		echo '  UNINSTALL     $(DESTDIR_SQ)$1';
   print_update =		echo '  UPDATE             '$(GOBJ);
+  print_descend =		echo '  DESCEND            '$(BASE1) $(BASE2);
 endif
 
 do_fpic_compile =					\
@@ -74,6 +78,22 @@  do_python_plugin_build =			\
 	($(print_plugin_build)			\
 	$(CC) $< -shared $(LDFLAGS) $(PYTHON_LDFLAGS) -o $@)
 
+ifneq ($(findstring $(MAKEFLAGS), w),w)
+PRINT_DIR = --no-print-directory
+else
+NO_SUBDIR = :
+endif
+
+#
+# Define a callable command for descending to a new directory
+#
+# Call by doing: $(call descend,directory[,target])
+#
+descend = \
+	($(print_descend)		\
+	$(MAKE) $(PRINT_DIR) -C $(1) $(2))
+
+
 define make_version.h
 	(echo '/* This file is automatically generated. Do not modify. */';		\
 	echo \#define VERSION_CODE $(shell						\