]>
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 |
f3aa844b | 7 | include config-devices.mak |
17759187 | 8 | include $(SRC_PATH)/rules.mak |
626df76a | 9 | |
12a1ddc1 | 10 | $(call set-vpath, $(SRC_PATH):$(BUILD_DIR)) |
af2be207 JK |
11 | ifdef CONFIG_LINUX |
12 | QEMU_CFLAGS += -I../linux-headers | |
13 | endif | |
9edc19c9 | 14 | QEMU_CFLAGS += -iquote .. -iquote $(SRC_PATH)/target/$(TARGET_BASE_ARCH) -DNEED_CPU_H |
40293e58 | 15 | |
9edc19c9 | 16 | QEMU_CFLAGS+=-iquote $(SRC_PATH)/include |
2f28d2ff | 17 | |
40293e58 FB |
18 | ifdef CONFIG_USER_ONLY |
19 | # user emulator name | |
c1799a84 | 20 | QEMU_PROG=qemu-$(TARGET_NAME) |
5c40c739 | 21 | QEMU_PROG_BUILD = $(QEMU_PROG) |
40293e58 | 22 | else |
1e43adfc | 23 | # system emulator name |
5c40c739 | 24 | QEMU_PROG=qemu-system-$(TARGET_NAME)$(EXESUF) |
2fe47fce | 25 | ifneq (,$(findstring -mwindows,$(SDL_LIBS))) |
0fa5491e | 26 | # Terminate program name with a 'w' because the linker builds a windows executable. |
c1799a84 | 27 | QEMU_PROGW=qemu-system-$(TARGET_NAME)w$(EXESUF) |
5c40c739 | 28 | $(QEMU_PROG): $(QEMU_PROGW) |
0bdb12c7 | 29 | $(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG),"GEN","$(TARGET_DIR)$(QEMU_PROG)") |
5c40c739 MT |
30 | QEMU_PROG_BUILD = $(QEMU_PROGW) |
31 | else | |
32 | QEMU_PROG_BUILD = $(QEMU_PROG) | |
a541f297 | 33 | endif |
0fa5491e | 34 | endif |
5c40c739 MT |
35 | |
36 | PROGS=$(QEMU_PROG) $(QEMU_PROGW) | |
b8841706 | 37 | STPFILES= |
626df76a | 38 | |
c722a9e4 AB |
39 | # Makefile Tests |
40 | ifdef CONFIG_USER_ONLY | |
41 | include $(SRC_PATH)/tests/tcg/Makefile.include | |
42 | endif | |
43 | ||
91880d96 JQ |
44 | config-target.h: config-target.h-timestamp |
45 | config-target.h-timestamp: config-target.mak | |
46 | ||
6d8a764e | 47 | ifdef CONFIG_TRACE_SYSTEMTAP |
62dd1048 | 48 | stap: $(QEMU_PROG).stp-installed $(QEMU_PROG).stp $(QEMU_PROG)-simpletrace.stp $(QEMU_PROG)-log.stp |
c276b17d DB |
49 | |
50 | ifdef CONFIG_USER_ONLY | |
51 | TARGET_TYPE=user | |
52 | else | |
53 | TARGET_TYPE=system | |
54 | endif | |
55 | ||
ed865058 DB |
56 | tracetool-y = $(SRC_PATH)/scripts/tracetool.py |
57 | tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py") | |
58 | ||
59 | $(QEMU_PROG).stp-installed: $(BUILD_DIR)/trace-events-all $(tracetool-y) | |
c0424934 | 60 | $(call quiet-command,$(TRACETOOL) \ |
2098c56a | 61 | --group=all \ |
650ab98d | 62 | --format=stap \ |
5b808275 | 63 | --backends=$(TRACE_BACKENDS) \ |
650ab98d | 64 | --binary=$(bindir)/$(QEMU_PROG) \ |
b9a7b74f | 65 | --target-name=$(TARGET_NAME) \ |
650ab98d | 66 | --target-type=$(TARGET_TYPE) \ |
0bc6484d | 67 | $< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG).stp-installed") |
c14518e9 | 68 | |
ed865058 | 69 | $(QEMU_PROG).stp: $(BUILD_DIR)/trace-events-all $(tracetool-y) |
c14518e9 | 70 | $(call quiet-command,$(TRACETOOL) \ |
2098c56a | 71 | --group=all \ |
c14518e9 | 72 | --format=stap \ |
5b808275 | 73 | --backends=$(TRACE_BACKENDS) \ |
c14518e9 | 74 | --binary=$(realpath .)/$(QEMU_PROG) \ |
b9a7b74f | 75 | --target-name=$(TARGET_NAME) \ |
c14518e9 | 76 | --target-type=$(TARGET_TYPE) \ |
0bc6484d | 77 | $< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG).stp") |
c14518e9 | 78 | |
ed865058 | 79 | $(QEMU_PROG)-simpletrace.stp: $(BUILD_DIR)/trace-events-all $(tracetool-y) |
e0b2fd0e | 80 | $(call quiet-command,$(TRACETOOL) \ |
2098c56a | 81 | --group=all \ |
e0b2fd0e SH |
82 | --format=simpletrace-stap \ |
83 | --backends=$(TRACE_BACKENDS) \ | |
84 | --probe-prefix=qemu.$(TARGET_TYPE).$(TARGET_NAME) \ | |
0bc6484d | 85 | $< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG)-simpletrace.stp") |
e0b2fd0e | 86 | |
62dd1048 DB |
87 | $(QEMU_PROG)-log.stp: $(BUILD_DIR)/trace-events-all $(tracetool-y) |
88 | $(call quiet-command,$(TRACETOOL) \ | |
89 | --group=all \ | |
90 | --format=log-stap \ | |
91 | --backends=$(TRACE_BACKENDS) \ | |
92 | --probe-prefix=qemu.$(TARGET_TYPE).$(TARGET_NAME) \ | |
93 | $< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG)-log.stp") | |
94 | ||
c276b17d DB |
95 | else |
96 | stap: | |
97 | endif | |
a273f4ce | 98 | .PHONY: stap |
c276b17d DB |
99 | |
100 | all: $(PROGS) stap | |
91880d96 | 101 | |
c2fb2637 PB |
102 | # Dummy command so that make thinks it has done something |
103 | @true | |
626df76a | 104 | |
40293e58 | 105 | ######################################################### |
626df76a | 106 | # cpu emulator library |
92229a57 | 107 | obj-y += exec.o |
d9bb58e5 | 108 | obj-y += accel/ |
db432672 | 109 | obj-$(CONFIG_TCG) += tcg/tcg.o tcg/tcg-op.o tcg/tcg-op-vec.o tcg/tcg-op-gvec.o |
d2fd745f | 110 | obj-$(CONFIG_TCG) += tcg/tcg-common.o tcg/optimize.o |
8dfaf23a | 111 | obj-$(CONFIG_TCG_INTERPRETER) += tcg/tci.o |
50348333 | 112 | obj-$(CONFIG_TCG_INTERPRETER) += disas/tci.o |
8f971cf0 | 113 | obj-$(CONFIG_TCG) += fpu/softfloat.o |
fcf5ef2a | 114 | obj-y += target/$(TARGET_BASE_ARCH)/ |
76cad711 | 115 | obj-y += disas.o |
b77abd95 | 116 | obj-$(call notempty,$(TARGET_XML_FILES)) += gdbstub-xml.o |
5e8861a0 | 117 | |
40293e58 FB |
118 | ######################################################### |
119 | # Linux user emulator target | |
120 | ||
121 | ifdef CONFIG_LINUX_USER | |
122 | ||
4d330cee | 123 | QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) \ |
ba453780 | 124 | -I$(SRC_PATH)/linux-user/host/$(ARCH) \ |
4d330cee | 125 | -I$(SRC_PATH)/linux-user |
1c872672 | 126 | |
7fc5152c | 127 | obj-y += linux-user/ |
58410666 | 128 | obj-y += gdbstub.o thunk.o |
40293e58 | 129 | |
40293e58 FB |
130 | endif #CONFIG_LINUX_USER |
131 | ||
84778508 BS |
132 | ######################################################### |
133 | # BSD user emulator target | |
134 | ||
135 | ifdef CONFIG_BSD_USER | |
136 | ||
adfc3e91 SS |
137 | QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR) \ |
138 | -I$(SRC_PATH)/bsd-user/$(HOST_VARIANT_DIR) | |
84778508 | 139 | |
7fc5152c | 140 | obj-y += bsd-user/ |
58410666 | 141 | obj-y += gdbstub.o |
84778508 | 142 | |
84778508 BS |
143 | endif #CONFIG_BSD_USER |
144 | ||
40293e58 FB |
145 | ######################################################### |
146 | # System emulator target | |
76dfdd24 | 147 | ifdef CONFIG_SOFTMMU |
96d0e26c | 148 | obj-y += arch_init.o cpus.o monitor.o gdbstub.o balloon.o ioport.o numa.o |
5ddc6482 | 149 | obj-y += qtest.o |
c353f261 | 150 | obj-y += hw/ |
d9bb58e5 | 151 | obj-y += memory.o |
c22d8e04 | 152 | obj-y += memory_mapping.o |
2a78636b | 153 | obj-y += dump.o |
2da91b54 | 154 | obj-$(TARGET_X86_64) += win_dump.o |
46d702b1 | 155 | obj-y += migration/ram.o |
7398dfc7 | 156 | LIBS := $(libs_softmmu) $(LIBS) |
4fb240a4 | 157 | |
a541f297 | 158 | # Hardware support |
b9a7b74f | 159 | ifeq ($(TARGET_NAME), sparc64) |
5e8861a0 | 160 | obj-y += hw/sparc64/ |
3475187d | 161 | else |
5e8861a0 | 162 | obj-y += hw/$(TARGET_BASE_ARCH)/ |
9637443f JQ |
163 | endif |
164 | ||
4f04f13c | 165 | GENERATED_FILES += hmp-commands.h hmp-commands-info.h |
0e8c9214 | 166 | |
76dfdd24 | 167 | endif # CONFIG_SOFTMMU |
00a67ba1 | 168 | |
ba1183da | 169 | dummy := $(call unnest-vars,,obj-y) |
d608cc5c | 170 | all-obj-y := $(obj-y) |
ba1183da | 171 | |
341ea691 | 172 | target-obj-y := |
ba1183da FZ |
173 | block-obj-y := |
174 | common-obj-y := | |
32d955a4 | 175 | chardev-obj-y := |
1fdf3992 | 176 | slirp-obj-y := |
99100dc3 | 177 | include $(SRC_PATH)/Makefile.objs |
341ea691 LV |
178 | dummy := $(call unnest-vars,,target-obj-y) |
179 | target-obj-y-save := $(target-obj-y) | |
cc475698 FZ |
180 | dummy := $(call unnest-vars,.., \ |
181 | block-obj-y \ | |
182 | block-obj-m \ | |
32d955a4 | 183 | chardev-obj-y \ |
fb37726d DB |
184 | crypto-obj-y \ |
185 | crypto-aes-obj-y \ | |
0c7012e0 | 186 | qom-obj-y \ |
666a3af9 | 187 | io-obj-y \ |
cc475698 | 188 | common-obj-y \ |
1fdf3992 MAL |
189 | common-obj-m \ |
190 | slirp-obj-y) | |
341ea691 | 191 | target-obj-y := $(target-obj-y-save) |
d608cc5c | 192 | all-obj-y += $(common-obj-y) |
341ea691 | 193 | all-obj-y += $(target-obj-y) |
0c7012e0 | 194 | all-obj-y += $(qom-obj-y) |
32d955a4 | 195 | all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y) $(chardev-obj-y) |
fb37726d DB |
196 | all-obj-$(CONFIG_USER_ONLY) += $(crypto-aes-obj-y) |
197 | all-obj-$(CONFIG_SOFTMMU) += $(crypto-obj-y) | |
666a3af9 | 198 | all-obj-$(CONFIG_SOFTMMU) += $(io-obj-y) |
1fdf3992 | 199 | all-obj-$(CONFIG_SOFTMMU) += $(slirp-obj-y) |
7fc5152c | 200 | |
a9ad5e1e MT |
201 | $(QEMU_PROG_BUILD): config-devices.mak |
202 | ||
ebedb37c | 203 | COMMON_LDADDS = ../libqemuutil.a |
0ab8ed18 | 204 | |
5c40c739 | 205 | # build either PROG or PROGW |
0ab8ed18 | 206 | $(QEMU_PROG_BUILD): $(all-obj-y) $(COMMON_LDADDS) |
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 |
6d8a764e | 226 | ifdef CONFIG_TRACE_SYSTEMTAP |
c276b17d DB |
227 | rm -f *.stp |
228 | endif | |
1e43adfc | 229 | |
5fafdf24 | 230 | install: all |
9b14bb04 | 231 | ifneq ($(PROGS),) |
0d659426 | 232 | $(call install-prog,$(PROGS),$(DESTDIR)$(bindir)) |
9b14bb04 | 233 | endif |
6d8a764e | 234 | ifdef CONFIG_TRACE_SYSTEMTAP |
6aae2a2e | 235 | $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset" |
c14518e9 | 236 | $(INSTALL_DATA) $(QEMU_PROG).stp-installed "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG).stp" |
e0b2fd0e | 237 | $(INSTALL_DATA) $(QEMU_PROG)-simpletrace.stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG)-simpletrace.stp" |
62dd1048 | 238 | $(INSTALL_DATA) $(QEMU_PROG)-log.stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG)-log.stp" |
c276b17d | 239 | endif |
626df76a | 240 | |
4f04f13c DB |
241 | GENERATED_FILES += config-target.h |
242 | Makefile: $(GENERATED_FILES) |