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 $(call set-vpath, $(SRC_PATH))
13 QEMU_CFLAGS += -I../linux-headers
15 QEMU_CFLAGS += -I.. -I$(SRC_PATH)/target-$(TARGET_BASE_ARCH) -DNEED_CPU_H
17 QEMU_CFLAGS+=-I$(SRC_PATH)/include
19 ifdef CONFIG_USER_ONLY
21 QEMU_PROG=qemu-$(TARGET_ARCH2)
23 # system emulator name
24 ifneq (,$(findstring -mwindows,$(LIBS)))
25 # Terminate program name with a 'w' because the linker builds a windows executable.
26 QEMU_PROGW=qemu-system-$(TARGET_ARCH2)w$(EXESUF)
27 endif # windows executable
28 QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF)
41 config-target.h: config-target.h-timestamp
42 config-target.h-timestamp: config-target.mak
44 ifdef CONFIG_TRACE_SYSTEMTAP
45 stap: $(QEMU_PROG).stp
47 ifdef CONFIG_USER_ONLY
53 $(QEMU_PROG).stp: $(SRC_PATH)/trace-events
54 $(call quiet-command,$(TRACETOOL) \
56 --backend=$(TRACE_BACKEND) \
57 --binary=$(bindir)/$(QEMU_PROG) \
58 --target-arch=$(TARGET_ARCH) \
59 --target-type=$(TARGET_TYPE) \
60 < $< > $@," GEN $(QEMU_PROG).stp")
67 # Dummy command so that make thinks it has done something
70 #########################################################
71 # cpu emulator library
72 obj-y = exec.o translate-all.o cpu-exec.o
73 obj-y += tcg/tcg.o tcg/optimize.o
74 obj-$(CONFIG_TCG_INTERPRETER) += tci.o
75 obj-y += fpu/softfloat.o
77 obj-$(CONFIG_TCI_DIS) += tci-dis.o
78 obj-y += target-$(TARGET_BASE_ARCH)/
79 obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o
81 tci-dis.o: QEMU_CFLAGS += -I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/tci
83 #########################################################
84 # Linux user emulator target
86 ifdef CONFIG_LINUX_USER
88 QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) -I$(SRC_PATH)/linux-user
91 obj-y += gdbstub.o thunk.o user-exec.o $(oslib-obj-y)
93 endif #CONFIG_LINUX_USER
95 #########################################################
96 # BSD user emulator target
100 QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
103 obj-y += gdbstub.o user-exec.o $(oslib-obj-y)
105 endif #CONFIG_BSD_USER
107 #########################################################
108 # System emulator target
110 CONFIG_NO_PCI = $(if $(subst n,,$(CONFIG_PCI)),n,y)
111 CONFIG_NO_KVM = $(if $(subst n,,$(CONFIG_KVM)),n,y)
112 CONFIG_NO_XEN = $(if $(subst n,,$(CONFIG_XEN)),n,y)
113 CONFIG_NO_GET_MEMORY_MAPPING = $(if $(subst n,,$(CONFIG_HAVE_GET_MEMORY_MAPPING)),n,y)
114 CONFIG_NO_CORE_DUMP = $(if $(subst n,,$(CONFIG_HAVE_CORE_DUMP)),n,y)
116 obj-y += arch_init.o cpus.o monitor.o gdbstub.o balloon.o ioport.o
118 obj-$(CONFIG_KVM) += kvm-all.o
119 obj-$(CONFIG_NO_KVM) += kvm-stub.o
120 obj-y += memory.o savevm.o cputlb.o
121 obj-$(CONFIG_HAVE_GET_MEMORY_MAPPING) += memory_mapping.o
122 obj-$(CONFIG_HAVE_CORE_DUMP) += dump.o
123 obj-$(CONFIG_NO_GET_MEMORY_MAPPING) += memory_mapping-stub.o
124 obj-$(CONFIG_NO_CORE_DUMP) += dump-stub.o
127 QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
128 QEMU_CFLAGS += $(VNC_SASL_CFLAGS)
129 QEMU_CFLAGS += $(VNC_JPEG_CFLAGS)
130 QEMU_CFLAGS += $(VNC_PNG_CFLAGS)
133 obj-$(CONFIG_XEN) += xen-all.o xen-mapcache.o
134 obj-$(CONFIG_NO_XEN) += xen-stub.o
137 ifeq ($(TARGET_ARCH), sparc64)
140 obj-y += hw/$(TARGET_BASE_ARCH)/
143 main.o: QEMU_CFLAGS+=$(GPROF_CFLAGS)
145 GENERATED_HEADERS += hmp-commands.h qmp-commands-old.h
147 endif # CONFIG_SOFTMMU
151 # This resolves all nested paths, so it must come last
152 include $(SRC_PATH)/Makefile.objs
155 all-obj-y += $(addprefix ../, $(universal-obj-y))
158 all-obj-y += $(addprefix ../, $(common-obj-y))
159 all-obj-y += $(addprefix ../libdis/, $(libdis-y))
160 all-obj-y += $(addprefix $(HWDIR)/, $(hw-obj-y))
161 all-obj-y += $(addprefix ../, $(trace-obj-y))
163 all-obj-y += $(addprefix ../libuser/, $(user-obj-y))
164 all-obj-y += $(addprefix ../libdis-user/, $(libdis-y))
165 endif #CONFIG_LINUX_USER
168 # The linker builds a windows executable. Make also a console executable.
169 $(QEMU_PROGW): $(all-obj-y)
171 $(QEMU_PROG): $(QEMU_PROGW)
172 $(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG)," GEN $(TARGET_DIR)$(QEMU_PROG)")
174 $(QEMU_PROG): $(all-obj-y)
178 gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh
179 $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES)," GEN $(TARGET_DIR)$@")
181 hmp-commands.h: $(SRC_PATH)/hmp-commands.hx
182 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@")
184 qmp-commands-old.h: $(SRC_PATH)/qmp-commands.hx
185 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@")
188 rm -f *.a *~ $(PROGS)
189 rm -f $(shell find . -name '*.[od]')
190 rm -f hmp-commands.h qmp-commands-old.h gdbstub-xml.c
191 ifdef CONFIG_TRACE_SYSTEMTAP
197 $(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)"
199 $(STRIP) $(patsubst %,"$(DESTDIR)$(bindir)/%",$(PROGS))
202 ifdef CONFIG_TRACE_SYSTEMTAP
203 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
204 $(INSTALL_DATA) $(QEMU_PROG).stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
207 GENERATED_HEADERS += config-target.h
208 Makefile: $(GENERATED_HEADERS)