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-events.h: $(obj)/generated-ust-provider.h
36 $(obj)/generated-events.c: $(obj)/generated-ust.c
40 ######################################################################
41 # Auto-generated event descriptions
43 $(obj)/generated-events.h: $(obj)/generated-events.h-timestamp
44 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
45 $(obj)/generated-events.h-timestamp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
46 $(call quiet-command,$(TRACETOOL) \
48 --backends=$(TRACE_BACKENDS) \
49 < $< > $@," GEN $(patsubst %-timestamp,%,$@)")
51 $(obj)/generated-events.c: $(obj)/generated-events.c-timestamp $(BUILD_DIR)/config-host.mak
52 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
53 $(obj)/generated-events.c-timestamp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
54 $(call quiet-command,$(TRACETOOL) \
56 --backends=$(TRACE_BACKENDS) \
57 < $< > $@," GEN $(patsubst %-timestamp,%,$@)")
59 util-obj-y += generated-events.o
62 ######################################################################
63 # Auto-generated tracing routines
65 ##################################################
68 $(obj)/generated-tracers.h: $(obj)/generated-tracers.h-timestamp
69 @cmp -s $< $@ || cp $< $@
70 $(obj)/generated-tracers.h-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
71 $(call quiet-command,$(TRACETOOL) \
73 --backends=$(TRACE_BACKENDS) \
74 < $< > $@," GEN $(patsubst %-timestamp,%,$@)")
76 ##############################
79 $(obj)/generated-tracers.c: $(obj)/generated-tracers.c-timestamp
80 @cmp -s $< $@ || cp $< $@
81 $(obj)/generated-tracers.c-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
82 $(call quiet-command,$(TRACETOOL) \
84 --backends=$(TRACE_BACKENDS) \
85 < $< > $@," GEN $(patsubst %-timestamp,%,$@)")
87 $(obj)/generated-tracers.o: $(obj)/generated-tracers.c $(obj)/generated-tracers.h
89 ##############################
92 # Normal practice is to name DTrace probe file with a '.d' extension
93 # but that gets picked up by QEMU's Makefile as an external dependency
94 # rule file. So we use '.dtrace' instead
95 ifeq ($(findstring dtrace,$(TRACE_BACKENDS)),dtrace)
97 $(obj)/generated-tracers-dtrace.dtrace: $(obj)/generated-tracers-dtrace.dtrace-timestamp
98 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
99 $(obj)/generated-tracers-dtrace.dtrace-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
100 $(call quiet-command,$(TRACETOOL) \
102 --backends=$(TRACE_BACKENDS) \
103 < $< > $@," GEN $(patsubst %-timestamp,%,$@)")
105 $(obj)/generated-tracers-dtrace.h: $(obj)/generated-tracers-dtrace.dtrace
106 $(call quiet-command,dtrace -o $@ -h -s $<, " GEN $@")
108 $(obj)/generated-tracers-dtrace.o: $(obj)/generated-tracers-dtrace.dtrace
110 util-obj-y += generated-tracers-dtrace.o
113 ##################################################
116 $(obj)/generated-helpers-wrappers.h: $(obj)/generated-helpers-wrappers.h-timestamp
117 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
118 $(obj)/generated-helpers-wrappers.h-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
119 $(call quiet-command,$(TRACETOOL) \
120 --format=tcg-helper-wrapper-h \
121 --backend=$(TRACE_BACKENDS) \
122 < $< > $@," GEN $(patsubst %-timestamp,%,$@)")
124 $(obj)/generated-helpers.h: $(obj)/generated-helpers.h-timestamp
125 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
126 $(obj)/generated-helpers.h-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
127 $(call quiet-command,$(TRACETOOL) \
128 --format=tcg-helper-h \
129 --backend=$(TRACE_BACKENDS) \
130 < $< > $@," GEN $(patsubst %-timestamp,%,$@)")
132 $(obj)/generated-helpers.c: $(obj)/generated-helpers.c-timestamp
133 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
134 $(obj)/generated-helpers.c-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
135 $(call quiet-command,$(TRACETOOL) \
136 --format=tcg-helper-c \
137 --backend=$(TRACE_BACKENDS) \
138 < $< > $@," GEN $(patsubst %-timestamp,%,$@)")
140 $(obj)/generated-helpers.o: $(obj)/generated-helpers.c
142 target-obj-y += generated-helpers.o
145 $(obj)/generated-tcg-tracers.h: $(obj)/generated-tcg-tracers.h-timestamp
146 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
147 $(obj)/generated-tcg-tracers.h-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
148 $(call quiet-command,$(TRACETOOL) \
150 --backend=$(TRACE_BACKENDS) \
151 < $< > $@," GEN $(patsubst %-timestamp,%,$@)")
154 ######################################################################
157 util-obj-$(CONFIG_TRACE_SIMPLE) += simple.o generated-tracers.o
158 util-obj-$(CONFIG_TRACE_FTRACE) += ftrace.o
159 util-obj-$(CONFIG_TRACE_UST) += generated-ust.o
160 util-obj-y += control.o
161 target-obj-y += control-target.o