[PATCH v2 04/15] libtracefs: Fix samples Makefile

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

 



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

The commit that was added to build the samples was not fully committed,
and it did not build properly. Fix the Makefile so that the sample code
now builds.

Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
---
 samples/Makefile | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/samples/Makefile b/samples/Makefile
index 4ccd28dcebaa..1e4fe7fb2144 100644
--- a/samples/Makefile
+++ b/samples/Makefile
@@ -26,31 +26,31 @@ TARGETS += $(EXAMPLES)
 
 bdir := $(obj)/bin
 
+TARGETS := $(patsubst %,$(bdir)/%,$(TARGETS))
+
 all: $(TARGETS)
 
 extract_example = \
 	cat $1 | sed -ne '/^EXAMPLE/,/FILES/ { /EXAMPLE/,+2d ; /^FILES/d ;  /^--/d ; p}' > $2
 
-$(bdir)/sqlhist.c: ../Documentation/libtracefs-sql.txt
+$(bdir)/sqlhist.c: $(src)/Documentation/libtracefs-sql.txt
 	$(call extract_example,$<,$@)
 
-EXAMPLE_C_CODE := $(patsubst %,$(bdir)/%.c,$(EXAMPLES))
-
 $(bdir)/%.c: ../Documentation/libtracefs-%.txt
 	$(call extract_example,$<,$@)
 
 $(bdir):
 	@mkdir -p $(bdir)
 
-sqlhist: $(bdir) $(bdir) $(bdir)/sqlhist
+sqlhist: $(bdir)/sqlhist.c
 
 $(TARGETS): $(bdir)
 
 # sqlhist is unique and stands on its own
-sqlhist: $(bdir)/sqlhist
+$(bdir)/sqlhist: $(bdir)/sqlhist.c
 
 $(bdir)/%: $(bdir)/%.o
-	$(CC) -o $@ $^ $(LIBTRACEFS_STATIC) $(LIBTRACEEVENT_LIBS)
+	$(CC) -o $@ $< $(CFLAGS) $(LIBTRACEFS_STATIC) $(LIBTRACEEVENT_LIBS)
 
 $(EXAMPLES): $(patsubst %,$(bdir)/%,$(TARGETS))
 
@@ -60,9 +60,9 @@ $(EXAMPLES): $(patsubst %,$(bdir)/%,$(TARGETS))
 ## name, and the file will not be discarded by make.
 #
 # $(bdir)/XX.o: $(bdir)/XX.c
-#	$(CC) -g -Wall -c -o $@ $^ -I../include/ $(LIBTRACEEVENT_INCLUDES)
+#	$(CC) -g -Wall $(CFLAGS) -c -o $@ $^ -I../include/ $(LIBTRACEEVENT_INCLUDES)
 
-$(bdir)/%.o: %.c
+$(bdir)/%.o: $(bdir)/%.c
 	$(CC) -g -Wall -c $(CFLAGS) -o $@ $^ -I../include/ $(LIBTRACEEVENT_INCLUDES)
 
 clean:
-- 
2.33.0




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

  Powered by Linux