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 obj-y = exec.o translate-all.o cpu-exec.o translate.o
80 obj-y += tcg/tcg.o tcg/optimize.o
81 obj-$(CONFIG_TCG_INTERPRETER) += tci.o
82 obj-y += fpu/softfloat.o
84 obj-$(CONFIG_TCI_DIS) += tci-dis.o
85 obj-y += target-$(TARGET_BASE_ARCH)/
86 obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o
88 tci-dis.o: QEMU_CFLAGS += -I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/tci
90 # HELPER_CFLAGS is used for all the legacy code compiled with static register
92 user-exec.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
94 # Note: this is a workaround. The real fix is to avoid compiling
95 # cpu_signal_handler() in user-exec.c.
96 %/signal.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
98 #########################################################
99 # Linux user emulator target
101 ifdef CONFIG_LINUX_USER
103 QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) -I$(SRC_PATH)/linux-user
106 obj-y += gdbstub.o thunk.o user-exec.o $(oslib-obj-y)
108 obj-y += $(addprefix ../, $(universal-obj-y))
109 obj-y += $(addprefix ../libuser/, $(user-obj-y))
110 obj-y += $(addprefix ../libdis-user/, $(libdis-y))
112 endif #CONFIG_LINUX_USER
114 #########################################################
115 # BSD user emulator target
117 ifdef CONFIG_BSD_USER
119 QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
122 obj-y += gdbstub.o user-exec.o
124 obj-y += $(addprefix ../, $(universal-obj-y))
125 obj-y += $(addprefix ../libuser/, $(user-obj-y))
126 obj-y += $(addprefix ../libdis-user/, $(libdis-y))
128 endif #CONFIG_BSD_USER
130 #########################################################
131 # System emulator target
134 obj-y += arch_init.o cpus.o monitor.o machine.o gdbstub.o balloon.o ioport.o
135 # virtio has to be here due to weird dependency between PCI and virtio-net.
136 # need to fix this properly
137 obj-$(CONFIG_NO_PCI) += pci-stub.o
138 obj-$(CONFIG_VIRTIO) += virtio.o virtio-blk.o virtio-balloon.o virtio-net.o virtio-serial-bus.o
139 obj-$(CONFIG_VIRTIO) += virtio-scsi.o
141 obj-$(CONFIG_VHOST_NET) += vhost.o
142 obj-$(CONFIG_REALLY_VIRTFS) += 9pfs/virtio-9p-device.o
143 obj-$(CONFIG_KVM) += kvm.o kvm-all.o
144 obj-$(CONFIG_NO_KVM) += kvm-stub.o
145 obj-$(CONFIG_VGA) += vga.o
146 obj-y += memory.o savevm.o cputlb.o
147 obj-y += memory_mapping.o
148 obj-$(CONFIG_HAVE_GET_MEMORY_MAPPING) += arch_memory_mapping.o
149 obj-$(CONFIG_HAVE_CORE_DUMP) += arch_dump.o
152 QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
153 QEMU_CFLAGS += $(VNC_SASL_CFLAGS)
154 QEMU_CFLAGS += $(VNC_JPEG_CFLAGS)
155 QEMU_CFLAGS += $(VNC_PNG_CFLAGS)
158 obj-$(CONFIG_XEN) += xen-all.o xen_machine_pv.o xen_domainbuild.o xen-mapcache.o
159 obj-$(CONFIG_NO_XEN) += xen-stub.o
161 # Inter-VM PCI shared memory
163 ifeq ($(CONFIG_KVM), y)
164 ifeq ($(CONFIG_PCI), y)
168 obj-$(CONFIG_IVSHMEM) += ivshmem.o
170 # Generic hotplugging
171 obj-y += device-hotplug.o
174 ifeq ($(TARGET_ARCH), sparc64)
177 obj-y += hw/$(TARGET_BASE_ARCH)/
181 ifeq ($(CONFIG_FDT), y)
182 obj-$(TARGET_ARM) += device_tree.o
183 obj-$(TARGET_MICROBLAZE) += device_tree.o
184 obj-$(TARGET_PPC) += device_tree.o
187 main.o: QEMU_CFLAGS+=$(GPROF_CFLAGS)
189 GENERATED_HEADERS += hmp-commands.h qmp-commands-old.h
191 obj-y += $(addprefix ../, $(universal-obj-y))
192 obj-y += $(addprefix ../, $(common-obj-y))
193 obj-y += $(addprefix ../libdis/, $(libdis-y))
194 obj-y += $(addprefix $(HWDIR)/, $(hw-obj-y))
195 obj-y += $(addprefix ../, $(trace-obj-y))
197 endif # CONFIG_SOFTMMU
201 ifndef CONFIG_LINUX_USER
202 ifndef CONFIG_BSD_USER
203 # libcacard needs qemu-thread support, and besides is only needed by devices
204 # so not requires with linux-user / bsd-user targets
205 obj-$(CONFIG_SMARTCARD_NSS) += $(addprefix ../libcacard/, $(libcacard-y))
206 endif # CONFIG_BSD_USER
207 endif # CONFIG_LINUX_USER
210 dummy := $(call unnest-vars)
213 # The linker builds a windows executable. Make also a console executable.
214 $(QEMU_PROGW): $(obj-y)
216 $(QEMU_PROG): $(QEMU_PROGW)
217 $(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG)," GEN $(TARGET_DIR)$(QEMU_PROG)")
219 $(QEMU_PROG): $(obj-y)
223 gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh
224 $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES)," GEN $(TARGET_DIR)$@")
226 hmp-commands.h: $(SRC_PATH)/hmp-commands.hx
227 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@")
229 qmp-commands-old.h: $(SRC_PATH)/qmp-commands.hx
230 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@")
233 rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o
234 rm -f *.d */*.d tcg/*.o ide/*.o 9pfs/*.o kvm/*.o
235 rm -f hmp-commands.h qmp-commands-old.h gdbstub-xml.c
236 ifdef CONFIG_TRACE_SYSTEMTAP
242 $(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)"
244 $(STRIP) $(patsubst %,"$(DESTDIR)$(bindir)/%",$(PROGS))
247 ifdef CONFIG_TRACE_SYSTEMTAP
248 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
249 $(INSTALL_DATA) $(QEMU_PROG).stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
252 GENERATED_HEADERS += config-target.h
253 Makefile: $(GENERATED_HEADERS)
255 # Include automatically generated dependency files
256 -include $(wildcard *.d */*.d)