linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] trace-cmd: Fix build dependencies
@ 2020-06-02 22:16 Steven Rostedt
  0 siblings, 0 replies; only message in thread
From: Steven Rostedt @ 2020-06-02 22:16 UTC (permalink / raw)
  To: linux-trace-devel

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

After having trace-cmd break because not all proper files are being compiled
when needed, I looked into why the dependencies were not working. I found
that the .foo.d files that were being created required having the full path
of the object file in them. Without that, the dependencies were being
ignored.

By adding "-MT $(bdir)/$*.o", to the dependency creating rules, the full
path would be added to targets for the object files, and this makes the
depencies work again.

Fixes: 60f0a40bb ("trace-cmd: Make libtraceevent buildable out-of-tree")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 lib/trace-cmd/Makefile          | 2 +-
 lib/trace-cmd/plugins/Makefile  | 2 +-
 lib/traceevent/Makefile         | 2 +-
 lib/traceevent/plugins/Makefile | 2 +-
 lib/tracefs/Makefile            | 2 +-
 tracecmd/Makefile               | 2 +-
 utest/Makefile                  | 1 +
 7 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/lib/trace-cmd/Makefile b/lib/trace-cmd/Makefile
index ab7440ac..994ae94d 100644
--- a/lib/trace-cmd/Makefile
+++ b/lib/trace-cmd/Makefile
@@ -45,7 +45,7 @@ $(bdir)/%.o: %.c
 	$(Q)$(call do_fpic_compile)
 
 $(DEPS): $(bdir)/.%.d: %.c
-	$(Q)$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@
+	$(Q)$(CC) -M -MT $(bdir)/$*.o $(CPPFLAGS) $(CFLAGS) $< > $@
 
 $(OBJS): $(bdir)/%.o : $(bdir)/.%.d
 
diff --git a/lib/trace-cmd/plugins/Makefile b/lib/trace-cmd/plugins/Makefile
index 240e6be3..ed5a9cea 100644
--- a/lib/trace-cmd/plugins/Makefile
+++ b/lib/trace-cmd/plugins/Makefile
@@ -26,7 +26,7 @@ $(PLUGIN_BUILD): $(bdir)/%.so: $(bdir)/%.o
 	$(Q)$(do_plugin_build)
 
 $(DEPS): $(bdir)/.%.d: %.c
-	$(Q)$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@
+	$(Q)$(CC) -M -MT $(bdir)/$*.o $(CPPFLAGS) $(CFLAGS) $< > $@
 
 $(PLUGIN_OBJS): $(bdir)/%.o : $(bdir)/.%.d
 
diff --git a/lib/traceevent/Makefile b/lib/traceevent/Makefile
index c3f09572..d0666911 100644
--- a/lib/traceevent/Makefile
+++ b/lib/traceevent/Makefile
@@ -37,7 +37,7 @@ $(bdir)/%.o: %.c
 	$(Q)$(call do_fpic_compile)
 
 $(DEPS): $(bdir)/.%.d: %.c
-	$(Q)$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@
+	$(Q)$(CC) -M -MT $(bdir)/$*.o $(CPPFLAGS) $(CFLAGS) $< > $@
 
 $(OBJS): $(bdir)/%.o : $(bdir)/.%.d
 
diff --git a/lib/traceevent/plugins/Makefile b/lib/traceevent/plugins/Makefile
index 40500194..21e933af 100644
--- a/lib/traceevent/plugins/Makefile
+++ b/lib/traceevent/plugins/Makefile
@@ -40,7 +40,7 @@ $(PLUGIN_BUILD): $(bdir)/%.so: $(bdir)/%.o
 	$(Q)$(do_plugin_build)
 
 $(DEPS): $(bdir)/.%.d: %.c
-	$(Q)$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@
+	$(Q)$(CC) -M -MT $(bdir)/$*.o $(CPPFLAGS) $(CFLAGS) $< > $@
 
 $(PLUGIN_OBJS): $(bdir)/%.o : $(bdir)/.%.d
 
diff --git a/lib/tracefs/Makefile b/lib/tracefs/Makefile
index f6d93ec8..b810bbf4 100644
--- a/lib/tracefs/Makefile
+++ b/lib/tracefs/Makefile
@@ -34,7 +34,7 @@ $(bdir)/%.o: %.c
 	$(Q)$(call do_fpic_compile)
 
 $(DEPS): $(bdir)/.%.d: %.c
-	$(Q)$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@
+	$(Q)$(CC) -M -MT $(bdir)/$*.o $(CPPFLAGS) $(CFLAGS) $< > $@
 
 $(OBJS): $(bdir)/%.o : $(bdir)/.%.d
 
diff --git a/tracecmd/Makefile b/tracecmd/Makefile
index 17e67600..5a7f7d2b 100644
--- a/tracecmd/Makefile
+++ b/tracecmd/Makefile
@@ -70,7 +70,7 @@ $(bdir)/%.o: %.c
 	$(Q)$(call do_compile)
 
 $(all_deps): $(bdir)/.%.d: %.c
-	$(Q)$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@
+	$(Q)$(CC) -M -MT $(bdir)/$*.o $(CPPFLAGS) $(CFLAGS) $< > $@
 
 $(all_deps): $(TC_VERSION)
 
diff --git a/utest/Makefile b/utest/Makefile
index 55aa46ab..d635650d 100644
--- a/utest/Makefile
+++ b/utest/Makefile
@@ -30,6 +30,7 @@ $(bdir)/%.o: %.c
 
 $(DEPS): $(bdir)/.%.d: %.c
 	$(Q)$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@
+	$(Q)$(CC) -M -MT $(bdir)/$*.o $(CPPFLAGS) $(CFLAGS) $< > $@
 
 $(OBJS): $(bdir)/%.o : $(bdir)/.%.d
 
-- 
2.25.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-06-02 22:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-02 22:16 [PATCH] trace-cmd: Fix build dependencies Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).