]>
Commit | Line | Data |
---|---|---|
562593aa AL |
1 | # -*- Mode: makefile -*- |
2 | ||
6b4ad3b2 PC |
3 | BUILD_DIR?=$(CURDIR)/.. |
4 | ||
deed3ccf | 5 | include ../config-host.mak |
25be210f | 6 | include config-target.mak |
17759187 | 7 | include $(SRC_PATH)/rules.mak |
626df76a | 8 | |
e0e312f3 PB |
9 | ifdef CONFIG_SOFTMMU |
10 | include config-devices.mak | |
11 | endif | |
12 | ||
12a1ddc1 | 13 | $(call set-vpath, $(SRC_PATH):$(BUILD_DIR)) |
af2be207 | 14 | ifdef CONFIG_LINUX |
67cf3f5c | 15 | QEMU_CFLAGS += -isystem ../linux-headers |
af2be207 | 16 | endif |
9edc19c9 | 17 | QEMU_CFLAGS += -iquote .. -iquote $(SRC_PATH)/target/$(TARGET_BASE_ARCH) -DNEED_CPU_H |
40293e58 | 18 | |
9edc19c9 | 19 | QEMU_CFLAGS+=-iquote $(SRC_PATH)/include |
2f28d2ff | 20 | |
40293e58 FB |
21 | ifdef CONFIG_USER_ONLY |
22 | # user emulator name | |
c1799a84 | 23 | QEMU_PROG=qemu-$(TARGET_NAME) |
5c40c739 | 24 | QEMU_PROG_BUILD = $(QEMU_PROG) |
40293e58 | 25 | else |
1e43adfc | 26 | # system emulator name |
5c40c739 | 27 | QEMU_PROG=qemu-system-$(TARGET_NAME)$(EXESUF) |
2fe47fce | 28 | ifneq (,$(findstring -mwindows,$(SDL_LIBS))) |
0fa5491e | 29 | # Terminate program name with a 'w' because the linker builds a windows executable. |
c1799a84 | 30 | QEMU_PROGW=qemu-system-$(TARGET_NAME)w$(EXESUF) |
5c40c739 | 31 | $(QEMU_PROG): $(QEMU_PROGW) |
0bdb12c7 | 32 | $(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG),"GEN","$(TARGET_DIR)$(QEMU_PROG)") |
5c40c739 MT |
33 | QEMU_PROG_BUILD = $(QEMU_PROGW) |
34 | else | |
35 | QEMU_PROG_BUILD = $(QEMU_PROG) | |
a541f297 | 36 | endif |
0fa5491e | 37 | endif |
5c40c739 MT |
38 | |
39 | PROGS=$(QEMU_PROG) $(QEMU_PROGW) | |
b8841706 | 40 | STPFILES= |
626df76a | 41 | |
91880d96 JQ |
42 | config-target.h: config-target.h-timestamp |
43 | config-target.h-timestamp: config-target.mak | |
44 | ||
6c22ea9d JM |
45 | config-devices.h: config-devices.h-timestamp |
46 | config-devices.h-timestamp: config-devices.mak | |
47 | ||
6d8a764e | 48 | ifdef CONFIG_TRACE_SYSTEMTAP |
62dd1048 | 49 | stap: $(QEMU_PROG).stp-installed $(QEMU_PROG).stp $(QEMU_PROG)-simpletrace.stp $(QEMU_PROG)-log.stp |
c276b17d DB |
50 | |
51 | ifdef CONFIG_USER_ONLY | |
52 | TARGET_TYPE=user | |
53 | else | |
54 | TARGET_TYPE=system | |
55 | endif | |
56 | ||
ed865058 DB |
57 | tracetool-y = $(SRC_PATH)/scripts/tracetool.py |
58 | tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py") | |
59 | ||
60 | $(QEMU_PROG).stp-installed: $(BUILD_DIR)/trace-events-all $(tracetool-y) | |
c0424934 | 61 | $(call quiet-command,$(TRACETOOL) \ |
2098c56a | 62 | --group=all \ |
650ab98d | 63 | --format=stap \ |
5b808275 | 64 | --backends=$(TRACE_BACKENDS) \ |
650ab98d | 65 | --binary=$(bindir)/$(QEMU_PROG) \ |
b9a7b74f | 66 | --target-name=$(TARGET_NAME) \ |
650ab98d | 67 | --target-type=$(TARGET_TYPE) \ |
0bc6484d | 68 | $< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG).stp-installed") |
c14518e9 | 69 | |
ed865058 | 70 | $(QEMU_PROG).stp: $(BUILD_DIR)/trace-events-all $(tracetool-y) |
c14518e9 | 71 | $(call quiet-command,$(TRACETOOL) \ |
2098c56a | 72 | --group=all \ |
c14518e9 | 73 | --format=stap \ |
5b808275 | 74 | --backends=$(TRACE_BACKENDS) \ |
c14518e9 | 75 | --binary=$(realpath .)/$(QEMU_PROG) \ |
b9a7b74f | 76 | --target-name=$(TARGET_NAME) \ |
c14518e9 | 77 | --target-type=$(TARGET_TYPE) \ |
0bc6484d | 78 | $< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG).stp") |
c14518e9 | 79 | |
ed865058 | 80 | $(QEMU_PROG)-simpletrace.stp: $(BUILD_DIR)/trace-events-all $(tracetool-y) |
e0b2fd0e | 81 | $(call quiet-command,$(TRACETOOL) \ |
2098c56a | 82 | --group=all \ |
e0b2fd0e SH |
83 | --format=simpletrace-stap \ |
84 | --backends=$(TRACE_BACKENDS) \ | |
85 | --probe-prefix=qemu.$(TARGET_TYPE).$(TARGET_NAME) \ | |
0bc6484d | 86 | $< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG)-simpletrace.stp") |
e0b2fd0e | 87 | |
62dd1048 DB |
88 | $(QEMU_PROG)-log.stp: $(BUILD_DIR)/trace-events-all $(tracetool-y) |
89 | $(call quiet-command,$(TRACETOOL) \ | |
90 | --group=all \ | |
91 | --format=log-stap \ | |
92 | --backends=$(TRACE_BACKENDS) \ | |
93 | --probe-prefix=qemu.$(TARGET_TYPE).$(TARGET_NAME) \ | |
94 | $< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG)-log.stp") | |
95 | ||
c276b17d DB |
96 | else |
97 | stap: | |
98 | endif | |
a273f4ce | 99 | .PHONY: stap |
c276b17d DB |
100 | |
101 | all: $(PROGS) stap | |
91880d96 | 102 | |
c2fb2637 PB |
103 | # Dummy command so that make thinks it has done something |
104 | @true | |
626df76a | 105 | |
310b3fe9 PB |
106 | obj-y += trace/ |
107 | ||
40293e58 | 108 | ######################################################### |
626df76a | 109 | # cpu emulator library |
7886cefe | 110 | obj-y += exec.o exec-vary.o |
d9bb58e5 | 111 | obj-y += accel/ |
db432672 | 112 | obj-$(CONFIG_TCG) += tcg/tcg.o tcg/tcg-op.o tcg/tcg-op-vec.o tcg/tcg-op-gvec.o |
d2fd745f | 113 | obj-$(CONFIG_TCG) += tcg/tcg-common.o tcg/optimize.o |
8dfaf23a | 114 | obj-$(CONFIG_TCG_INTERPRETER) += tcg/tci.o |
50348333 | 115 | obj-$(CONFIG_TCG_INTERPRETER) += disas/tci.o |
8f971cf0 | 116 | obj-$(CONFIG_TCG) += fpu/softfloat.o |
fcf5ef2a | 117 | obj-y += target/$(TARGET_BASE_ARCH)/ |
76cad711 | 118 | obj-y += disas.o |
b77abd95 | 119 | obj-$(call notempty,$(TARGET_XML_FILES)) += gdbstub-xml.o |
02f9135b | 120 | LIBS := $(libs_cpu) $(LIBS) |
5e8861a0 | 121 | |
54cb65d8 EC |
122 | obj-$(CONFIG_PLUGIN) += plugins/ |
123 | ||
40293e58 FB |
124 | ######################################################### |
125 | # Linux user emulator target | |
126 | ||
127 | ifdef CONFIG_LINUX_USER | |
128 | ||
4d330cee | 129 | QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) \ |
ba453780 | 130 | -I$(SRC_PATH)/linux-user/host/$(ARCH) \ |
4d330cee | 131 | -I$(SRC_PATH)/linux-user |
1c872672 | 132 | |
7fc5152c | 133 | obj-y += linux-user/ |
58410666 | 134 | obj-y += gdbstub.o thunk.o |
40293e58 | 135 | |
40293e58 FB |
136 | endif #CONFIG_LINUX_USER |
137 | ||
84778508 BS |
138 | ######################################################### |
139 | # BSD user emulator target | |
140 | ||
141 | ifdef CONFIG_BSD_USER | |
142 | ||
adfc3e91 SS |
143 | QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR) \ |
144 | -I$(SRC_PATH)/bsd-user/$(HOST_VARIANT_DIR) | |
84778508 | 145 | |
7fc5152c | 146 | obj-y += bsd-user/ |
58410666 | 147 | obj-y += gdbstub.o |
84778508 | 148 | |
84778508 BS |
149 | endif #CONFIG_BSD_USER |
150 | ||
40293e58 FB |
151 | ######################################################### |
152 | # System emulator target | |
76dfdd24 | 153 | ifdef CONFIG_SOFTMMU |
ac057879 | 154 | obj-y += arch_init.o cpus.o gdbstub.o balloon.o ioport.o |
5ddc6482 | 155 | obj-y += qtest.o |
c2a87148 | 156 | obj-y += dump/ |
c353f261 | 157 | obj-y += hw/ |
e84328fa | 158 | obj-y += monitor/ |
88554a20 | 159 | obj-y += qapi/ |
d9bb58e5 | 160 | obj-y += memory.o |
c22d8e04 | 161 | obj-y += memory_mapping.o |
46d702b1 | 162 | obj-y += migration/ram.o |
bac068e0 | 163 | obj-y += softmmu/ |
7398dfc7 | 164 | LIBS := $(libs_softmmu) $(LIBS) |
4fb240a4 | 165 | |
a541f297 | 166 | # Hardware support |
b9a7b74f | 167 | ifeq ($(TARGET_NAME), sparc64) |
5e8861a0 | 168 | obj-y += hw/sparc64/ |
3475187d | 169 | else |
5e8861a0 | 170 | obj-y += hw/$(TARGET_BASE_ARCH)/ |
9637443f JQ |
171 | endif |
172 | ||
3dff199c | 173 | generated-files-y += hmp-commands.h hmp-commands-info.h |
6c22ea9d | 174 | generated-files-y += config-devices.h |
0e8c9214 | 175 | |
76dfdd24 | 176 | endif # CONFIG_SOFTMMU |
00a67ba1 | 177 | |
ba1183da | 178 | dummy := $(call unnest-vars,,obj-y) |
d608cc5c | 179 | all-obj-y := $(obj-y) |
ba1183da | 180 | |
99100dc3 | 181 | include $(SRC_PATH)/Makefile.objs |
cc475698 | 182 | dummy := $(call unnest-vars,.., \ |
5b76dd13 | 183 | authz-obj-y \ |
cc475698 FZ |
184 | block-obj-y \ |
185 | block-obj-m \ | |
32d955a4 | 186 | chardev-obj-y \ |
fb37726d | 187 | crypto-obj-y \ |
0c7012e0 | 188 | qom-obj-y \ |
666a3af9 | 189 | io-obj-y \ |
cc475698 | 190 | common-obj-y \ |
675b9b53 | 191 | common-obj-m) |
d608cc5c | 192 | all-obj-y += $(common-obj-y) |
0c7012e0 | 193 | all-obj-y += $(qom-obj-y) |
5b76dd13 | 194 | all-obj-$(CONFIG_SOFTMMU) += $(authz-obj-y) |
32d955a4 | 195 | all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y) $(chardev-obj-y) |
fb37726d | 196 | all-obj-$(CONFIG_SOFTMMU) += $(crypto-obj-y) |
666a3af9 | 197 | all-obj-$(CONFIG_SOFTMMU) += $(io-obj-y) |
7fc5152c | 198 | |
e0e312f3 | 199 | ifdef CONFIG_SOFTMMU |
a9ad5e1e | 200 | $(QEMU_PROG_BUILD): config-devices.mak |
e0e312f3 | 201 | endif |
a9ad5e1e | 202 | |
ebedb37c | 203 | COMMON_LDADDS = ../libqemuutil.a |
0ab8ed18 | 204 | |
5c40c739 | 205 | # build either PROG or PROGW |
7b733862 | 206 | $(QEMU_PROG_BUILD): $(all-obj-y) $(COMMON_LDADDS) $(softmmu-main-y) |
a9ad5e1e | 207 | $(call LINK, $(filter-out %.mak, $^)) |
4e34017c | 208 | ifdef CONFIG_DARWIN |
0bdb12c7 PM |
209 | $(call quiet-command,Rez -append $(SRC_PATH)/pc-bios/qemu.rsrc -o $@,"REZ","$(TARGET_DIR)$@") |
210 | $(call quiet-command,SetFile -a C $@,"SETFILE","$(TARGET_DIR)$@") | |
4e34017c | 211 | endif |
16394485 | 212 | |
4c3b5a48 | 213 | gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh |
0bdb12c7 | 214 | $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES),"GEN","$(TARGET_DIR)$@") |
56aebc89 | 215 | |
077de81a | 216 | hmp-commands.h: $(SRC_PATH)/hmp-commands.hx $(SRC_PATH)/scripts/hxtool |
0bdb12c7 | 217 | $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$(TARGET_DIR)$@") |
2313086a | 218 | |
077de81a | 219 | hmp-commands-info.h: $(SRC_PATH)/hmp-commands-info.hx $(SRC_PATH)/scripts/hxtool |
0bdb12c7 | 220 | $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$(TARGET_DIR)$@") |
da76ee76 | 221 | |
dced7eec | 222 | clean: clean-target |
b54fa7dd PM |
223 | rm -f *.a *~ $(PROGS) |
224 | rm -f $(shell find . -name '*.[od]') | |
84289499 | 225 | rm -f hmp-commands.h gdbstub-xml.c |
74970d35 | 226 | rm -f trace/generated-helpers.c trace/generated-helpers.c-timestamp |
6d8a764e | 227 | ifdef CONFIG_TRACE_SYSTEMTAP |
c276b17d DB |
228 | rm -f *.stp |
229 | endif | |
1e43adfc | 230 | |
c621dc3e AB |
231 | ifdef CONFIG_FUZZ |
232 | include $(SRC_PATH)/tests/qtest/fuzz/Makefile.include | |
233 | include $(SRC_PATH)/tests/qtest/Makefile.include | |
234 | ||
235 | fuzz: fuzz-vars | |
236 | fuzz-vars: QEMU_CFLAGS := $(FUZZ_CFLAGS) $(QEMU_CFLAGS) | |
237 | fuzz-vars: QEMU_LDFLAGS := $(FUZZ_LDFLAGS) $(QEMU_LDFLAGS) | |
238 | fuzz-vars: $(QEMU_PROG_FUZZ) | |
239 | dummy := $(call unnest-vars,, fuzz-obj-y) | |
240 | ||
241 | ||
242 | $(QEMU_PROG_FUZZ): config-devices.mak $(all-obj-y) $(COMMON_LDADDS) $(fuzz-obj-y) | |
243 | $(call LINK, $(filter-out %.mak, $^)) | |
244 | ||
245 | endif | |
246 | ||
5fafdf24 | 247 | install: all |
9b14bb04 | 248 | ifneq ($(PROGS),) |
0d659426 | 249 | $(call install-prog,$(PROGS),$(DESTDIR)$(bindir)) |
9b14bb04 | 250 | endif |
6d8a764e | 251 | ifdef CONFIG_TRACE_SYSTEMTAP |
6aae2a2e | 252 | $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset" |
c14518e9 | 253 | $(INSTALL_DATA) $(QEMU_PROG).stp-installed "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG).stp" |
e0b2fd0e | 254 | $(INSTALL_DATA) $(QEMU_PROG)-simpletrace.stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG)-simpletrace.stp" |
62dd1048 | 255 | $(INSTALL_DATA) $(QEMU_PROG)-log.stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG)-log.stp" |
c276b17d | 256 | endif |
626df76a | 257 | |
3dff199c LV |
258 | generated-files-y += config-target.h |
259 | Makefile: $(generated-files-y) | |
90e671a9 AB |
260 | |
261 | # Reports/Analysis | |
262 | # | |
263 | # The target specific coverage report only cares about target specific | |
264 | # blobs and not the shared code. | |
265 | # | |
266 | ||
267 | %/coverage-report.html: | |
268 | @mkdir -p $* | |
269 | $(call quiet-command,\ | |
270 | gcovr -r $(SRC_PATH) --object-directory $(CURDIR) \ | |
271 | -p --html --html-details -o $@, \ | |
272 | "GEN", "coverage-report.html") | |
273 | ||
274 | .PHONY: coverage-report | |
275 | coverage-report: $(CURDIR)/reports/coverage/coverage-report.html |