[PATCH v2 12/15] libtracefs: Have samples build in separate directory from bin

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

 



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

The samples destination directory is bin/. Do not build in that directory.
Have it build in the default directory, and then it can be set to build in
the same directory as the source (or copy if it is a remote build).

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

diff --git a/samples/Makefile b/samples/Makefile
index 48c0e0e4160d..ace93448ff4e 100644
--- a/samples/Makefile
+++ b/samples/Makefile
@@ -24,9 +24,9 @@ TARGETS :=
 TARGETS += sqlhist
 TARGETS += $(EXAMPLES)
 
-bdir := $(obj)/bin
+sdir := $(obj)/bin
 
-TARGETS := $(patsubst %,$(bdir)/%,$(TARGETS))
+TARGETS := $(patsubst %,$(sdir)/%,$(TARGETS))
 
 all: $(TARGETS)
 
@@ -36,20 +36,21 @@ $(bdir)/sqlhist.c: $(src)/Documentation/libtracefs-sql.txt
 $(bdir)/%.c: ../Documentation/libtracefs-%.txt
 	$(call extract_example,$<,$@)
 
-$(bdir):
-	@mkdir -p $(bdir)
+$(sdir):
+	@mkdir -p $(sdir)
 
-sqlhist: $(bdir)/sqlhist.c
+sqlhist: $(sdir)/sqlhist
 
-$(TARGETS): $(bdir)
+$(TARGETS): $(sdir)
 
 # sqlhist is unique and stands on its own
-$(bdir)/sqlhist: $(bdir)/sqlhist.c
+$(sdir)/sqlhist: $(bdir)/sqlhist.c
+	$(call do_sample_build,$@,$<)
 
-$(bdir)/%: $(bdir)/%.o
+$(sdir)/%: $(bdir)/%.o
 	$(call do_sample_build,$@,$<)
 
-$(EXAMPLES): $(patsubst %,$(bdir)/%,$(TARGETS))
+$(EXAMPLES): $(patsubst %,$(sdir)/%,$(TARGETS))
 
 ## The intermediate files get removed by Make.
 ## To examine the .c files created by one of the man pages,
@@ -63,4 +64,4 @@ $(bdir)/%.o: $(bdir)/%.c
 	$(call do_sample_obj,$@,$^)
 
 clean:
-	$(Q)$(call do_clean,$(bdir)/*)
+	$(Q)$(call do_clean,$(sdir)/* $(bdir)/sqlhist.c $(bdir)/sqlhist.o)
-- 
2.33.0




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

  Powered by Linux