1 # -*- Mode: makefile -*-
3 include ../config-host.mak
4 include config-devices.mak
5 include config-target.mak
6 include $(SRC_PATH)/rules.mak
8 include $(HWDIR)/config.mak
11 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
12 $(call set-vpath, $(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw)
14 QEMU_CFLAGS += -I../linux-headers
16 QEMU_CFLAGS += -I.. -I$(TARGET_PATH) -DNEED_CPU_H
18 QEMU_CFLAGS+=-I$(SRC_PATH)/include
20 ifdef CONFIG_USER_ONLY
22 QEMU_PROG=qemu-$(TARGET_ARCH2)
24 # system emulator name
25 ifneq (,$(findstring -mwindows,$(LIBS)))
26 # Terminate program name with a 'w' because the linker builds a windows executable.
27 QEMU_PROGW=qemu-system-$(TARGET_ARCH2)w$(EXESUF)
28 endif # windows executable
29 QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF)
42 config-target.h: config-target.h-timestamp
43 config-target.h-timestamp: config-target.mak
45 ifdef CONFIG_TRACE_SYSTEMTAP
46 stap: $(QEMU_PROG).stp
48 ifdef CONFIG_USER_ONLY
54 $(QEMU_PROG).stp: $(SRC_PATH)/trace-events
55 $(call quiet-command,$(TRACETOOL) \
57 --backend=$(TRACE_BACKEND) \
58 --binary=$(bindir)/$(QEMU_PROG) \
59 --target-arch=$(TARGET_ARCH) \
60 --target-type=$(TARGET_TYPE) \
61 < $< > $@," GEN $(QEMU_PROG).stp")
68 # Dummy command so that make thinks it has done something
71 #########################################################
72 # cpu emulator library
73 obj-y = exec.o translate-all.o cpu-exec.o
74 obj-y += tcg/tcg.o tcg/optimize.o
75 obj-$(CONFIG_TCG_INTERPRETER) += tci.o
76 obj-y += fpu/softfloat.o
78 obj-$(CONFIG_TCI_DIS) += tci-dis.o
79 obj-y += target-$(TARGET_BASE_ARCH)/
80 obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o
82 tci-dis.o: QEMU_CFLAGS += -I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/tci
84 # HELPER_CFLAGS is used for all the legacy code compiled with static register
86 user-exec.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
88 # Note: this is a workaround. The real fix is to avoid compiling
89 # cpu_signal_handler() in user-exec.c.
90 %/signal.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
92 #########################################################
93 # Linux user emulator target
95 ifdef CONFIG_LINUX_USER
97 QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) -I$(SRC_PATH)/linux-user
100 obj-y += gdbstub.o thunk.o user-exec.o $(oslib-obj-y)
102 endif #CONFIG_LINUX_USER
104 #########################################################
105 # BSD user emulator target
107 ifdef CONFIG_BSD_USER
109 QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
112 obj-y += gdbstub.o user-exec.o
114 endif #CONFIG_BSD_USER
116 #########################################################
117 # System emulator target
119 CONFIG_NO_PCI = $(if $(subst n,,$(CONFIG_PCI)),n,y)
120 CONFIG_NO_KVM = $(if $(subst n,,$(CONFIG_KVM)),n,y)
121 CONFIG_NO_XEN = $(if $(subst n,,$(CONFIG_XEN)),n,y)
122 CONFIG_NO_GET_MEMORY_MAPPING = $(if $(subst n,,$(CONFIG_HAVE_GET_MEMORY_MAPPING)),n,y)
123 CONFIG_NO_CORE_DUMP = $(if $(subst n,,$(CONFIG_HAVE_CORE_DUMP)),n,y)
125 obj-y += arch_init.o cpus.o monitor.o gdbstub.o balloon.o ioport.o
127 obj-$(CONFIG_KVM) += kvm-all.o
128 obj-$(CONFIG_NO_KVM) += kvm-stub.o
129 obj-y += memory.o savevm.o cputlb.o
130 obj-$(CONFIG_HAVE_GET_MEMORY_MAPPING) += memory_mapping.o
131 obj-$(CONFIG_HAVE_CORE_DUMP) += dump.o
132 obj-$(CONFIG_NO_GET_MEMORY_MAPPING) += memory_mapping-stub.o
133 obj-$(CONFIG_NO_CORE_DUMP) += dump-stub.o
136 QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
137 QEMU_CFLAGS += $(VNC_SASL_CFLAGS)
138 QEMU_CFLAGS += $(VNC_JPEG_CFLAGS)
139 QEMU_CFLAGS += $(VNC_PNG_CFLAGS)
142 obj-$(CONFIG_XEN) += xen-all.o xen-mapcache.o
143 obj-$(CONFIG_NO_XEN) += xen-stub.o
146 ifeq ($(TARGET_ARCH), sparc64)
149 obj-y += hw/$(TARGET_BASE_ARCH)/
152 main.o: QEMU_CFLAGS+=$(GPROF_CFLAGS)
154 GENERATED_HEADERS += hmp-commands.h qmp-commands-old.h
156 endif # CONFIG_SOFTMMU
160 # This resolves all nested paths, so it must come last
161 include $(SRC_PATH)/Makefile.objs
164 all-obj-y += $(addprefix ../, $(universal-obj-y))
168 all-obj-y += $(addprefix ../, $(common-obj-y))
169 all-obj-y += $(addprefix ../libdis/, $(libdis-y))
170 all-obj-y += $(addprefix $(HWDIR)/, $(hw-obj-y))
171 all-obj-y += $(addprefix ../, $(trace-obj-y))
173 # libcacard needs qemu-thread support, and besides is only needed by devices
174 # so not requires with linux-user / bsd-user targets
175 all-obj-$(CONFIG_SMARTCARD_NSS) += $(addprefix ../libcacard/, $(libcacard-y))
178 all-obj-y += $(addprefix ../libuser/, $(user-obj-y))
179 all-obj-y += $(addprefix ../libdis-user/, $(libdis-y))
180 endif #CONFIG_LINUX_USER
183 # The linker builds a windows executable. Make also a console executable.
184 $(QEMU_PROGW): $(all-obj-y)
186 $(QEMU_PROG): $(QEMU_PROGW)
187 $(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG)," GEN $(TARGET_DIR)$(QEMU_PROG)")
189 $(QEMU_PROG): $(all-obj-y)
193 gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh
194 $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES)," GEN $(TARGET_DIR)$@")
196 hmp-commands.h: $(SRC_PATH)/hmp-commands.hx
197 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@")
199 qmp-commands-old.h: $(SRC_PATH)/qmp-commands.hx
200 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@")
203 rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o
204 rm -f *.d */*.d tcg/*.o ide/*.o 9pfs/*.o kvm/*.o
205 rm -f hmp-commands.h qmp-commands-old.h gdbstub-xml.c
206 ifdef CONFIG_TRACE_SYSTEMTAP
212 $(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)"
214 $(STRIP) $(patsubst %,"$(DESTDIR)$(bindir)/%",$(PROGS))
217 ifdef CONFIG_TRACE_SYSTEMTAP
218 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
219 $(INSTALL_DATA) $(QEMU_PROG).stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
222 GENERATED_HEADERS += config-target.h
223 Makefile: $(GENERATED_HEADERS)
225 # Include automatically generated dependency files
226 -include $(wildcard *.d */*.d)