@@ -56,25 +56,136 @@ GENERATED_SOURCES += qmp-marshal.c qapi-types.c qapi-visit.c qapi-event.c
56
56
GENERATED_HEADERS += qmp-introspect.h
57
57
GENERATED_SOURCES += qmp-introspect.c
58
58
59
- GENERATED_HEADERS += trace/generated-tracers.h
60
- ifeq ($(findstring dtrace,$(TRACE_BACKENDS ) ) ,dtrace)
61
- GENERATED_HEADERS += trace/generated-tracers-dtrace.h
62
- endif
63
- GENERATED_SOURCES += trace/generated-tracers.c
64
-
65
59
GENERATED_HEADERS += trace/generated-tcg-tracers.h
66
60
67
61
GENERATED_HEADERS += trace/generated-helpers-wrappers.h
68
62
GENERATED_HEADERS += trace/generated-helpers.h
69
63
GENERATED_SOURCES += trace/generated-helpers.c
70
64
71
- ifeq ( $( findstring ust, $( TRACE_BACKENDS ) ) ,ust)
72
- GENERATED_HEADERS += trace/generated -ust-provider .h
73
- GENERATED_SOURCES += trace/generated -ust.c
65
+ ifdef CONFIG_TRACE_UST
66
+ GENERATED_HEADERS += trace-ust-all .h
67
+ GENERATED_SOURCES += trace-ust-all .c
74
68
endif
75
69
76
70
GENERATED_HEADERS += module_block.h
77
71
72
+ TRACE_HEADERS = trace-root.h $(trace-events-subdirs:%=%/trace.h )
73
+ TRACE_SOURCES = trace-root.c $(trace-events-subdirs:%=%/trace.c )
74
+ TRACE_DTRACE =
75
+ ifdef CONFIG_TRACE_DTRACE
76
+ TRACE_HEADERS += trace-dtrace-root.h $(trace-events-subdirs:%=%/trace-dtrace.h )
77
+ TRACE_DTRACE += trace-dtrace-root.dtrace $(trace-events-subdirs:%=%/trace-dtrace.dtrace )
78
+ endif
79
+ ifdef CONFIG_TRACE_UST
80
+ TRACE_HEADERS += trace-ust-root.h $(trace-events-subdirs:%=%/trace-ust.h )
81
+ endif
82
+
83
+ GENERATED_HEADERS += $(TRACE_HEADERS )
84
+ GENERATED_SOURCES += $(TRACE_SOURCES )
85
+
86
+ trace-group-name = $(shell dirname $1 | sed -e 's/[^a-zA-Z0-9]/_/g')
87
+
88
+ % /trace.h : % /trace.h-timestamp
89
+ @cmp $< $@ > /dev/null 2>&1 || cp $< $@
90
+ % /trace.h-timestamp : $(SRC_PATH ) /% /trace-events $(tracetool-y )
91
+ $(call quiet-command,$(TRACETOOL ) \
92
+ --group=$(call trace-group-name,$@ ) \
93
+ --format=h \
94
+ --backends=$(TRACE_BACKENDS ) \
95
+ $< > $@ ," GEN" ," $( @:%-timestamp=%) " )
96
+
97
+ % /trace.c : % /trace.c-timestamp
98
+ @cmp $< $@ > /dev/null 2>&1 || cp $< $@
99
+ % /trace.c-timestamp : $(SRC_PATH ) /% /trace-events $(tracetool-y )
100
+ $(call quiet-command,$(TRACETOOL ) \
101
+ --group=$(call trace-group-name,$@ ) \
102
+ --format=c \
103
+ --backends=$(TRACE_BACKENDS ) \
104
+ $< > $@ ," GEN" ," $( @:%-timestamp=%) " )
105
+
106
+ % /trace-ust.h : % /trace-ust.h-timestamp
107
+ @cmp $< $@ > /dev/null 2>&1 || cp $< $@
108
+ % /trace-ust.h-timestamp : $(SRC_PATH ) /% /trace-events $(tracetool-y )
109
+ $(call quiet-command,$(TRACETOOL ) \
110
+ --group=$(call trace-group-name,$@ ) \
111
+ --format=ust-events-h \
112
+ --backends=$(TRACE_BACKENDS ) \
113
+ $< > $@ ," GEN" ," $( @:%-timestamp=%) " )
114
+
115
+ % /trace-dtrace.dtrace : % /trace-dtrace.dtrace-timestamp
116
+ @cmp $< $@ > /dev/null 2>&1 || cp $< $@
117
+ % /trace-dtrace.dtrace-timestamp : $(SRC_PATH ) /% /trace-events $(BUILD_DIR ) /config-host.mak $(tracetool-y )
118
+ $(call quiet-command,$(TRACETOOL ) \
119
+ --group=$(call trace-group-name,$@ ) \
120
+ --format=d \
121
+ --backends=$(TRACE_BACKENDS ) \
122
+ $< > $@ ," GEN" ," $( @:%-timestamp=%) " )
123
+
124
+ % /trace-dtrace.h : % /trace-dtrace.dtrace $(tracetool-y )
125
+ $(call quiet-command,dtrace -o $@ -h -s $< , "GEN","$@ ")
126
+
127
+ % /trace-dtrace.o : % /trace-dtrace.dtrace $(tracetool-y )
128
+
129
+
130
+ trace-root.h : trace-root.h-timestamp
131
+ @cmp $< $@ > /dev/null 2>&1 || cp $< $@
132
+ trace-root.h-timestamp : $(SRC_PATH ) /trace-events $(tracetool-y )
133
+ $(call quiet-command,$(TRACETOOL ) \
134
+ --group=root \
135
+ --format=h \
136
+ --backends=$(TRACE_BACKENDS ) \
137
+ $< > $@ ," GEN" ," $( @:%-timestamp=%) " )
138
+
139
+ trace-root.c : trace-root.c-timestamp
140
+ @cmp $< $@ > /dev/null 2>&1 || cp $< $@
141
+ trace-root.c-timestamp : $(SRC_PATH ) /trace-events $(tracetool-y )
142
+ $(call quiet-command,$(TRACETOOL ) \
143
+ --group=root \
144
+ --format=c \
145
+ --backends=$(TRACE_BACKENDS ) \
146
+ $< > $@ ," GEN" ," $( @:%-timestamp=%) " )
147
+
148
+ trace-ust-root.h : trace-ust-root.h-timestamp
149
+ @cmp $< $@ > /dev/null 2>&1 || cp $< $@
150
+ trace-ust-root.h-timestamp : $(SRC_PATH ) /trace-events $(tracetool-y )
151
+ $(call quiet-command,$(TRACETOOL ) \
152
+ --group=root \
153
+ --format=ust-events-h \
154
+ --backends=$(TRACE_BACKENDS ) \
155
+ $< > $@ ," GEN" ," $( @:%-timestamp=%) " )
156
+
157
+ trace-ust-all.h : trace-ust-all.h-timestamp
158
+ @cmp $< $@ > /dev/null 2>&1 || cp $< $@
159
+ trace-ust-all.h-timestamp : $(trace-events-files ) $(tracetool-y )
160
+ $(call quiet-command,$(TRACETOOL ) \
161
+ --group=all \
162
+ --format=ust-events-h \
163
+ --backends=$(TRACE_BACKENDS ) \
164
+ $(trace-events-files ) > $@ ," GEN" ," $( @:%-timestamp=%) " )
165
+
166
+ trace-ust-all.c : trace-ust-all.c-timestamp
167
+ @cmp $< $@ > /dev/null 2>&1 || cp $< $@
168
+ trace-ust-all.c-timestamp : $(trace-events-files ) $(tracetool-y )
169
+ $(call quiet-command,$(TRACETOOL ) \
170
+ --group=all \
171
+ --format=ust-events-c \
172
+ --backends=$(TRACE_BACKENDS ) \
173
+ $(trace-events-files ) > $@ ," GEN" ," $( @:%-timestamp=%) " )
174
+
175
+ trace-dtrace-root.dtrace : trace-dtrace-root.dtrace-timestamp
176
+ @cmp $< $@ > /dev/null 2>&1 || cp $< $@
177
+ trace-dtrace-root.dtrace-timestamp : $(SRC_PATH ) /trace-events $(BUILD_DIR ) /config-host.mak $(tracetool-y )
178
+ $(call quiet-command,$(TRACETOOL ) \
179
+ --group=root \
180
+ --format=d \
181
+ --backends=$(TRACE_BACKENDS ) \
182
+ $< > $@ ," GEN" ," $( @:%-timestamp=%) " )
183
+
184
+ trace-dtrace-root.h : trace-dtrace-root.dtrace
185
+ $(call quiet-command,dtrace -o $@ -h -s $< , "GEN","$@ ")
186
+
187
+ trace-dtrace-root.o : trace-dtrace-root.dtrace
188
+
78
189
# Don't try to regenerate Makefile or configure
79
190
# We don't generate any of them
80
191
Makefile : ;
@@ -160,7 +271,8 @@ dummy := $(call unnest-vars,, \
160
271
qom-obj-y \
161
272
io-obj-y \
162
273
common-obj-y \
163
- common-obj-m)
274
+ common-obj-m \
275
+ trace-obj-y)
164
276
165
277
ifneq ($(wildcard config-host.mak) ,)
166
278
include $(SRC_PATH ) /tests/Makefile.include
@@ -223,7 +335,7 @@ subdir-dtc:dtc/libfdt dtc/tests
223
335
dtc/% :
224
336
mkdir -p $@
225
337
226
- $(SUBDIR_RULES ) : libqemuutil.a libqemustub.a $(common-obj-y ) $(qom-obj-y ) $(crypto-aes-obj-$(CONFIG_USER_ONLY ) )
338
+ $(SUBDIR_RULES ) : libqemuutil.a libqemustub.a $(common-obj-y ) $(qom-obj-y ) $(crypto-aes-obj-$(CONFIG_USER_ONLY ) ) $( trace-obj-y )
227
339
228
340
ROMSUBDIR_RULES =$(patsubst % ,romsubdir-% , $(ROMS ) )
229
341
# Only keep -O and -g cflags
@@ -247,15 +359,17 @@ libqemuutil.a: $(util-obj-y)
247
359
248
360
# #####################################################################
249
361
362
+ COMMON_LDADDS = $(trace-obj-y ) libqemuutil.a libqemustub.a
363
+
250
364
qemu-img.o : qemu-img-cmds.h
251
365
252
- qemu-img$(EXESUF ) : qemu-img.o $(block-obj-y ) $(crypto-obj-y ) $(io-obj-y ) $(qom-obj-y ) libqemuutil.a libqemustub.a
253
- qemu-nbd$(EXESUF ) : qemu-nbd.o $(block-obj-y ) $(crypto-obj-y ) $(io-obj-y ) $(qom-obj-y ) libqemuutil.a libqemustub.a
254
- qemu-io$(EXESUF ) : qemu-io.o $(block-obj-y ) $(crypto-obj-y ) $(io-obj-y ) $(qom-obj-y ) libqemuutil.a libqemustub.a
366
+ qemu-img$(EXESUF ) : qemu-img.o $(block-obj-y ) $(crypto-obj-y ) $(io-obj-y ) $(qom-obj-y ) $( COMMON_LDADDS )
367
+ qemu-nbd$(EXESUF ) : qemu-nbd.o $(block-obj-y ) $(crypto-obj-y ) $(io-obj-y ) $(qom-obj-y ) $( COMMON_LDADDS )
368
+ qemu-io$(EXESUF ) : qemu-io.o $(block-obj-y ) $(crypto-obj-y ) $(io-obj-y ) $(qom-obj-y ) $( COMMON_LDADDS )
255
369
256
- qemu-bridge-helper$(EXESUF ) : qemu-bridge-helper.o libqemuutil.a libqemustub.a
370
+ qemu-bridge-helper$(EXESUF ) : qemu-bridge-helper.o $( COMMON_LDADDS )
257
371
258
- fsdev/virtfs-proxy-helper$(EXESUF ) : fsdev/virtfs-proxy-helper.o fsdev/9p-marshal.o fsdev/9p-iov-marshal.o libqemuutil.a libqemustub.a
372
+ fsdev/virtfs-proxy-helper$(EXESUF ) : fsdev/virtfs-proxy-helper.o fsdev/9p-marshal.o fsdev/9p-iov-marshal.o $( COMMON_LDADDS )
259
373
fsdev/virtfs-proxy-helper$(EXESUF ) : LIBS += -lcap
260
374
261
375
qemu-img-cmds.h : $(SRC_PATH ) /qemu-img-cmds.hx $(SRC_PATH ) /scripts/hxtool
@@ -320,7 +434,7 @@ $(qapi-modules) $(SRC_PATH)/scripts/qapi-introspect.py $(qapi-py)
320
434
QGALIB_GEN =$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qmp-commands.h)
321
435
$(qga-obj-y ) qemu-ga.o : $(QGALIB_GEN )
322
436
323
- qemu-ga$(EXESUF ) : $(qga-obj-y ) libqemuutil.a libqemustub.a
437
+ qemu-ga$(EXESUF ) : $(qga-obj-y ) $( COMMON_LDADDS )
324
438
$(call LINK, $^ )
325
439
326
440
ifdef QEMU_GA_MSI_ENABLED
@@ -345,9 +459,9 @@ ifneq ($(EXESUF),)
345
459
qemu-ga : qemu-ga$(EXESUF ) $(QGA_VSS_PROVIDER ) $(QEMU_GA_MSI )
346
460
endif
347
461
348
- ivshmem-client$(EXESUF ) : $(ivshmem-client-obj-y ) libqemuutil.a libqemustub.a
462
+ ivshmem-client$(EXESUF ) : $(ivshmem-client-obj-y ) $( COMMON_LDADDS )
349
463
$(call LINK, $^ )
350
- ivshmem-server$(EXESUF ) : $(ivshmem-server-obj-y ) libqemuutil.a libqemustub.a
464
+ ivshmem-server$(EXESUF ) : $(ivshmem-server-obj-y ) $( COMMON_LDADDS )
351
465
$(call LINK, $^ )
352
466
353
467
module_block.h : $(SRC_PATH ) /scripts/modules/module_block.py config-host.mak
@@ -664,6 +778,10 @@ ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fa
664
778
Makefile : $(GENERATED_HEADERS )
665
779
endif
666
780
781
+ .SECONDARY : $(TRACE_HEADERS ) $(TRACE_HEADERS:%=%-timestamp ) \
782
+ $(TRACE_SOURCES ) $(TRACE_SOURCES:%=%-timestamp ) \
783
+ $(TRACE_DTRACE ) $(TRACE_DTRACE:%=%-timestamp )
784
+
667
785
# Include automatically generated dependency files
668
786
# Dependencies in Makefile.objs files come from our recursive subdir rules
669
787
-include $(wildcard * .d tests/* .d)
0 commit comments