]>
Commit | Line | Data |
---|---|---|
562593aa AL |
1 | # -*- Mode: makefile -*- |
2 | ||
b3a29fd5 | 3 | CONFIG_NO_PCI = $(if $(subst n,,$(CONFIG_PCI)),n,y) |
98c8573e | 4 | CONFIG_NO_KVM = $(if $(subst n,,$(CONFIG_KVM)),n,y) |
6dbd588a | 5 | CONFIG_NO_XEN = $(if $(subst n,,$(CONFIG_XEN)),n,y) |
f527c579 | 6 | |
deed3ccf | 7 | include ../config-host.mak |
1f3d3c8f | 8 | include config-devices.mak |
25be210f | 9 | include config-target.mak |
17759187 | 10 | include $(SRC_PATH)/rules.mak |
0e8c9214 AF |
11 | ifneq ($(HWDIR),) |
12 | include $(HWDIR)/config.mak | |
13 | endif | |
626df76a | 14 | |
0b0babc6 | 15 | TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH) |
076d2471 | 16 | $(call set-vpath, $(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw) |
af2be207 JK |
17 | ifdef CONFIG_LINUX |
18 | QEMU_CFLAGS += -I../linux-headers | |
19 | endif | |
20 | QEMU_CFLAGS += -I.. -I$(TARGET_PATH) -DNEED_CPU_H | |
40293e58 | 21 | |
0e8c9214 AF |
22 | include $(SRC_PATH)/Makefile.objs |
23 | ||
2f28d2ff AL |
24 | QEMU_CFLAGS+=-I$(SRC_PATH)/include |
25 | ||
40293e58 FB |
26 | ifdef CONFIG_USER_ONLY |
27 | # user emulator name | |
28 | QEMU_PROG=qemu-$(TARGET_ARCH2) | |
29 | else | |
1e43adfc | 30 | # system emulator name |
0fa5491e SW |
31 | ifneq (,$(findstring -mwindows,$(LIBS))) |
32 | # Terminate program name with a 'w' because the linker builds a windows executable. | |
33 | QEMU_PROGW=qemu-system-$(TARGET_ARCH2)w$(EXESUF) | |
34 | endif # windows executable | |
40293e58 | 35 | QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF) |
a541f297 | 36 | endif |
626df76a | 37 | |
40293e58 | 38 | PROGS=$(QEMU_PROG) |
0fa5491e SW |
39 | ifdef QEMU_PROGW |
40 | PROGS+=$(QEMU_PROGW) | |
41 | endif | |
b8841706 | 42 | STPFILES= |
626df76a | 43 | |
aff447c9 | 44 | ifndef CONFIG_HAIKU |
626df76a | 45 | LIBS+=-lm |
aff447c9 | 46 | endif |
831b7825 | 47 | |
91880d96 JQ |
48 | config-target.h: config-target.h-timestamp |
49 | config-target.h-timestamp: config-target.mak | |
50 | ||
6d8a764e | 51 | ifdef CONFIG_TRACE_SYSTEMTAP |
c276b17d DB |
52 | stap: $(QEMU_PROG).stp |
53 | ||
54 | ifdef CONFIG_USER_ONLY | |
55 | TARGET_TYPE=user | |
56 | else | |
57 | TARGET_TYPE=system | |
58 | endif | |
59 | ||
2174e238 | 60 | $(QEMU_PROG).stp: $(SRC_PATH)/trace-events |
c0424934 | 61 | $(call quiet-command,$(TRACETOOL) \ |
650ab98d LV |
62 | --format=stap \ |
63 | --backend=$(TRACE_BACKEND) \ | |
64 | --binary=$(bindir)/$(QEMU_PROG) \ | |
65 | --target-arch=$(TARGET_ARCH) \ | |
66 | --target-type=$(TARGET_TYPE) \ | |
c0424934 | 67 | < $< > $@," GEN $(QEMU_PROG).stp") |
c276b17d DB |
68 | else |
69 | stap: | |
70 | endif | |
71 | ||
72 | all: $(PROGS) stap | |
91880d96 | 73 | |
c2fb2637 PB |
74 | # Dummy command so that make thinks it has done something |
75 | @true | |
626df76a | 76 | |
40293e58 | 77 | ######################################################### |
626df76a | 78 | # cpu emulator library |
c2b023b6 | 79 | libobj-y = exec.o translate-all.o cpu-exec.o translate.o |
8f2e8c07 | 80 | libobj-y += tcg/tcg.o tcg/optimize.o |
9195b2c2 | 81 | libobj-$(CONFIG_TCG_INTERPRETER) += tci.o |
cf67c6ba | 82 | libobj-y += fpu/softfloat.o |
0184e266 | 83 | ifneq ($(TARGET_BASE_ARCH), sparc) |
c3082755 | 84 | ifneq ($(TARGET_BASE_ARCH), alpha) |
0184e266 BS |
85 | libobj-y += op_helper.o |
86 | endif | |
c3082755 | 87 | endif |
0184e266 | 88 | libobj-y += helper.o |
894a84e6 | 89 | ifneq ($(TARGET_BASE_ARCH), ppc) |
30471bc9 | 90 | libobj-y += cpu.o |
c6dc6f63 | 91 | endif |
1bccec25 | 92 | libobj-$(TARGET_SPARC64) += vis_helper.o |
471857dd | 93 | libobj-$(CONFIG_NEED_MMU) += mmu.o |
e18ea868 | 94 | libobj-$(TARGET_ARM) += neon_helper.o iwmmxt_helper.o |
ab3b491f | 95 | ifeq ($(TARGET_BASE_ARCH), sparc) |
fafd8bce | 96 | libobj-y += fop_helper.o cc_helper.o win_helper.o mmu_helper.o ldst_helper.o |
ab3b491f BS |
97 | endif |
98 | libobj-$(TARGET_SPARC) += int32_helper.o | |
99 | libobj-$(TARGET_SPARC64) += int64_helper.o | |
c3082755 | 100 | libobj-$(TARGET_ALPHA) += int_helper.o fpu_helper.o sys_helper.o mem_helper.o |
cf6c1b16 | 101 | |
c9e0df73 | 102 | libobj-y += disas.o |
9195b2c2 SW |
103 | libobj-$(CONFIG_TCI_DIS) += tci-dis.o |
104 | ||
5e8861a0 PB |
105 | obj-y += target-$(TARGET_BASE_ARCH)/ |
106 | ||
9195b2c2 | 107 | tci-dis.o: QEMU_CFLAGS += -I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/tci |
626df76a | 108 | |
0184e266 | 109 | # HELPER_CFLAGS is used for all the legacy code compiled with static register |
40293e58 | 110 | # variables |
0184e266 BS |
111 | ifneq ($(TARGET_BASE_ARCH), sparc) |
112 | op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) | |
113 | endif | |
114 | user-exec.o: QEMU_CFLAGS += $(HELPER_CFLAGS) | |
40293e58 | 115 | |
c81da56e | 116 | # Note: this is a workaround. The real fix is to avoid compiling |
42a623c7 | 117 | # cpu_signal_handler() in user-exec.c. |
7fc5152c | 118 | %/signal.o: QEMU_CFLAGS += $(HELPER_CFLAGS) |
c81da56e | 119 | |
40293e58 FB |
120 | ######################################################### |
121 | # Linux user emulator target | |
122 | ||
123 | ifdef CONFIG_LINUX_USER | |
124 | ||
c3109ba1 | 125 | QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) -I$(SRC_PATH)/linux-user |
1c872672 | 126 | |
7fc5152c PB |
127 | obj-y += linux-user/ |
128 | obj-y += gdbstub.o thunk.o user-exec.o $(oslib-obj-y) | |
40293e58 | 129 | |
ce008c1f | 130 | obj-y += $(addprefix ../, $(universal-obj-y)) |
0e8c9214 | 131 | obj-y += $(addprefix ../libuser/, $(user-obj-y)) |
4d904533 | 132 | obj-y += $(addprefix ../libdis-user/, $(libdis-y)) |
0e8c9214 | 133 | obj-y += $(libobj-y) |
add16157 | 134 | |
40293e58 FB |
135 | endif #CONFIG_LINUX_USER |
136 | ||
84778508 BS |
137 | ######################################################### |
138 | # BSD user emulator target | |
139 | ||
140 | ifdef CONFIG_BSD_USER | |
141 | ||
a558ee17 | 142 | QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH) |
84778508 | 143 | |
7fc5152c PB |
144 | obj-y += bsd-user/ |
145 | obj-y += gdbstub.o user-exec.o | |
84778508 | 146 | |
ce008c1f | 147 | obj-y += $(addprefix ../, $(universal-obj-y)) |
0e8c9214 | 148 | obj-y += $(addprefix ../libuser/, $(user-obj-y)) |
4d904533 | 149 | obj-y += $(addprefix ../libdis-user/, $(libdis-y)) |
0e8c9214 | 150 | obj-y += $(libobj-y) |
84778508 BS |
151 | |
152 | endif #CONFIG_BSD_USER | |
153 | ||
40293e58 FB |
154 | ######################################################### |
155 | # System emulator target | |
76dfdd24 | 156 | ifdef CONFIG_SOFTMMU |
40293e58 | 157 | |
5e8861a0 | 158 | obj-y += arch_init.o cpus.o monitor.o machine.o gdbstub.o balloon.o ioport.o |
1fd31ad7 AL |
159 | # virtio has to be here due to weird dependency between PCI and virtio-net. |
160 | # need to fix this properly | |
b3a29fd5 | 161 | obj-$(CONFIG_NO_PCI) += pci-stub.o |
21673cde | 162 | obj-$(CONFIG_VIRTIO) += virtio.o virtio-blk.o virtio-balloon.o virtio-net.o virtio-serial-bus.o |
7725d146 | 163 | obj-$(CONFIG_VIRTIO) += virtio-scsi.o |
d5970055 MT |
164 | obj-y += vhost_net.o |
165 | obj-$(CONFIG_VHOST_NET) += vhost.o | |
f4f61d27 | 166 | obj-$(CONFIG_REALLY_VIRTFS) += 9pfs/virtio-9p-device.o |
a8e492c0 | 167 | obj-$(CONFIG_KVM) += kvm.o kvm-all.o |
98c8573e | 168 | obj-$(CONFIG_NO_KVM) += kvm-stub.o |
3d402831 | 169 | obj-$(CONFIG_VGA) += vga.o |
0cac1b66 | 170 | obj-y += memory.o savevm.o cputlb.o |
80167a8a | 171 | obj-y += memory_mapping.o |
fae001f5 | 172 | obj-$(CONFIG_HAVE_GET_MEMORY_MAPPING) += arch_memory_mapping.o |
9fecbed0 | 173 | obj-$(CONFIG_HAVE_CORE_DUMP) += arch_dump.o |
40293e58 | 174 | LIBS+=-lz |
4fb240a4 | 175 | |
a558ee17 | 176 | QEMU_CFLAGS += $(VNC_TLS_CFLAGS) |
a558ee17 | 177 | QEMU_CFLAGS += $(VNC_SASL_CFLAGS) |
2f6f5c7a | 178 | QEMU_CFLAGS += $(VNC_JPEG_CFLAGS) |
efe556ad | 179 | QEMU_CFLAGS += $(VNC_PNG_CFLAGS) |
2f9606b3 | 180 | |
3285cf4f | 181 | # xen support |
868bb33f | 182 | obj-$(CONFIG_XEN) += xen-all.o xen_machine_pv.o xen_domainbuild.o xen-mapcache.o |
3285cf4f AP |
183 | obj-$(CONFIG_NO_XEN) += xen-stub.o |
184 | ||
6cbf4c8c | 185 | # Inter-VM PCI shared memory |
1b01b4e7 AG |
186 | CONFIG_IVSHMEM = |
187 | ifeq ($(CONFIG_KVM), y) | |
188 | ifeq ($(CONFIG_PCI), y) | |
189 | CONFIG_IVSHMEM = y | |
190 | endif | |
191 | endif | |
192 | obj-$(CONFIG_IVSHMEM) += ivshmem.o | |
6cbf4c8c | 193 | |
963d83c8 AG |
194 | # Generic hotplugging |
195 | obj-y += device-hotplug.o | |
196 | ||
a541f297 | 197 | # Hardware support |
3475187d | 198 | ifeq ($(TARGET_ARCH), sparc64) |
5e8861a0 | 199 | obj-y += hw/sparc64/ |
3475187d | 200 | else |
5e8861a0 | 201 | obj-y += hw/$(TARGET_BASE_ARCH)/ |
9637443f JQ |
202 | endif |
203 | ||
5e8861a0 PB |
204 | # Device tree |
205 | ifeq ($(CONFIG_FDT), y) | |
206 | obj-$(TARGET_ARM) += device_tree.o | |
207 | obj-$(TARGET_MICROBLAZE) += device_tree.o | |
208 | obj-$(TARGET_PPC) += device_tree.o | |
209 | endif | |
2328826b | 210 | |
ad96090a | 211 | main.o: QEMU_CFLAGS+=$(GPROF_CFLAGS) |
5824d651 | 212 | |
4115852b | 213 | GENERATED_HEADERS += hmp-commands.h qmp-commands-old.h |
0e8c9214 | 214 | |
ce008c1f | 215 | obj-y += $(addprefix ../, $(universal-obj-y)) |
0e8c9214 | 216 | obj-y += $(addprefix ../, $(common-obj-y)) |
4d904533 | 217 | obj-y += $(addprefix ../libdis/, $(libdis-y)) |
0e8c9214 AF |
218 | obj-y += $(libobj-y) |
219 | obj-y += $(addprefix $(HWDIR)/, $(hw-obj-y)) | |
937b1258 | 220 | obj-y += $(addprefix ../, $(trace-obj-y)) |
626df76a | 221 | |
76dfdd24 | 222 | endif # CONFIG_SOFTMMU |
00a67ba1 | 223 | |
783e9b48 WC |
224 | obj-y += dump.o |
225 | ||
111a38b0 | 226 | ifndef CONFIG_LINUX_USER |
0fc6b582 | 227 | ifndef CONFIG_BSD_USER |
111a38b0 | 228 | # libcacard needs qemu-thread support, and besides is only needed by devices |
0fc6b582 | 229 | # so not requires with linux-user / bsd-user targets |
111a38b0 | 230 | obj-$(CONFIG_SMARTCARD_NSS) += $(addprefix ../libcacard/, $(libcacard-y)) |
0fc6b582 | 231 | endif # CONFIG_BSD_USER |
111a38b0 RR |
232 | endif # CONFIG_LINUX_USER |
233 | ||
3d0f1517 JQ |
234 | obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o |
235 | ||
7fc5152c PB |
236 | nested-vars = obj-y |
237 | dummy := $(call unnest-vars) | |
238 | ||
0fa5491e SW |
239 | ifdef QEMU_PROGW |
240 | # The linker builds a windows executable. Make also a console executable. | |
5e8861a0 | 241 | $(QEMU_PROGW): $(obj-y) |
0fa5491e SW |
242 | $(call LINK,$^) |
243 | $(QEMU_PROG): $(QEMU_PROGW) | |
244 | $(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG)," GEN $(TARGET_DIR)$(QEMU_PROG)") | |
245 | else | |
5e8861a0 | 246 | $(QEMU_PROG): $(obj-y) |
e03b41d4 | 247 | $(call LINK,$^) |
0fa5491e | 248 | endif |
16394485 | 249 | |
4c3b5a48 BS |
250 | gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh |
251 | $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES)," GEN $(TARGET_DIR)$@") | |
56aebc89 | 252 | |
acd0a093 | 253 | hmp-commands.h: $(SRC_PATH)/hmp-commands.hx |
4c3b5a48 | 254 | $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@") |
2313086a | 255 | |
e3193601 | 256 | qmp-commands-old.h: $(SRC_PATH)/qmp-commands.hx |
4c3b5a48 | 257 | $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@") |
2313086a | 258 | |
626df76a | 259 | clean: |
2313086a | 260 | rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o |
3b9a6ee5 | 261 | rm -f *.d */*.d tcg/*.o ide/*.o 9pfs/*.o kvm/*.o |
e3193601 | 262 | rm -f hmp-commands.h qmp-commands-old.h gdbstub-xml.c |
6d8a764e | 263 | ifdef CONFIG_TRACE_SYSTEMTAP |
c276b17d DB |
264 | rm -f *.stp |
265 | endif | |
1e43adfc | 266 | |
5fafdf24 | 267 | install: all |
9b14bb04 | 268 | ifneq ($(PROGS),) |
52ba784d HB |
269 | $(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)" |
270 | ifneq ($(STRIP),) | |
271 | $(STRIP) $(patsubst %,"$(DESTDIR)$(bindir)/%",$(PROGS)) | |
272 | endif | |
9b14bb04 | 273 | endif |
6d8a764e | 274 | ifdef CONFIG_TRACE_SYSTEMTAP |
6aae2a2e EH |
275 | $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset" |
276 | $(INSTALL_DATA) $(QEMU_PROG).stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset" | |
c276b17d | 277 | endif |
626df76a | 278 | |
4115852b PB |
279 | GENERATED_HEADERS += config-target.h |
280 | Makefile: $(GENERATED_HEADERS) | |
281 | ||
2f96c28d JM |
282 | # Include automatically generated dependency files |
283 | -include $(wildcard *.d */*.d) |