diff mbox series

trace-cmd: Fix build dependencies

Message ID 20200602181618.737914a8@oasis.local.home (mailing list archive)
State Accepted
Commit 33bf16e20a9ffcc3d86b697c307302b0e6a8d89b
Headers show
Series trace-cmd: Fix build dependencies | expand

Commit Message

Steven Rostedt June 2, 2020, 10:16 p.m. UTC
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 mbox series

Patch

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