@@ -30,9 +30,6 @@ TARGETS := $(patsubst %,$(bdir)/%,$(TARGETS))
all: $(TARGETS)
-extract_example = \
- cat $1 | sed -ne '/^EXAMPLE/,/FILES/ { /EXAMPLE/,+2d ; /^FILES/d ; /^--/d ; p}' > $2
-
$(bdir)/sqlhist.c: $(src)/Documentation/libtracefs-sql.txt
$(call extract_example,$<,$@)
@@ -50,7 +47,7 @@ $(TARGETS): $(bdir)
$(bdir)/sqlhist: $(bdir)/sqlhist.c
$(bdir)/%: $(bdir)/%.o
- $(CC) -o $@ $< $(CFLAGS) $(LIBTRACEFS_STATIC) $(LIBTRACEEVENT_LIBS)
+ $(call do_sample_build,$@,$<)
$(EXAMPLES): $(patsubst %,$(bdir)/%,$(TARGETS))
@@ -63,7 +60,7 @@ $(EXAMPLES): $(patsubst %,$(bdir)/%,$(TARGETS))
# $(CC) -g -Wall $(CFLAGS) -c -o $@ $^ -I../include/ $(LIBTRACEEVENT_INCLUDES)
$(bdir)/%.o: $(bdir)/%.c
- $(CC) -g -Wall -c $(CFLAGS) -o $@ $^ -I../include/ $(LIBTRACEEVENT_INCLUDES)
+ $(call do_sample_obj,$@,$^)
clean:
$(Q)$(call do_clean,$(bdir)/*)
@@ -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 $(CFLAGS) $(LIBTRACEFS_STATIC) $(LIBTRACEEVENT_LIBS))
+
+do_sample_obj = \
+ $(Q)($(print_sample_obj) \
+ $(CC) -g -Wall -c $(CFLAGS) -o $1 $2 -I../include/ $(LIBTRACEEVENT_INCLUDES))
+
ifneq ($(findstring $(MAKEFLAGS), w),w)
PRINT_DIR = --no-print-directory
else