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 $(call set-vpath, $(SRC_PATH))
10 QEMU_CFLAGS += -I../linux-headers
12 QEMU_CFLAGS += -I.. -I$(SRC_PATH)/target-$(TARGET_BASE_ARCH) -DNEED_CPU_H
14 QEMU_CFLAGS+=-I$(SRC_PATH)/include
16 ifdef CONFIG_USER_ONLY
18 QEMU_PROG=qemu-$(TARGET_ARCH2)
20 # system emulator name
21 ifneq (,$(findstring -mwindows,$(LIBS)))
22 # Terminate program name with a 'w' because the linker builds a windows executable.
23 QEMU_PROGW=qemu-system-$(TARGET_ARCH2)w$(EXESUF)
24 endif # windows executable
25 QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF)
34 config-target.h: config-target.h-timestamp
35 config-target.h-timestamp: config-target.mak
37 ifdef CONFIG_TRACE_SYSTEMTAP
38 stap: $(QEMU_PROG).stp
40 ifdef CONFIG_USER_ONLY
46 $(QEMU_PROG).stp: $(SRC_PATH)/trace-events
47 $(call quiet-command,$(TRACETOOL) \
49 --backend=$(TRACE_BACKEND) \
50 --binary=$(bindir)/$(QEMU_PROG) \
51 --target-arch=$(TARGET_ARCH) \
52 --target-type=$(TARGET_TYPE) \
53 < $< > $@," GEN $(TARGET_DIR)$(QEMU_PROG).stp")
60 # Dummy command so that make thinks it has done something
63 #########################################################
64 # cpu emulator library
65 obj-y = exec.o translate-all.o cpu-exec.o
66 obj-y += tcg/tcg.o tcg/optimize.o
67 obj-$(CONFIG_TCG_INTERPRETER) += tci.o
68 obj-$(CONFIG_TCG_INTERPRETER) += disas/tci.o
69 obj-y += fpu/softfloat.o
70 obj-y += target-$(TARGET_BASE_ARCH)/
72 obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o
74 #########################################################
75 # Linux user emulator target
77 ifdef CONFIG_LINUX_USER
79 QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) -I$(SRC_PATH)/linux-user
82 obj-y += gdbstub.o thunk.o user-exec.o
84 endif #CONFIG_LINUX_USER
86 #########################################################
87 # BSD user emulator target
91 QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
94 obj-y += gdbstub.o user-exec.o
96 endif #CONFIG_BSD_USER
98 #########################################################
99 # System emulator target
101 CONFIG_NO_PCI = $(if $(subst n,,$(CONFIG_PCI)),n,y)
102 CONFIG_NO_KVM = $(if $(subst n,,$(CONFIG_KVM)),n,y)
103 CONFIG_NO_XEN = $(if $(subst n,,$(CONFIG_XEN)),n,y)
104 CONFIG_NO_GET_MEMORY_MAPPING = $(if $(subst n,,$(CONFIG_HAVE_GET_MEMORY_MAPPING)),n,y)
105 CONFIG_NO_CORE_DUMP = $(if $(subst n,,$(CONFIG_HAVE_CORE_DUMP)),n,y)
107 obj-y += arch_init.o cpus.o monitor.o gdbstub.o balloon.o ioport.o
110 obj-$(CONFIG_FDT) += device_tree.o
111 obj-$(CONFIG_KVM) += kvm-all.o
112 obj-$(CONFIG_NO_KVM) += kvm-stub.o
113 obj-y += memory.o savevm.o cputlb.o
114 obj-$(CONFIG_HAVE_GET_MEMORY_MAPPING) += memory_mapping.o
115 obj-$(CONFIG_HAVE_CORE_DUMP) += dump.o
116 obj-$(CONFIG_NO_GET_MEMORY_MAPPING) += memory_mapping-stub.o
117 obj-$(CONFIG_NO_CORE_DUMP) += dump-stub.o
118 LIBS+=$(libs_softmmu)
121 obj-$(CONFIG_XEN) += xen-all.o xen-mapcache.o
122 obj-$(CONFIG_NO_XEN) += xen-stub.o
125 ifeq ($(TARGET_ARCH), sparc64)
128 obj-y += hw/$(TARGET_BASE_ARCH)/
131 main.o: QEMU_CFLAGS+=$(GPROF_CFLAGS)
133 GENERATED_HEADERS += hmp-commands.h qmp-commands-old.h
135 endif # CONFIG_SOFTMMU
137 # Workaround for http://gcc.gnu.org/PR55489, see configure.
138 %/translate.o: QEMU_CFLAGS += $(TRANSLATE_OPT_CFLAGS)
142 # This resolves all nested paths, so it must come last
143 include $(SRC_PATH)/Makefile.objs
146 all-obj-y += $(addprefix ../, $(common-obj-y))
153 # The linker builds a windows executable. Make also a console executable.
154 $(QEMU_PROGW): $(all-obj-y) ../libqemuutil.a ../libqemustub.a
156 $(QEMU_PROG): $(QEMU_PROGW)
157 $(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG)," GEN $(TARGET_DIR)$(QEMU_PROG)")
159 $(QEMU_PROG): $(all-obj-y) ../libqemuutil.a ../libqemustub.a
163 gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh
164 $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES)," GEN $(TARGET_DIR)$@")
166 hmp-commands.h: $(SRC_PATH)/hmp-commands.hx
167 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@")
169 qmp-commands-old.h: $(SRC_PATH)/qmp-commands.hx
170 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@")
173 rm -f *.a *~ $(PROGS)
174 rm -f $(shell find . -name '*.[od]')
175 rm -f hmp-commands.h qmp-commands-old.h gdbstub-xml.c
176 ifdef CONFIG_TRACE_SYSTEMTAP
182 $(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)"
184 $(STRIP) $(patsubst %,"$(DESTDIR)$(bindir)/%",$(PROGS))
187 ifdef CONFIG_TRACE_SYSTEMTAP
188 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
189 $(INSTALL_DATA) $(QEMU_PROG).stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
192 GENERATED_HEADERS += config-target.h
193 Makefile: $(GENERATED_HEADERS)