Patchwork trace: rebuild generated-events.o when configuration changes

login
register
mail settings
Submitter Stefan Hajnoczi
Date March 8, 2013, 2:52 p.m.
Message ID <1362754335-4381-1-git-send-email-stefanha@redhat.com>
Download mbox | patch
Permalink /patch/226136/
State New
Headers show

Comments

Stefan Hajnoczi - March 8, 2013, 2:52 p.m.
Make sure to rebuild generated-events.o when ./configure options change.
This prevents linker errors when a stale generated-events.o gets linked
with code compiled against fresh headers.  For example, try building
with ./configure --enable-trace-backend=stderr followed by ./configure
--enable-trace-backend=dtrace.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 trace/Makefile.objs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Stefan Hajnoczi - March 11, 2013, 2:18 p.m.
On Fri, Mar 08, 2013 at 03:52:15PM +0100, Stefan Hajnoczi wrote:
> Make sure to rebuild generated-events.o when ./configure options change.
> This prevents linker errors when a stale generated-events.o gets linked
> with code compiled against fresh headers.  For example, try building
> with ./configure --enable-trace-backend=stderr followed by ./configure
> --enable-trace-backend=dtrace.
> 
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>  trace/Makefile.objs | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to my tracing tree:
https://github.com/stefanha/qemu/commits/tracing

Stefan

Patch

diff --git a/trace/Makefile.objs b/trace/Makefile.objs
index 156aa25..a043072 100644
--- a/trace/Makefile.objs
+++ b/trace/Makefile.objs
@@ -11,7 +11,7 @@  $(obj)/generated-events.h-timestamp: $(SRC_PATH)/trace-events
 		< $< > $@,"  GEN   $(patsubst %-timestamp,%,$@)")
 	@cmp -s $@ $(patsubst %-timestamp,%,$@) || cp $@ $(patsubst %-timestamp,%,$@)
 
-$(obj)/generated-events.c: $(obj)/generated-events.c-timestamp
+$(obj)/generated-events.c: $(obj)/generated-events.c-timestamp $(BUILD_DIR)/config-host.mak
 $(obj)/generated-events.c-timestamp: $(SRC_PATH)/trace-events
 	$(call quiet-command,$(TRACETOOL) \
 		--format=events-c \