From 19ac36b5e2bdbcb8eb4165c2d028efeac91c99aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Vilanova?= Date: Wed, 18 Apr 2012 20:15:39 +0200 Subject: [PATCH 1/2] Generic elimination of auto-generated files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Lluís Vilanova Signed-off-by: Stefan Hajnoczi --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 4f43793866..72f7ab218e 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ ifeq ($(TRACE_BACKEND),dtrace) GENERATED_HEADERS += trace-dtrace.h endif GENERATED_HEADERS += qmp-commands.h qapi-types.h qapi-visit.h -GENERATED_SOURCES += qmp-marshal.c qapi-types.c qapi-visit.c +GENERATED_SOURCES += qmp-marshal.c qapi-types.c qapi-visit.c trace.c # Don't try to regenerate Makefile or configure # We don't generate any of them @@ -220,11 +220,11 @@ clean: rm -f qom/*.o qom/*.d rm -f qemu-img-cmds.h rm -f trace/*.o trace/*.d - rm -f trace.c trace.h trace.c-timestamp trace.h-timestamp rm -f trace-dtrace.dtrace trace-dtrace.dtrace-timestamp + @# May not be present in GENERATED_HEADERS rm -f trace-dtrace.h trace-dtrace.h-timestamp - rm -f $(GENERATED_HEADERS) - rm -f $(GENERATED_SOURCES) + rm -f $(foreach f,$(GENERATED_HEADERS),$(f) $(f)-timestamp) + rm -f $(foreach f,$(GENERATED_SOURCES),$(f) $(f)-timestamp) rm -rf $(qapi-dir) $(MAKE) -C tests/tcg clean for d in $(ALL_SUBDIRS) $(QEMULIBS) libcacard; do \ From c0424934fae64785adc3d3818f2e6ad1bcb50ca9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Vilanova?= Date: Wed, 18 Apr 2012 20:15:45 +0200 Subject: [PATCH 2/2] Beautify makefile commands for generation of files with tracetool MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Lluís Vilanova Signed-off-by: Stefan Hajnoczi --- Makefile.objs | 22 +++++++++++++++------- Makefile.target | 4 ++-- rules.mak | 3 +++ 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Makefile.objs b/Makefile.objs index 6d6f24d9d3..70c5c79a6e 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -373,17 +373,22 @@ libdis-$(CONFIG_LM32_DIS) += lm32-dis.o # trace ifeq ($(TRACE_BACKEND),dtrace) -trace.h: trace.h-timestamp trace-dtrace.h -else -trace.h: trace.h-timestamp +TRACE_H_EXTRA_DEPS=trace-dtrace.h endif +trace.h: trace.h-timestamp $(TRACE_H_EXTRA_DEPS) trace.h-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak - $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/tracetool.py --format=h --backend=$(TRACE_BACKEND) < $< > $@," GEN trace.h") + $(call quiet-command,$(TRACETOOL) \ + --format=h \ + --backend=$(TRACE_BACKEND) \ + < $< > $@," GEN trace.h") @cmp -s $@ trace.h || cp $@ trace.h trace.c: trace.c-timestamp trace.c-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak - $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/tracetool.py --format=c --backend=$(TRACE_BACKEND) < $< > $@," GEN trace.c") + $(call quiet-command,$(TRACETOOL) \ + --format=c \ + --backend=$(TRACE_BACKEND) \ + < $< > $@," GEN trace.c") @cmp -s $@ trace.c || cp $@ trace.c trace.o: trace.c $(GENERATED_HEADERS) @@ -396,11 +401,14 @@ trace-dtrace.h: trace-dtrace.dtrace # rule file. So we use '.dtrace' instead trace-dtrace.dtrace: trace-dtrace.dtrace-timestamp trace-dtrace.dtrace-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak - $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/tracetool.py --format=d --backend=$(TRACE_BACKEND) < $< > $@," GEN trace-dtrace.dtrace") + $(call quiet-command,$(TRACETOOL) \ + --format=d \ + --backend=$(TRACE_BACKEND) \ + < $< > $@," GEN trace-dtrace.dtrace") @cmp -s $@ trace-dtrace.dtrace || cp $@ trace-dtrace.dtrace trace-dtrace.o: trace-dtrace.dtrace $(GENERATED_HEADERS) - $(call quiet-command,dtrace -o $@ -G -s $<, " GEN trace-dtrace.o") + $(call quiet-command,dtrace -o $@ -G -s $<, " GEN trace-dtrace.o") ifeq ($(LIBTOOL),) trace-dtrace.lo: trace-dtrace.dtrace diff --git a/Makefile.target b/Makefile.target index 4fbbabfe24..1cf694372c 100644 --- a/Makefile.target +++ b/Makefile.target @@ -59,13 +59,13 @@ TARGET_TYPE=system endif $(QEMU_PROG).stp: $(SRC_PATH)/trace-events - $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/tracetool.py \ + $(call quiet-command,$(TRACETOOL) \ --format=stap \ --backend=$(TRACE_BACKEND) \ --binary=$(bindir)/$(QEMU_PROG) \ --target-arch=$(TARGET_ARCH) \ --target-type=$(TARGET_TYPE) \ - < $(SRC_PATH)/trace-events > $(QEMU_PROG).stp," GEN $(QEMU_PROG).stp") + < $< > $@," GEN $(QEMU_PROG).stp") else stap: endif diff --git a/rules.mak b/rules.mak index c30093c116..efef6f242d 100644 --- a/rules.mak +++ b/rules.mak @@ -59,6 +59,9 @@ find-in-path = $(if $(find-string /, $1), \ $(wildcard $1), \ $(wildcard $(patsubst %, %/$1, $(subst :, ,$(PATH))))) +# Generate files with tracetool +TRACETOOL=$(PYTHON) $(SRC_PATH)/scripts/tracetool.py + # Generate timestamp files for .h include files %.h: %.h-timestamp