summaryrefslogtreecommitdiff
path: root/trace/Makefile.objs
blob: 24d3b3758c44051afd78b42e075222118a33a481 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# -*- mode: makefile -*-

######################################################################
# tracetool source files
# Every rule that invokes tracetool must depend on this so code is regenerated
# if tracetool itself changes.

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

$(BUILD_DIR)/trace-events-all: $(trace-events-y:%=$(SRC_PATH)/%)
	$(call quiet-command,cat $^ > $@)

######################################################################
# Auto-generated event descriptions for LTTng ust code

ifeq ($(findstring ust,$(TRACE_BACKENDS)),ust)

$(obj)/generated-ust-provider.h: $(obj)/generated-ust-provider.h-timestamp
	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
$(obj)/generated-ust-provider.h-timestamp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
	$(call quiet-command,$(TRACETOOL) \
		--format=ust-events-h \
		--backends=$(TRACE_BACKENDS) \
		< $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")

$(obj)/generated-ust.c: $(obj)/generated-ust.c-timestamp $(BUILD_DIR)/config-host.mak
	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
$(obj)/generated-ust.c-timestamp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
	$(call quiet-command,$(TRACETOOL) \
		--format=ust-events-c \
		--backends=$(TRACE_BACKENDS) \
		< $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")

$(obj)/generated-events.h: $(obj)/generated-ust-provider.h
$(obj)/generated-events.c: $(obj)/generated-ust.c

endif

######################################################################
# Auto-generated event descriptions

$(obj)/generated-events.h: $(obj)/generated-events.h-timestamp
	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
$(obj)/generated-events.h-timestamp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
	$(call quiet-command,$(TRACETOOL) \
		--format=events-h \
		--backends=$(TRACE_BACKENDS) \
		< $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")

$(obj)/generated-events.c: $(obj)/generated-events.c-timestamp $(BUILD_DIR)/config-host.mak
	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
$(obj)/generated-events.c-timestamp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
	$(call quiet-command,$(TRACETOOL) \
		--format=events-c \
		--backends=$(TRACE_BACKENDS) \
		< $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")

util-obj-y += generated-events.o


######################################################################
# Auto-generated tracing routines

##################################################
# Execution level

$(obj)/generated-tracers.h: $(obj)/generated-tracers.h-timestamp
	@cmp -s $< $@ || cp $< $@
$(obj)/generated-tracers.h-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
	$(call quiet-command,$(TRACETOOL) \
		--format=h \
		--backends=$(TRACE_BACKENDS) \
		< $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")

##############################
# non-DTrace

$(obj)/generated-tracers.c: $(obj)/generated-tracers.c-timestamp
	@cmp -s $< $@ || cp $< $@
$(obj)/generated-tracers.c-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
	$(call quiet-command,$(TRACETOOL) \
		--format=c \
		--backends=$(TRACE_BACKENDS) \
		< $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")

$(obj)/generated-tracers.o: $(obj)/generated-tracers.c $(obj)/generated-tracers.h

##############################
# DTrace

# Normal practice is to name DTrace probe file with a '.d' extension
# but that gets picked up by QEMU's Makefile as an external dependency
# rule file. So we use '.dtrace' instead
ifeq ($(findstring dtrace,$(TRACE_BACKENDS)),dtrace)

$(obj)/generated-tracers-dtrace.dtrace: $(obj)/generated-tracers-dtrace.dtrace-timestamp
	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
$(obj)/generated-tracers-dtrace.dtrace-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
	$(call quiet-command,$(TRACETOOL) \
		--format=d \
		--backends=$(TRACE_BACKENDS) \
		< $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")

$(obj)/generated-tracers-dtrace.h: $(obj)/generated-tracers-dtrace.dtrace
	$(call quiet-command,dtrace -o $@ -h -s $<,"GEN","$@")

$(obj)/generated-tracers-dtrace.o: $(obj)/generated-tracers-dtrace.dtrace

util-obj-y += generated-tracers-dtrace.o
endif

##################################################
# Translation level

$(obj)/generated-helpers-wrappers.h: $(obj)/generated-helpers-wrappers.h-timestamp
	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
$(obj)/generated-helpers-wrappers.h-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
	$(call quiet-command,$(TRACETOOL) \
		--format=tcg-helper-wrapper-h \
		--backend=$(TRACE_BACKENDS) \
		< $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")

$(obj)/generated-helpers.h: $(obj)/generated-helpers.h-timestamp
	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
$(obj)/generated-helpers.h-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
	$(call quiet-command,$(TRACETOOL) \
		--format=tcg-helper-h \
		--backend=$(TRACE_BACKENDS) \
		< $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")

$(obj)/generated-helpers.c: $(obj)/generated-helpers.c-timestamp
	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
$(obj)/generated-helpers.c-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
	$(call quiet-command,$(TRACETOOL) \
		--format=tcg-helper-c \
		--backend=$(TRACE_BACKENDS) \
		< $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")

$(obj)/generated-helpers.o: $(obj)/generated-helpers.c

target-obj-y += generated-helpers.o


$(obj)/generated-tcg-tracers.h: $(obj)/generated-tcg-tracers.h-timestamp
	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
$(obj)/generated-tcg-tracers.h-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
	$(call quiet-command,$(TRACETOOL) \
		--format=tcg-h \
		--backend=$(TRACE_BACKENDS) \
		< $< > $@,"GEN","$(patsubst %-timestamp,%,$@)")


######################################################################
# Backend code

util-obj-$(CONFIG_TRACE_SIMPLE) += simple.o generated-tracers.o
util-obj-$(CONFIG_TRACE_FTRACE) += ftrace.o
util-obj-$(CONFIG_TRACE_UST) += generated-ust.o
util-obj-y += control.o
target-obj-y += control-target.o
util-obj-y += qmp.o