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