[PATCH 8/9] libtracefs: Have sample build look cleaner

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Steven Rostedt (VMware)" <rostedt@xxxxxxxxxxx>

The build of the samples directory just showed the raw commands. This is
inconsistent with the rest of the build system. Make it cleaner by showing
EXTRACT, COMPILE SAMPLE OBJ and COMPILE SAMPLE for the samples being
extracted and built.

Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
---
 samples/Makefile |  9 +++++----
 scripts/utils.mk | 18 ++++++++++++++++++
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/samples/Makefile b/samples/Makefile
index 8e2b53bbdfae..8b2267482fbf 100644
--- a/samples/Makefile
+++ b/samples/Makefile
@@ -28,8 +28,9 @@ bdir := $(obj)/bin
 
 all: $(TARGETS)
 
-extract_example = \
-	cat $1 | sed -ne '/^EXAMPLE/,/FILES/ { /EXAMPLE/,+2d ; /^FILES/d ;  /^--/d ; p}' > $2
+ifeq ($(findstring 1,$(SILENT)$(VERBOSE)),1)
+else
+endif
 
 $(bdir)/sqlhist.c: ../Documentation/libtracefs-sql.txt
 	$(call extract_example,$<,$@)
@@ -50,7 +51,7 @@ $(TARGETS): $(bdir)
 sqlhist: $(bdir)/sqlhist
 
 $(bdir)/%: $(bdir)/%.o
-	$(CC) -o $@ $^ $(LIBTRACEFS_STATIC) $(LIBTRACEEVENT_LIBS)
+	$(call do_sample_build,$@,$^)
 
 $(EXAMPLES): $(patsubst %,$(bdir)/%,$(TARGETS))
 
@@ -63,7 +64,7 @@ $(EXAMPLES): $(patsubst %,$(bdir)/%,$(TARGETS))
 #	$(CC) -g -Wall $(CFLAGS) -c -o $@ $^ -I../include/ $(LIBTRACEEVENT_INCLUDES)
 
 %.o: %.c
-	$(CC) -g -Wall $(CFLAGS) -c -o $@ $^ -I../include/ $(LIBTRACEEVENT_INCLUDES)
+	$(call do_sample_obj,$@,$^)
 
 clean:
 	$(Q)$(call do_clean,$(bdir)/*)
diff --git a/scripts/utils.mk b/scripts/utils.mk
index af0f14fcbfa7..41b996008a73 100644
--- a/scripts/utils.mk
+++ b/scripts/utils.mk
@@ -30,6 +30,9 @@ ifeq ($(findstring 1,$(SILENT)$(VERBOSE)),1)
   print_update =
   print_descend =
   print_clean =
+  print_extract =
+  print_sample_build =
+  print_sample_obj =
 else
   print_compile =		echo '  COMPILE            '$(GOBJ);
   print_app_build =		echo '  BUILD              '$(GOBJ);
@@ -43,6 +46,9 @@ else
   print_update =		echo '  UPDATE             '$(GOBJ);
   print_descend =		echo '  DESCEND            '$(BASE1) $(BASE2);
   print_clean =			echo '  CLEAN              '$(BASEPWD);
+  print_extract =		echo '  EXTRACT            '$(GOBJ);
+  print_sample_build =		echo '  COMPILE SAMPLE     '$(GOBJ);
+  print_sample_obj =		echo '  COMPILE SAMPLE OBJ '$(GOBJ);
 endif
 
 do_fpic_compile =					\
@@ -89,6 +95,18 @@ do_clean =					\
 	($(print_clean)				\
 	$(RM) $1)
 
+extract_example =				\
+	$(Q)($(print_extract)			\
+	cat $1 | sed -ne '/^EXAMPLE/,/FILES/ { /EXAMPLE/,+2d ; /^FILES/d ;  /^--/d ; p}' > $2)
+
+do_sample_build =							\
+	$(Q)($(print_sample_build)					\
+	$(CC) -o $1 $2 $(LIBTRACEFS_STATIC) $(LIBTRACEEVENT_LIBS))
+
+do_sample_obj =									\
+	$(Q)($(print_sample_obj)						\
+	$(CC) -g -Wall $(CFLAGS) -c -o $1 $2 -I../include/ $(LIBTRACEEVENT_INCLUDES))
+
 ifneq ($(findstring $(MAKEFLAGS), w),w)
 PRINT_DIR = --no-print-directory
 else
-- 
2.33.0




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux