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)
18 $(obj)/generated-ust-provider.h: $(obj)/generated-ust-provider.h-timestamp
19 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
20 $(obj)/generated-ust-provider.h-timestamp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
21 $(call quiet-command,$(TRACETOOL) \
22 --format=ust-events-h \
23 --backends=$(TRACE_BACKENDS) \
24 < $< > $@," GEN $(patsubst %-timestamp,%,$@)")
26 $(obj)/generated-ust.c: $(obj)/generated-ust.c-timestamp $(BUILD_DIR)/config-host.mak
27 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
28 $(obj)/generated-ust.c-timestamp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
29 $(call quiet-command,$(TRACETOOL) \
30 --format=ust-events-c \
31 --backends=$(TRACE_BACKENDS) \
32 < $< > $@," GEN $(patsubst %-timestamp,%,$@)")
34 $(obj)/generated-events.h: $(obj)/generated-ust-provider.h
35 $(obj)/generated-events.c: $(obj)/generated-ust.c
38 ######################################################################
39 # Auto-generated event descriptions
41 $(obj)/generated-events.h: $(obj)/generated-events.h-timestamp
42 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
43 $(obj)/generated-events.h-timestamp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
44 $(call quiet-command,$(TRACETOOL) \
46 --backends=$(TRACE_BACKENDS) \
47 < $< > $@," GEN $(patsubst %-timestamp,%,$@)")
49 $(obj)/generated-events.c: $(obj)/generated-events.c-timestamp $(BUILD_DIR)/config-host.mak
50 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
51 $(obj)/generated-events.c-timestamp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
52 $(call quiet-command,$(TRACETOOL) \
54 --backends=$(TRACE_BACKENDS) \
55 < $< > $@," GEN $(patsubst %-timestamp,%,$@)")
57 util-obj-y += generated-events.o
60 ######################################################################
61 # Auto-generated tracing routines
63 ##################################################
66 $(obj)/generated-tracers.h: $(obj)/generated-tracers.h-timestamp
67 @cmp -s $< $@ || cp $< $@
68 $(obj)/generated-tracers.h-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
69 $(call quiet-command,$(TRACETOOL) \
71 --backends=$(TRACE_BACKENDS) \
72 < $< > $@," GEN $(patsubst %-timestamp,%,$@)")
74 ##############################
77 $(obj)/generated-tracers.c: $(obj)/generated-tracers.c-timestamp
78 @cmp -s $< $@ || cp $< $@
79 $(obj)/generated-tracers.c-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
80 $(call quiet-command,$(TRACETOOL) \
82 --backends=$(TRACE_BACKENDS) \
83 < $< > $@," GEN $(patsubst %-timestamp,%,$@)")
85 $(obj)/generated-tracers.o: $(obj)/generated-tracers.c $(obj)/generated-tracers.h
87 ##############################
90 # Normal practice is to name DTrace probe file with a '.d' extension
91 # but that gets picked up by QEMU's Makefile as an external dependency
92 # rule file. So we use '.dtrace' instead
93 ifeq ($(findstring dtrace,$(TRACE_BACKENDS)),dtrace)
94 $(obj)/generated-tracers-dtrace.dtrace: $(obj)/generated-tracers-dtrace.dtrace-timestamp
95 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
96 $(obj)/generated-tracers-dtrace.dtrace-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
97 $(call quiet-command,$(TRACETOOL) \
99 --backends=$(TRACE_BACKENDS) \
100 < $< > $@," GEN $(patsubst %-timestamp,%,$@)")
102 $(obj)/generated-tracers-dtrace.h: $(obj)/generated-tracers-dtrace.dtrace
103 $(call quiet-command,dtrace -o $@ -h -s $<, " GEN $@")
105 $(obj)/generated-tracers-dtrace.o: $(obj)/generated-tracers-dtrace.dtrace
107 util-obj-y += generated-tracers-dtrace.o
110 ##################################################
113 $(obj)/generated-helpers-wrappers.h: $(obj)/generated-helpers-wrappers.h-timestamp
114 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
115 $(obj)/generated-helpers-wrappers.h-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
116 $(call quiet-command,$(TRACETOOL) \
117 --format=tcg-helper-wrapper-h \
118 --backend=$(TRACE_BACKENDS) \
119 < $< > $@," GEN $(patsubst %-timestamp,%,$@)")
121 $(obj)/generated-helpers.h: $(obj)/generated-helpers.h-timestamp
122 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
123 $(obj)/generated-helpers.h-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
124 $(call quiet-command,$(TRACETOOL) \
125 --format=tcg-helper-h \
126 --backend=$(TRACE_BACKENDS) \
127 < $< > $@," GEN $(patsubst %-timestamp,%,$@)")
129 $(obj)/generated-helpers.c: $(obj)/generated-helpers.c-timestamp
130 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
131 $(obj)/generated-helpers.c-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
132 $(call quiet-command,$(TRACETOOL) \
133 --format=tcg-helper-c \
134 --backend=$(TRACE_BACKENDS) \
135 < $< > $@," GEN $(patsubst %-timestamp,%,$@)")
137 $(obj)/generated-helpers.o: $(obj)/generated-helpers.c
139 target-obj-y += generated-helpers.o
142 $(obj)/generated-tcg-tracers.h: $(obj)/generated-tcg-tracers.h-timestamp
143 @cmp $< $@ >/dev/null 2>&1 || cp $< $@
144 $(obj)/generated-tcg-tracers.h-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
145 $(call quiet-command,$(TRACETOOL) \
147 --backend=$(TRACE_BACKENDS) \
148 < $< > $@," GEN $(patsubst %-timestamp,%,$@)")
151 ######################################################################
154 util-obj-$(CONFIG_TRACE_SIMPLE) += simple.o generated-tracers.o
155 util-obj-$(CONFIG_TRACE_FTRACE) += ftrace.o
156 util-obj-$(CONFIG_TRACE_UST) += generated-ust.o
157 util-obj-y += control.o