1 # -*- Mode: makefile -*-
3 CONFIG_NO_PCI = $(if $(subst n,,$(CONFIG_PCI)),n,y)
4 CONFIG_NO_KVM = $(if $(subst n,,$(CONFIG_KVM)),n,y)
5 CONFIG_NO_XEN = $(if $(subst n,,$(CONFIG_XEN)),n,y)
7 include ../config-host.mak
8 include config-devices.mak
9 include config-target.mak
10 include $(SRC_PATH)/rules.mak
12 include $(HWDIR)/config.mak
15 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
16 $(call set-vpath, $(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw)
18 QEMU_CFLAGS += -I../linux-headers
20 QEMU_CFLAGS += -I.. -I$(TARGET_PATH) -DNEED_CPU_H
22 include $(SRC_PATH)/Makefile.objs
24 QEMU_CFLAGS+=-I$(SRC_PATH)/include
26 ifdef CONFIG_USER_ONLY
28 QEMU_PROG=qemu-$(TARGET_ARCH2)
30 # system emulator name
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
35 QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF)
48 config-target.h: config-target.h-timestamp
49 config-target.h-timestamp: config-target.mak
51 ifdef CONFIG_TRACE_SYSTEMTAP
52 stap: $(QEMU_PROG).stp
54 ifdef CONFIG_USER_ONLY
60 $(QEMU_PROG).stp: $(SRC_PATH)/trace-events
61 $(call quiet-command,$(TRACETOOL) \
63 --backend=$(TRACE_BACKEND) \
64 --binary=$(bindir)/$(QEMU_PROG) \
65 --target-arch=$(TARGET_ARCH) \
66 --target-type=$(TARGET_TYPE) \
67 < $< > $@," GEN $(QEMU_PROG).stp")
74 # Dummy command so that make thinks it has done something
77 #########################################################
78 # cpu emulator library
79 libobj-y = exec.o translate-all.o cpu-exec.o translate.o
80 libobj-y += tcg/tcg.o tcg/optimize.o
81 libobj-$(CONFIG_TCG_INTERPRETER) += tci.o
82 libobj-y += fpu/softfloat.o
83 ifneq ($(TARGET_BASE_ARCH), sparc)
84 ifneq ($(TARGET_BASE_ARCH), alpha)
85 libobj-y += op_helper.o
89 ifneq ($(TARGET_BASE_ARCH), ppc)
92 libobj-$(TARGET_SPARC64) += vis_helper.o
93 libobj-$(CONFIG_NEED_MMU) += mmu.o
94 libobj-$(TARGET_ARM) += neon_helper.o iwmmxt_helper.o
95 ifeq ($(TARGET_BASE_ARCH), sparc)
96 libobj-y += fop_helper.o cc_helper.o win_helper.o mmu_helper.o ldst_helper.o
98 libobj-$(TARGET_SPARC) += int32_helper.o
99 libobj-$(TARGET_SPARC64) += int64_helper.o
100 libobj-$(TARGET_ALPHA) += int_helper.o fpu_helper.o sys_helper.o mem_helper.o
103 libobj-$(CONFIG_TCI_DIS) += tci-dis.o
105 obj-y += target-$(TARGET_BASE_ARCH)/
107 tci-dis.o: QEMU_CFLAGS += -I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/tci
109 # HELPER_CFLAGS is used for all the legacy code compiled with static register
111 ifneq ($(TARGET_BASE_ARCH), sparc)
112 op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
114 user-exec.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
116 # Note: this is a workaround. The real fix is to avoid compiling
117 # cpu_signal_handler() in user-exec.c.
118 %/signal.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
120 #########################################################
121 # Linux user emulator target
123 ifdef CONFIG_LINUX_USER
125 QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) -I$(SRC_PATH)/linux-user
128 obj-y += gdbstub.o thunk.o user-exec.o $(oslib-obj-y)
130 obj-y += $(addprefix ../, $(universal-obj-y))
131 obj-y += $(addprefix ../libuser/, $(user-obj-y))
132 obj-y += $(addprefix ../libdis-user/, $(libdis-y))
135 endif #CONFIG_LINUX_USER
137 #########################################################
138 # BSD user emulator target
140 ifdef CONFIG_BSD_USER
142 QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
145 obj-y += gdbstub.o user-exec.o
147 obj-y += $(addprefix ../, $(universal-obj-y))
148 obj-y += $(addprefix ../libuser/, $(user-obj-y))
149 obj-y += $(addprefix ../libdis-user/, $(libdis-y))
152 endif #CONFIG_BSD_USER
154 #########################################################
155 # System emulator target
158 obj-y += arch_init.o cpus.o monitor.o machine.o gdbstub.o balloon.o ioport.o
159 # virtio has to be here due to weird dependency between PCI and virtio-net.
160 # need to fix this properly
161 obj-$(CONFIG_NO_PCI) += pci-stub.o
162 obj-$(CONFIG_VIRTIO) += virtio.o virtio-blk.o virtio-balloon.o virtio-net.o virtio-serial-bus.o
163 obj-$(CONFIG_VIRTIO) += virtio-scsi.o
165 obj-$(CONFIG_VHOST_NET) += vhost.o
166 obj-$(CONFIG_REALLY_VIRTFS) += 9pfs/virtio-9p-device.o
167 obj-$(CONFIG_KVM) += kvm.o kvm-all.o
168 obj-$(CONFIG_NO_KVM) += kvm-stub.o
169 obj-$(CONFIG_VGA) += vga.o
170 obj-y += memory.o savevm.o cputlb.o
171 obj-y += memory_mapping.o
172 obj-$(CONFIG_HAVE_GET_MEMORY_MAPPING) += arch_memory_mapping.o
173 obj-$(CONFIG_HAVE_CORE_DUMP) += arch_dump.o
176 QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
177 QEMU_CFLAGS += $(VNC_SASL_CFLAGS)
178 QEMU_CFLAGS += $(VNC_JPEG_CFLAGS)
179 QEMU_CFLAGS += $(VNC_PNG_CFLAGS)
182 obj-$(CONFIG_XEN) += xen-all.o xen_machine_pv.o xen_domainbuild.o xen-mapcache.o
183 obj-$(CONFIG_NO_XEN) += xen-stub.o
185 # Inter-VM PCI shared memory
187 ifeq ($(CONFIG_KVM), y)
188 ifeq ($(CONFIG_PCI), y)
192 obj-$(CONFIG_IVSHMEM) += ivshmem.o
194 # Generic hotplugging
195 obj-y += device-hotplug.o
198 ifeq ($(TARGET_ARCH), sparc64)
201 obj-y += hw/$(TARGET_BASE_ARCH)/
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
211 main.o: QEMU_CFLAGS+=$(GPROF_CFLAGS)
213 GENERATED_HEADERS += hmp-commands.h qmp-commands-old.h
215 obj-y += $(addprefix ../, $(universal-obj-y))
216 obj-y += $(addprefix ../, $(common-obj-y))
217 obj-y += $(addprefix ../libdis/, $(libdis-y))
219 obj-y += $(addprefix $(HWDIR)/, $(hw-obj-y))
220 obj-y += $(addprefix ../, $(trace-obj-y))
222 endif # CONFIG_SOFTMMU
226 ifndef CONFIG_LINUX_USER
227 ifndef CONFIG_BSD_USER
228 # libcacard needs qemu-thread support, and besides is only needed by devices
229 # so not requires with linux-user / bsd-user targets
230 obj-$(CONFIG_SMARTCARD_NSS) += $(addprefix ../libcacard/, $(libcacard-y))
231 endif # CONFIG_BSD_USER
232 endif # CONFIG_LINUX_USER
234 obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o
237 dummy := $(call unnest-vars)
240 # The linker builds a windows executable. Make also a console executable.
241 $(QEMU_PROGW): $(obj-y)
243 $(QEMU_PROG): $(QEMU_PROGW)
244 $(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG)," GEN $(TARGET_DIR)$(QEMU_PROG)")
246 $(QEMU_PROG): $(obj-y)
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)$@")
253 hmp-commands.h: $(SRC_PATH)/hmp-commands.hx
254 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@")
256 qmp-commands-old.h: $(SRC_PATH)/qmp-commands.hx
257 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@")
260 rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o
261 rm -f *.d */*.d tcg/*.o ide/*.o 9pfs/*.o kvm/*.o
262 rm -f hmp-commands.h qmp-commands-old.h gdbstub-xml.c
263 ifdef CONFIG_TRACE_SYSTEMTAP
269 $(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)"
271 $(STRIP) $(patsubst %,"$(DESTDIR)$(bindir)/%",$(PROGS))
274 ifdef CONFIG_TRACE_SYSTEMTAP
275 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
276 $(INSTALL_DATA) $(QEMU_PROG).stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
279 GENERATED_HEADERS += config-target.h
280 Makefile: $(GENERATED_HEADERS)
282 # Include automatically generated dependency files
283 -include $(wildcard *.d */*.d)