aboutsummaryrefslogtreecommitdiff
path: root/Makefile.target
blob: 8ee4c78b3f3446550c7c8567fd5b88b4b30a6aa3 (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
# -*- Mode: makefile -*-

BUILD_DIR?=$(CURDIR)/..

include ../config-host.mak
include config-target.mak
include $(SRC_PATH)/rules.mak

$(call set-vpath, $(SRC_PATH):$(BUILD_DIR))

ifdef CONFIG_USER_ONLY
# user emulator name
QEMU_PROG=qemu-$(TARGET_NAME)
else
# system emulator name
QEMU_PROG=qemu-system-$(TARGET_NAME)$(EXESUF)
endif

STPFILES=

ifdef CONFIG_TRACE_SYSTEMTAP
stap: $(QEMU_PROG).stp-installed $(QEMU_PROG).stp $(QEMU_PROG)-simpletrace.stp $(QEMU_PROG)-log.stp

ifdef CONFIG_USER_ONLY
TARGET_TYPE=user
else
TARGET_TYPE=system
endif

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

$(QEMU_PROG).stp-installed: $(BUILD_DIR)/trace/trace-events-all $(tracetool-y)
	$(call quiet-command,$(TRACETOOL) \
		--group=all \
		--format=stap \
		--backends=$(TRACE_BACKENDS) \
		--binary=$(bindir)/$(QEMU_PROG) \
		--target-name=$(TARGET_NAME) \
		--target-type=$(TARGET_TYPE) \
		$< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG).stp-installed")

$(QEMU_PROG).stp: $(BUILD_DIR)/trace/trace-events-all $(tracetool-y)
	$(call quiet-command,$(TRACETOOL) \
		--group=all \
		--format=stap \
		--backends=$(TRACE_BACKENDS) \
		--binary=$(realpath .)/$(QEMU_PROG) \
		--target-name=$(TARGET_NAME) \
		--target-type=$(TARGET_TYPE) \
		$< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG).stp")

$(QEMU_PROG)-simpletrace.stp: $(BUILD_DIR)/trace/trace-events-all $(tracetool-y)
	$(call quiet-command,$(TRACETOOL) \
		--group=all \
		--format=simpletrace-stap \
		--backends=$(TRACE_BACKENDS) \
		--probe-prefix=qemu.$(TARGET_TYPE).$(TARGET_NAME) \
		$< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG)-simpletrace.stp")

$(QEMU_PROG)-log.stp: $(BUILD_DIR)/trace/trace-events-all $(tracetool-y)
	$(call quiet-command,$(TRACETOOL) \
		--group=all \
		--format=log-stap \
		--backends=$(TRACE_BACKENDS) \
		--probe-prefix=qemu.$(TARGET_TYPE).$(TARGET_NAME) \
		$< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG)-log.stp")

else
stap:
endif
.PHONY: stap

all: stap

clean:
	rm -f *.a *~
	rm -f $(shell find . -name '*.[od]')
	rm -f hmp-commands.h gdbstub-xml.c
	rm -f trace/generated-helpers.c trace/generated-helpers.c-timestamp
ifdef CONFIG_TRACE_SYSTEMTAP
	rm -f *.stp
endif

install: all
ifdef CONFIG_TRACE_SYSTEMTAP
	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
	$(INSTALL_DATA) $(QEMU_PROG).stp-installed "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG).stp"
	$(INSTALL_DATA) $(QEMU_PROG)-simpletrace.stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG)-simpletrace.stp"
	$(INSTALL_DATA) $(QEMU_PROG)-log.stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG)-log.stp"
endif

.PHONY: all clean install