diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2020-02-04 12:20:10 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2020-08-21 06:18:24 -0400 |
commit | 243af0225ab37c642d73e4002b233af728119f72 (patch) | |
tree | 49f5015d7ef96c3a4a1b5861927f11dd3c07f4f8 /Makefile | |
parent | 22fb2ab096ff55672ef9f43e37ed510b14dc5b79 (diff) | |
download | qemu-243af0225ab37c642d73e4002b233af728119f72.zip qemu-243af0225ab37c642d73e4002b233af728119f72.tar.gz qemu-243af0225ab37c642d73e4002b233af728119f72.tar.bz2 |
trace: switch position of headers to what Meson requires
Meson doesn't enjoy the same flexibility we have with Make in choosing
the include path. In particular the tracing headers are using
$(build_root)/$(<D).
In order to keep the include directives unchanged,
the simplest solution is to generate headers with patterns like
"trace/trace-audio.h" and place forwarding headers in the source tree
such that for example "audio/trace.h" includes "trace/trace-audio.h".
This patch is too ugly to be applied to the Makefiles now. It's only
a way to separate the changes to the tracing header files from the
Meson rewrite of the tracing logic.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 46 |
1 files changed, 28 insertions, 18 deletions
@@ -159,8 +159,8 @@ generated-files-$(CONFIG_TRACE_UST) += trace-ust-all.c generated-files-y += module_block.h -TRACE_HEADERS = trace-root.h $(trace-events-subdirs:%=%/trace.h) -TRACE_SOURCES = trace-root.c $(trace-events-subdirs:%=%/trace.c) +TRACE_HEADERS = trace/trace-root.h +TRACE_SOURCES = trace/trace-root.c TRACE_DTRACE = ifdef CONFIG_TRACE_DTRACE TRACE_HEADERS += trace-dtrace-root.h $(trace-events-subdirs:%=%/trace-dtrace.h) @@ -170,33 +170,37 @@ ifdef CONFIG_TRACE_UST TRACE_HEADERS += trace-ust-root.h $(trace-events-subdirs:%=%/trace-ust.h) endif -generated-files-y += $(TRACE_HEADERS) -generated-files-y += $(TRACE_SOURCES) generated-files-y += $(BUILD_DIR)/trace-events-all generated-files-y += .git-submodule-status trace-group-name = $(shell dirname $1 | sed -e 's/[^a-zA-Z0-9]/_/g') +trace-group-suffix = $(shell echo $1 | sed -e 's/[^a-zA-Z0-9]/_/g') tracetool-y = $(SRC_PATH)/scripts/tracetool.py tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py") -%/trace.h: %/trace.h-timestamp - @cmp $< $@ >/dev/null 2>&1 || cp $< $@ -%/trace.h-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak +define __trace_rules +TRACE_HEADERS += trace/trace-$2.h +TRACE_SOURCES += trace/trace-$2.c +trace-obj-y += trace/trace-$2.o +trace/trace-$2.h: trace/trace-$2.h-timestamp + @cmp $$< $$@ >/dev/null 2>&1 || cp $$< $$@ +trace/trace-$2.h-timestamp: $(SRC_PATH)/$1/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak $(call quiet-command,$(TRACETOOL) \ - --group=$(call trace-group-name,$@) \ + --group=$2 \ --format=h \ --backends=$(TRACE_BACKENDS) \ - $< > $@,"GEN","$(@:%-timestamp=%)") + $$< > $$@,"GEN","$$(@:%-timestamp=%)") -%/trace.c: %/trace.c-timestamp - @cmp $< $@ >/dev/null 2>&1 || cp $< $@ -%/trace.c-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak +trace/trace-$2.c: trace/trace-$2.c-timestamp + @cmp $$< $$@ >/dev/null 2>&1 || cp $$< $$@ +trace/trace-$2.c-timestamp: $(SRC_PATH)/$1/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak $(call quiet-command,$(TRACETOOL) \ - --group=$(call trace-group-name,$@) \ + --group=$2 \ --format=c \ --backends=$(TRACE_BACKENDS) \ - $< > $@,"GEN","$(@:%-timestamp=%)") + $$< > $$@,"GEN","$$(@:%-timestamp=%)") +endef %/trace-ust.h: %/trace-ust.h-timestamp @cmp $< $@ >/dev/null 2>&1 || cp $< $@ @@ -222,18 +226,18 @@ tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py") %/trace-dtrace.o: %/trace-dtrace.dtrace $(tracetool-y) -trace-root.h: trace-root.h-timestamp +trace/trace-root.h: trace/trace-root.h-timestamp @cmp $< $@ >/dev/null 2>&1 || cp $< $@ -trace-root.h-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak +trace/trace-root.h-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak $(call quiet-command,$(TRACETOOL) \ --group=root \ --format=h \ --backends=$(TRACE_BACKENDS) \ $< > $@,"GEN","$(@:%-timestamp=%)") -trace-root.c: trace-root.c-timestamp +trace/trace-root.c: trace/trace-root.c-timestamp @cmp $< $@ >/dev/null 2>&1 || cp $< $@ -trace-root.c-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak +trace/trace-root.c-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak $(call quiet-command,$(TRACETOOL) \ --group=root \ --format=c \ @@ -477,6 +481,12 @@ dummy := $(call unnest-vars,, \ common-obj-m \ trace-obj-y) +dummy := $(foreach DIR,$(trace-events-subdirs),$(eval $(call __trace_rules,$(DIR),$(call trace-group-suffix,$(DIR))))) + +generated-files-y += $(TRACE_HEADERS) +generated-files-y += $(TRACE_SOURCES) + + include $(SRC_PATH)/tests/Makefile.include all: $(DOCS) $(if $(BUILD_DOCS),sphinxdocs) $(TOOLS) $(HELPERS-y) recurse-all modules $(vhost-user-json-y) |