More concise handling of tracetool-generated files
cover More concise handling of tracetool-generated files
NOTE: Applies on top of the tracetool improvements series.
Some trivial changes to handle tracetool-generated files more concisely.
---
Lluís Vilanova (3):
[trivial] Generic elimination of auto-generated files [trivial] Simpler handling of tracetool-generated files in makfiles [trivial] Regenerate files when tracetool changes
Makefile | 8 ++++---- Makefile.objs | 25 ++++++++++++------------- rules.mak | 6 ++++++ 3 files changed, 22 insertions(+), 17 deletions(-)
To: [email protected]
Cc: Stefan Hajnoczi <[email protected]>
PATCH 1/3 Generic elimination of auto-generated files
--- Makefile | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
Makefile +4 -4
@@ -8,7 +8,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 ifneq ($(wildcard config-host.mak),) # Put the all: rule here so that config-host.mak can contain dependencies.
@@ -216,11 +216,11 @@ clean: rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d block/*.o block/*.d net/*.o net/*.d fsdev/*.o fsdev/*.d ui/*.o ui/*.d qapi/*.o qapi/*.d qga/*.o qga/*.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 */$(f) */$(f)-timestamp) + rm -f $(foreach f,$(GENERATED_SOURCES),$(f) $(f)-timestamp */$(f) */$(f)-timestamp) rm -rf $(qapi-dir) $(MAKE) -C tests/tcg clean for d in $(ALL_SUBDIRS) $(QEMULIBS) libcacard; do \
PATCH 2/3 Simpler handling of tracetool-generated files in makfiles
In reply to Lluís Vilanova--- Makefile.objs | 19 +++++++++---------- rules.mak | 6 ++++++ 2 files changed, 15 insertions(+), 10 deletions(-)
Makefile.objs +9 -10
@@ -349,18 +349,17 @@ libdis-$(CONFIG_SPARC_DIS) += sparc-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") - @cmp -s $@ trace.h || cp $@ trace.h + $(call tracetool-gen,h,$(TRACE_BACKEND)) + $(call tracetool-ci) 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") - @cmp -s $@ trace.c || cp $@ trace.c + $(call tracetool-gen,c,$(TRACE_BACKEND)) + $(call tracetool-ci) trace.o: trace.c $(GENERATED_HEADERS)
@@ -372,11 +371,11 @@ 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") - @cmp -s $@ trace-dtrace.dtrace || cp $@ trace-dtrace.dtrace + $(call tracetool-gen,d,$(TRACE_BACKEND)) + $(call tracetool-ci) 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
rules.mak +6 -0
@@ -59,6 +59,12 @@ find-in-path = $(if $(find-string /, $1), \ $(wildcard $1), \ $(wildcard $(patsubst %, %/$1, $(subst :, ,$(PATH))))) +# Generate files with tracetool + +TRACETOOL=$(SRC_PATH)/scripts/tracetool.py +tracetool-gen=$(call quiet-command,$(PYTHON) $(TRACETOOL) $(3) --format=$(1) --backend=$(2) < $< > $@," GEN $(subst -timestamp,,$@)") +tracetool-ci=@cmp -s $@ $(subst -timestamp,,$@) || cp $@ $(subst -timestamp,,$@) + # Generate timestamp files for .h include files %.h: %.h-timestamp
PATCH 3/3 Regenerate files when tracetool changes
In reply to Lluís Vilanova--- Makefile.objs | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
Makefile.objs +3 -3
@@ -352,12 +352,12 @@ ifeq ($(TRACE_BACKEND),dtrace) 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 +trace.h-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak $(TRACETOOL) $(call tracetool-gen,h,$(TRACE_BACKEND)) $(call tracetool-ci) trace.c: trace.c-timestamp -trace.c-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak +trace.c-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak $(TRACETOOL) $(call tracetool-gen,c,$(TRACE_BACKEND)) $(call tracetool-ci)
@@ -370,7 +370,7 @@ trace-dtrace.h: trace-dtrace.dtrace # but that gets picked up by QEMU's Makefile as an external dependency # 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 +trace-dtrace.dtrace-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak $(TRACETOOL) $(call tracetool-gen,d,$(TRACE_BACKEND)) $(call tracetool-ci)
Quoted 2 lines · Lluís Vilanova
NOTE: Applies on top of the tracetool improvements series. Some trivial changes to handle tracetool-generated files more concisely.
Please disregard this series; it will be resent after acceptance of the tracetool rewrite.
Thanks,
Lluis
Signature · 4 lines
"And it's much the same thing with knowledge, for whenever you learn something new, the whole world becomes that much richer." -- The Princess of Pure Reason, as told by Norton Juster in The Phantom Tollbooth