]>
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 | |
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 |
fbe37ef3 | 79 | obj-y = exec.o translate-all.o cpu-exec.o |
9cdc8df3 PB |
80 | obj-y += tcg/tcg.o tcg/optimize.o |
81 | obj-$(CONFIG_TCG_INTERPRETER) += tci.o | |
82 | obj-y += fpu/softfloat.o | |
83 | obj-y += disas.o | |
84 | obj-$(CONFIG_TCI_DIS) += tci-dis.o | |
5e8861a0 | 85 | obj-y += target-$(TARGET_BASE_ARCH)/ |
9cdc8df3 | 86 | obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o |
5e8861a0 | 87 | |
9195b2c2 | 88 | tci-dis.o: QEMU_CFLAGS += -I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/tci |
626df76a | 89 | |
0184e266 | 90 | # HELPER_CFLAGS is used for all the legacy code compiled with static register |
40293e58 | 91 | # variables |
0184e266 | 92 | user-exec.o: QEMU_CFLAGS += $(HELPER_CFLAGS) |
40293e58 | 93 | |
c81da56e | 94 | # Note: this is a workaround. The real fix is to avoid compiling |
42a623c7 | 95 | # cpu_signal_handler() in user-exec.c. |
7fc5152c | 96 | %/signal.o: QEMU_CFLAGS += $(HELPER_CFLAGS) |
c81da56e | 97 | |
40293e58 FB |
98 | ######################################################### |
99 | # Linux user emulator target | |
100 | ||
101 | ifdef CONFIG_LINUX_USER | |
102 | ||
c3109ba1 | 103 | QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) -I$(SRC_PATH)/linux-user |
1c872672 | 104 | |
7fc5152c PB |
105 | obj-y += linux-user/ |
106 | obj-y += gdbstub.o thunk.o user-exec.o $(oslib-obj-y) | |
40293e58 | 107 | |
40293e58 FB |
108 | endif #CONFIG_LINUX_USER |
109 | ||
84778508 BS |
110 | ######################################################### |
111 | # BSD user emulator target | |
112 | ||
113 | ifdef CONFIG_BSD_USER | |
114 | ||
a558ee17 | 115 | QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH) |
84778508 | 116 | |
7fc5152c PB |
117 | obj-y += bsd-user/ |
118 | obj-y += gdbstub.o user-exec.o | |
84778508 | 119 | |
84778508 BS |
120 | endif #CONFIG_BSD_USER |
121 | ||
40293e58 FB |
122 | ######################################################### |
123 | # System emulator target | |
76dfdd24 | 124 | ifdef CONFIG_SOFTMMU |
40293e58 | 125 | |
fbe37ef3 | 126 | obj-y += arch_init.o cpus.o monitor.o gdbstub.o balloon.o ioport.o |
1fd31ad7 AL |
127 | # virtio has to be here due to weird dependency between PCI and virtio-net. |
128 | # need to fix this properly | |
b3a29fd5 | 129 | obj-$(CONFIG_NO_PCI) += pci-stub.o |
21673cde | 130 | obj-$(CONFIG_VIRTIO) += virtio.o virtio-blk.o virtio-balloon.o virtio-net.o virtio-serial-bus.o |
7725d146 | 131 | obj-$(CONFIG_VIRTIO) += virtio-scsi.o |
d5970055 MT |
132 | obj-y += vhost_net.o |
133 | obj-$(CONFIG_VHOST_NET) += vhost.o | |
f4f61d27 | 134 | obj-$(CONFIG_REALLY_VIRTFS) += 9pfs/virtio-9p-device.o |
fbe37ef3 | 135 | obj-$(CONFIG_KVM) += kvm-all.o |
98c8573e | 136 | obj-$(CONFIG_NO_KVM) += kvm-stub.o |
3d402831 | 137 | obj-$(CONFIG_VGA) += vga.o |
0cac1b66 | 138 | obj-y += memory.o savevm.o cputlb.o |
fbe37ef3 PB |
139 | obj-$(CONFIG_HAVE_GET_MEMORY_MAPPING) += memory_mapping.o |
140 | obj-$(CONFIG_HAVE_CORE_DUMP) += dump.o | |
5f86146f PB |
141 | obj-$(CONFIG_NO_GET_MEMORY_MAPPING) += memory_mapping-stub.o |
142 | obj-$(CONFIG_NO_CORE_DUMP) += dump-stub.o | |
40293e58 | 143 | LIBS+=-lz |
4fb240a4 | 144 | |
a558ee17 | 145 | QEMU_CFLAGS += $(VNC_TLS_CFLAGS) |
a558ee17 | 146 | QEMU_CFLAGS += $(VNC_SASL_CFLAGS) |
2f6f5c7a | 147 | QEMU_CFLAGS += $(VNC_JPEG_CFLAGS) |
efe556ad | 148 | QEMU_CFLAGS += $(VNC_PNG_CFLAGS) |
2f9606b3 | 149 | |
3285cf4f | 150 | # xen support |
868bb33f | 151 | obj-$(CONFIG_XEN) += xen-all.o xen_machine_pv.o xen_domainbuild.o xen-mapcache.o |
3285cf4f AP |
152 | obj-$(CONFIG_NO_XEN) += xen-stub.o |
153 | ||
6cbf4c8c | 154 | # Inter-VM PCI shared memory |
1b01b4e7 AG |
155 | CONFIG_IVSHMEM = |
156 | ifeq ($(CONFIG_KVM), y) | |
157 | ifeq ($(CONFIG_PCI), y) | |
158 | CONFIG_IVSHMEM = y | |
159 | endif | |
160 | endif | |
161 | obj-$(CONFIG_IVSHMEM) += ivshmem.o | |
6cbf4c8c | 162 | |
963d83c8 AG |
163 | # Generic hotplugging |
164 | obj-y += device-hotplug.o | |
165 | ||
a541f297 | 166 | # Hardware support |
3475187d | 167 | ifeq ($(TARGET_ARCH), sparc64) |
5e8861a0 | 168 | obj-y += hw/sparc64/ |
3475187d | 169 | else |
5e8861a0 | 170 | obj-y += hw/$(TARGET_BASE_ARCH)/ |
9637443f JQ |
171 | endif |
172 | ||
5e8861a0 PB |
173 | # Device tree |
174 | ifeq ($(CONFIG_FDT), y) | |
175 | obj-$(TARGET_ARM) += device_tree.o | |
176 | obj-$(TARGET_MICROBLAZE) += device_tree.o | |
177 | obj-$(TARGET_PPC) += device_tree.o | |
178 | endif | |
2328826b | 179 | |
ad96090a | 180 | main.o: QEMU_CFLAGS+=$(GPROF_CFLAGS) |
5824d651 | 181 | |
4115852b | 182 | GENERATED_HEADERS += hmp-commands.h qmp-commands-old.h |
0e8c9214 | 183 | |
76dfdd24 | 184 | endif # CONFIG_SOFTMMU |
00a67ba1 | 185 | |
99100dc3 PB |
186 | nested-vars += obj-y |
187 | ||
188 | # This resolves all nested paths, so it must come last | |
189 | include $(SRC_PATH)/Makefile.objs | |
190 | ||
191 | all-obj-y = $(obj-y) | |
192 | all-obj-y += $(addprefix ../, $(universal-obj-y)) | |
193 | ||
194 | ifdef CONFIG_SOFTMMU | |
195 | ||
196 | all-obj-y += $(addprefix ../, $(common-obj-y)) | |
197 | all-obj-y += $(addprefix ../libdis/, $(libdis-y)) | |
198 | all-obj-y += $(addprefix $(HWDIR)/, $(hw-obj-y)) | |
199 | all-obj-y += $(addprefix ../, $(trace-obj-y)) | |
200 | ||
111a38b0 | 201 | # libcacard needs qemu-thread support, and besides is only needed by devices |
0fc6b582 | 202 | # so not requires with linux-user / bsd-user targets |
99100dc3 | 203 | all-obj-$(CONFIG_SMARTCARD_NSS) += $(addprefix ../libcacard/, $(libcacard-y)) |
111a38b0 | 204 | |
99100dc3 PB |
205 | else |
206 | all-obj-y += $(addprefix ../libuser/, $(user-obj-y)) | |
207 | all-obj-y += $(addprefix ../libdis-user/, $(libdis-y)) | |
208 | endif #CONFIG_LINUX_USER | |
7fc5152c | 209 | |
0fa5491e SW |
210 | ifdef QEMU_PROGW |
211 | # The linker builds a windows executable. Make also a console executable. | |
99100dc3 | 212 | $(QEMU_PROGW): $(all-obj-y) |
0fa5491e SW |
213 | $(call LINK,$^) |
214 | $(QEMU_PROG): $(QEMU_PROGW) | |
215 | $(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG)," GEN $(TARGET_DIR)$(QEMU_PROG)") | |
216 | else | |
99100dc3 | 217 | $(QEMU_PROG): $(all-obj-y) |
e03b41d4 | 218 | $(call LINK,$^) |
0fa5491e | 219 | endif |
16394485 | 220 | |
4c3b5a48 BS |
221 | gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh |
222 | $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES)," GEN $(TARGET_DIR)$@") | |
56aebc89 | 223 | |
acd0a093 | 224 | hmp-commands.h: $(SRC_PATH)/hmp-commands.hx |
4c3b5a48 | 225 | $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@") |
2313086a | 226 | |
e3193601 | 227 | qmp-commands-old.h: $(SRC_PATH)/qmp-commands.hx |
4c3b5a48 | 228 | $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@") |
2313086a | 229 | |
626df76a | 230 | clean: |
2313086a | 231 | rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o |
3b9a6ee5 | 232 | rm -f *.d */*.d tcg/*.o ide/*.o 9pfs/*.o kvm/*.o |
e3193601 | 233 | rm -f hmp-commands.h qmp-commands-old.h gdbstub-xml.c |
6d8a764e | 234 | ifdef CONFIG_TRACE_SYSTEMTAP |
c276b17d DB |
235 | rm -f *.stp |
236 | endif | |
1e43adfc | 237 | |
5fafdf24 | 238 | install: all |
9b14bb04 | 239 | ifneq ($(PROGS),) |
52ba784d HB |
240 | $(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)" |
241 | ifneq ($(STRIP),) | |
242 | $(STRIP) $(patsubst %,"$(DESTDIR)$(bindir)/%",$(PROGS)) | |
243 | endif | |
9b14bb04 | 244 | endif |
6d8a764e | 245 | ifdef CONFIG_TRACE_SYSTEMTAP |
6aae2a2e EH |
246 | $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset" |
247 | $(INSTALL_DATA) $(QEMU_PROG).stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset" | |
c276b17d | 248 | endif |
626df76a | 249 | |
4115852b PB |
250 | GENERATED_HEADERS += config-target.h |
251 | Makefile: $(GENERATED_HEADERS) | |
252 | ||
2f96c28d JM |
253 | # Include automatically generated dependency files |
254 | -include $(wildcard *.d */*.d) |