Skip to content

Commit 243af02

Browse files
committed
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 <[email protected]>
1 parent 22fb2ab commit 243af02

File tree

96 files changed

+121
-41
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+121
-41
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ docker-src.*
146146
*~
147147
*.ast_raw
148148
*.depend_raw
149-
trace.h
150149
trace.c
151150
trace-ust.h
152151
trace-ust.h

Makefile

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ generated-files-$(CONFIG_TRACE_UST) += trace-ust-all.c
159159

160160
generated-files-y += module_block.h
161161

162-
TRACE_HEADERS = trace-root.h $(trace-events-subdirs:%=%/trace.h)
163-
TRACE_SOURCES = trace-root.c $(trace-events-subdirs:%=%/trace.c)
162+
TRACE_HEADERS = trace/trace-root.h
163+
TRACE_SOURCES = trace/trace-root.c
164164
TRACE_DTRACE =
165165
ifdef CONFIG_TRACE_DTRACE
166166
TRACE_HEADERS += trace-dtrace-root.h $(trace-events-subdirs:%=%/trace-dtrace.h)
@@ -170,33 +170,37 @@ ifdef CONFIG_TRACE_UST
170170
TRACE_HEADERS += trace-ust-root.h $(trace-events-subdirs:%=%/trace-ust.h)
171171
endif
172172

173-
generated-files-y += $(TRACE_HEADERS)
174-
generated-files-y += $(TRACE_SOURCES)
175173
generated-files-y += $(BUILD_DIR)/trace-events-all
176174
generated-files-y += .git-submodule-status
177175

178176
trace-group-name = $(shell dirname $1 | sed -e 's/[^a-zA-Z0-9]/_/g')
177+
trace-group-suffix = $(shell echo $1 | sed -e 's/[^a-zA-Z0-9]/_/g')
179178

180179
tracetool-y = $(SRC_PATH)/scripts/tracetool.py
181180
tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py")
182181

183-
%/trace.h: %/trace.h-timestamp
184-
@cmp $< $@ >/dev/null 2>&1 || cp $< $@
185-
%/trace.h-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
182+
define __trace_rules
183+
TRACE_HEADERS += trace/trace-$2.h
184+
TRACE_SOURCES += trace/trace-$2.c
185+
trace-obj-y += trace/trace-$2.o
186+
trace/trace-$2.h: trace/trace-$2.h-timestamp
187+
@cmp $$< $$@ >/dev/null 2>&1 || cp $$< $$@
188+
trace/trace-$2.h-timestamp: $(SRC_PATH)/$1/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
186189
$(call quiet-command,$(TRACETOOL) \
187-
--group=$(call trace-group-name,$@) \
190+
--group=$2 \
188191
--format=h \
189192
--backends=$(TRACE_BACKENDS) \
190-
$< > $@,"GEN","$(@:%-timestamp=%)")
193+
$$< > $$@,"GEN","$$(@:%-timestamp=%)")
191194

192-
%/trace.c: %/trace.c-timestamp
193-
@cmp $< $@ >/dev/null 2>&1 || cp $< $@
194-
%/trace.c-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
195+
trace/trace-$2.c: trace/trace-$2.c-timestamp
196+
@cmp $$< $$@ >/dev/null 2>&1 || cp $$< $$@
197+
trace/trace-$2.c-timestamp: $(SRC_PATH)/$1/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
195198
$(call quiet-command,$(TRACETOOL) \
196-
--group=$(call trace-group-name,$@) \
199+
--group=$2 \
197200
--format=c \
198201
--backends=$(TRACE_BACKENDS) \
199-
$< > $@,"GEN","$(@:%-timestamp=%)")
202+
$$< > $$@,"GEN","$$(@:%-timestamp=%)")
203+
endef
200204

201205
%/trace-ust.h: %/trace-ust.h-timestamp
202206
@cmp $< $@ >/dev/null 2>&1 || cp $< $@
@@ -222,18 +226,18 @@ tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py")
222226
%/trace-dtrace.o: %/trace-dtrace.dtrace $(tracetool-y)
223227

224228

225-
trace-root.h: trace-root.h-timestamp
229+
trace/trace-root.h: trace/trace-root.h-timestamp
226230
@cmp $< $@ >/dev/null 2>&1 || cp $< $@
227-
trace-root.h-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
231+
trace/trace-root.h-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
228232
$(call quiet-command,$(TRACETOOL) \
229233
--group=root \
230234
--format=h \
231235
--backends=$(TRACE_BACKENDS) \
232236
$< > $@,"GEN","$(@:%-timestamp=%)")
233237

234-
trace-root.c: trace-root.c-timestamp
238+
trace/trace-root.c: trace/trace-root.c-timestamp
235239
@cmp $< $@ >/dev/null 2>&1 || cp $< $@
236-
trace-root.c-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
240+
trace/trace-root.c-timestamp: $(SRC_PATH)/trace-events $(tracetool-y) $(BUILD_DIR)/config-host.mak
237241
$(call quiet-command,$(TRACETOOL) \
238242
--group=root \
239243
--format=c \
@@ -477,6 +481,12 @@ dummy := $(call unnest-vars,, \
477481
common-obj-m \
478482
trace-obj-y)
479483

484+
dummy := $(foreach DIR,$(trace-events-subdirs),$(eval $(call __trace_rules,$(DIR),$(call trace-group-suffix,$(DIR)))))
485+
486+
generated-files-y += $(TRACE_HEADERS)
487+
generated-files-y += $(TRACE_SOURCES)
488+
489+
480490
include $(SRC_PATH)/tests/Makefile.include
481491

482492
all: $(DOCS) $(if $(BUILD_DOCS),sphinxdocs) $(TOOLS) $(HELPERS-y) recurse-all modules $(vhost-user-json-y)

Makefile.objs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ trace-events-subdirs += util
209209
trace-events-files = $(SRC_PATH)/trace-events $(trace-events-subdirs:%=$(SRC_PATH)/%/trace-events)
210210

211211
trace-obj-y = trace-root.o
212-
trace-obj-y += $(trace-events-subdirs:%=%/trace.o)
213212
trace-obj-$(CONFIG_TRACE_UST) += trace-ust-all.o
214213
trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace-root.o
215214
trace-obj-$(CONFIG_TRACE_DTRACE) += $(trace-events-subdirs:%=%/trace-dtrace.o)

accel/kvm/trace.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "trace/trace-accel_kvm.h"

accel/tcg/cputlb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include "qemu/atomic.h"
3535
#include "qemu/atomic128.h"
3636
#include "translate-all.h"
37-
#include "trace-root.h"
37+
#include "trace/trace-root.h"
3838
#include "trace/mem.h"
3939
#ifdef CONFIG_PLUGIN
4040
#include "qemu/plugin-memory.h"

accel/tcg/trace.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "trace/trace-accel_tcg.h"

accel/tcg/user-exec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include "translate-all.h"
2727
#include "exec/helper-proto.h"
2828
#include "qemu/atomic128.h"
29-
#include "trace-root.h"
29+
#include "trace/trace-root.h"
3030
#include "trace/mem.h"
3131

3232
#undef EAX

audio/trace.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "trace/trace-audio.h"

authz/trace.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "trace/trace-authz.h"

backends/tpm/trace.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "trace/trace-backends_tpm.h"

0 commit comments

Comments
 (0)