Makefile.objs 6 KB
Newer Older
1 2
# -*- mode: makefile -*-

3 4 5 6 7 8 9 10
######################################################################
# 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")

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

14 15 16
######################################################################
# 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 22
	$(call quiet-command,$(TRACETOOL) \
		--format=ust-events-h \
23
		--backends=$(TRACE_BACKENDS) \
24 25 26
		< $< > $@,"  GEN   $(patsubst %-timestamp,%,$@)")

$(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 30
	$(call quiet-command,$(TRACETOOL) \
		--format=ust-events-c \
31
		--backends=$(TRACE_BACKENDS) \
32 33 34 35 36 37
		< $< > $@,"  GEN   $(patsubst %-timestamp,%,$@)")

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

38
######################################################################
39 40 41
# Auto-generated event descriptions

$(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 45
	$(call quiet-command,$(TRACETOOL) \
		--format=events-h \
46
		--backends=$(TRACE_BACKENDS) \
47 48
		< $< > $@,"  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 53
	$(call quiet-command,$(TRACETOOL) \
		--format=events-c \
54
		--backends=$(TRACE_BACKENDS) \
55 56 57 58 59 60 61
		< $< > $@,"  GEN   $(patsubst %-timestamp,%,$@)")

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


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

63 64 65
##################################################
# Execution level

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 70
	$(call quiet-command,$(TRACETOOL) \
		--format=h \
71
		--backends=$(TRACE_BACKENDS) \
72 73
		< $< > $@,"  GEN   $(patsubst %-timestamp,%,$@)")

74 75
##############################
# non-DTrace
76

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 81
	$(call quiet-command,$(TRACETOOL) \
		--format=c \
82
		--backends=$(TRACE_BACKENDS) \
83 84 85 86
		< $< > $@,"  GEN   $(patsubst %-timestamp,%,$@)")

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

87 88
##############################
# DTrace
89 90 91 92

# 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
93 94
ifeq ($(findstring dtrace,$(TRACE_BACKENDS)),dtrace)
$(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 98
	$(call quiet-command,$(TRACETOOL) \
		--format=d \
99
		--backends=$(TRACE_BACKENDS) \
100 101
		< $< > $@,"  GEN   $(patsubst %-timestamp,%,$@)")

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

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

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

110 111 112
##################################################
# Translation level

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 117 118 119 120
	$(call quiet-command,$(TRACETOOL) \
		--format=tcg-helper-wrapper-h \
		--backend=$(TRACE_BACKENDS) \
		< $< > $@,"  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 125 126 127 128
	$(call quiet-command,$(TRACETOOL) \
		--format=tcg-helper-h \
		--backend=$(TRACE_BACKENDS) \
		< $< > $@,"  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 133 134 135 136 137 138 139 140
	$(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

141

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 146 147 148 149 150
	$(call quiet-command,$(TRACETOOL) \
		--format=tcg-h \
		--backend=$(TRACE_BACKENDS) \
		< $< > $@,"  GEN   $(patsubst %-timestamp,%,$@)")


151 152 153
######################################################################
# Backend code

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
158
util-obj-y += qmp.o