Merge remote-tracking branch 'remotes/fam/tags/for-upstream' into staging
[qemu.git] / trace / Makefile.objs
blob1e1ce7479d08cea041440629f32a3f8e5473ec2b
1 # -*- mode: makefile -*-
3 ######################################################################
4 # tracetool source files
5 # Every rule that invokes tracetool must depend on this so code is regenerated
6 # if tracetool itself changes.
8 tracetool-y = $(SRC_PATH)/scripts/tracetool.py
9 tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py")
11 $(BUILD_DIR)/trace-events-all: $(trace-events-y:%=$(SRC_PATH)/%)
12         $(call quiet-command,cat $^ > $@)
14 ######################################################################
15 # Auto-generated event descriptions for LTTng ust code
17 ifeq ($(findstring ust,$(TRACE_BACKENDS)),ust)
19 $(obj)/generated-ust-provider.h: $(obj)/generated-ust-provider.h-timestamp
20         @cmp $< $@ >/dev/null 2>&1 || cp $< $@
21 $(obj)/generated-ust-provider.h-timestamp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
22         $(call quiet-command,$(TRACETOOL) \
23                 --format=ust-events-h \
24                 --backends=$(TRACE_BACKENDS) \
25                 $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
27 $(obj)/generated-ust.c: $(obj)/generated-ust.c-timestamp $(BUILD_DIR)/config-host.mak
28         @cmp $< $@ >/dev/null 2>&1 || cp $< $@
29 $(obj)/generated-ust.c-timestamp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
30         $(call quiet-command,$(TRACETOOL) \
31                 --format=ust-events-c \
32                 --backends=$(TRACE_BACKENDS) \
33                 $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
35 $(obj)/generated-tracers.h: $(obj)/generated-ust-provider.h
36 $(obj)/generated-tracers.c: $(obj)/generated-ust.c
38 endif
41 ######################################################################
42 # Auto-generated tracing routines
44 ##################################################
45 # Execution level
47 $(obj)/generated-tracers.h: $(obj)/generated-tracers.h-timestamp
48         @cmp -s $< $@ || cp $< $@
49 $(obj)/generated-tracers.h-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
50         $(call quiet-command,$(TRACETOOL) \
51                 --format=h \
52                 --backends=$(TRACE_BACKENDS) \
53                 $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
55 ##############################
56 # non-DTrace
58 $(obj)/generated-tracers.c: $(obj)/generated-tracers.c-timestamp
59         @cmp -s $< $@ || cp $< $@
60 $(obj)/generated-tracers.c-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
61         $(call quiet-command,$(TRACETOOL) \
62                 --format=c \
63                 --backends=$(TRACE_BACKENDS) \
64                 $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
66 $(obj)/generated-tracers.o: $(obj)/generated-tracers.c $(obj)/generated-tracers.h
68 ##############################
69 # DTrace
71 # Normal practice is to name DTrace probe file with a '.d' extension
72 # but that gets picked up by QEMU's Makefile as an external dependency
73 # rule file. So we use '.dtrace' instead
74 ifeq ($(findstring dtrace,$(TRACE_BACKENDS)),dtrace)
76 $(obj)/generated-tracers-dtrace.dtrace: $(obj)/generated-tracers-dtrace.dtrace-timestamp
77         @cmp $< $@ >/dev/null 2>&1 || cp $< $@
78 $(obj)/generated-tracers-dtrace.dtrace-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
79         $(call quiet-command,$(TRACETOOL) \
80                 --format=d \
81                 --backends=$(TRACE_BACKENDS) \
82                 $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
84 $(obj)/generated-tracers-dtrace.h: $(obj)/generated-tracers-dtrace.dtrace
85         $(call quiet-command,dtrace -o $@ -h -s $<,"GEN","$@")
87 $(obj)/generated-tracers-dtrace.o: $(obj)/generated-tracers-dtrace.dtrace
89 util-obj-y += generated-tracers-dtrace.o
90 endif
92 ##################################################
93 # Translation level
95 $(obj)/generated-helpers-wrappers.h: $(obj)/generated-helpers-wrappers.h-timestamp
96         @cmp $< $@ >/dev/null 2>&1 || cp $< $@
97 $(obj)/generated-helpers-wrappers.h-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
98         $(call quiet-command,$(TRACETOOL) \
99                 --format=tcg-helper-wrapper-h \
100                 --backend=$(TRACE_BACKENDS) \
101                 $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
103 $(obj)/generated-helpers.h: $(obj)/generated-helpers.h-timestamp
104         @cmp $< $@ >/dev/null 2>&1 || cp $< $@
105 $(obj)/generated-helpers.h-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
106         $(call quiet-command,$(TRACETOOL) \
107                 --format=tcg-helper-h \
108                 --backend=$(TRACE_BACKENDS) \
109                 $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
111 $(obj)/generated-helpers.c: $(obj)/generated-helpers.c-timestamp
112         @cmp $< $@ >/dev/null 2>&1 || cp $< $@
113 $(obj)/generated-helpers.c-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
114         $(call quiet-command,$(TRACETOOL) \
115                 --format=tcg-helper-c \
116                 --backend=$(TRACE_BACKENDS) \
117                 $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
119 $(obj)/generated-helpers.o: $(obj)/generated-helpers.c
121 target-obj-y += generated-helpers.o
124 $(obj)/generated-tcg-tracers.h: $(obj)/generated-tcg-tracers.h-timestamp
125         @cmp $< $@ >/dev/null 2>&1 || cp $< $@
126 $(obj)/generated-tcg-tracers.h-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
127         $(call quiet-command,$(TRACETOOL) \
128                 --format=tcg-h \
129                 --backend=$(TRACE_BACKENDS) \
130                 $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")
133 ######################################################################
134 # Backend code
136 util-obj-y += generated-tracers.o
137 util-obj-$(CONFIG_TRACE_SIMPLE) += simple.o
138 util-obj-$(CONFIG_TRACE_FTRACE) += ftrace.o
139 util-obj-$(CONFIG_TRACE_UST) += generated-ust.o
140 util-obj-y += control.o
141 target-obj-y += control-target.o
142 util-obj-y += qmp.o