Merge remote-tracking branch 'kraxel/bios.2' into staging
[qemu.git] / Makefile.target
blob74f7a4a1706cd51caa3c0c7216a4b3e013937627
1 # -*- Mode: makefile -*-
3 include ../config-host.mak
4 include config-devices.mak
5 include config-target.mak
6 include $(SRC_PATH)/rules.mak
7 ifneq ($(HWDIR),)
8 include $(HWDIR)/config.mak
9 endif
11 $(call set-vpath, $(SRC_PATH))
12 ifdef CONFIG_LINUX
13 QEMU_CFLAGS += -I../linux-headers
14 endif
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
20 # user emulator name
21 QEMU_PROG=qemu-$(TARGET_ARCH2)
22 else
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)
29 endif
31 PROGS=$(QEMU_PROG)
32 ifdef QEMU_PROGW
33 PROGS+=$(QEMU_PROGW)
34 endif
35 STPFILES=
37 ifndef CONFIG_HAIKU
38 LIBS+=-lm
39 endif
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
48 TARGET_TYPE=user
49 else
50 TARGET_TYPE=system
51 endif
53 $(QEMU_PROG).stp: $(SRC_PATH)/trace-events
54         $(call quiet-command,$(TRACETOOL) \
55                 --format=stap \
56                 --backend=$(TRACE_BACKEND) \
57                 --binary=$(bindir)/$(QEMU_PROG) \
58                 --target-arch=$(TARGET_ARCH) \
59                 --target-type=$(TARGET_TYPE) \
60                 < $< > $@,"  GEN   $(QEMU_PROG).stp")
61 else
62 stap:
63 endif
65 all: $(PROGS) stap
67 # Dummy command so that make thinks it has done something
68         @true
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
76 obj-y += disas.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 # HELPER_CFLAGS is used for all the legacy code compiled with static register
84 # variables
85 user-exec.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
87 # Note: this is a workaround. The real fix is to avoid compiling
88 # cpu_signal_handler() in user-exec.c.
89 %/signal.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
91 #########################################################
92 # Linux user emulator target
94 ifdef CONFIG_LINUX_USER
96 QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) -I$(SRC_PATH)/linux-user
98 obj-y += linux-user/
99 obj-y += gdbstub.o thunk.o user-exec.o $(oslib-obj-y)
101 endif #CONFIG_LINUX_USER
103 #########################################################
104 # BSD user emulator target
106 ifdef CONFIG_BSD_USER
108 QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
110 obj-y += bsd-user/
111 obj-y += gdbstub.o user-exec.o $(oslib-obj-y)
113 endif #CONFIG_BSD_USER
115 #########################################################
116 # System emulator target
117 ifdef CONFIG_SOFTMMU
118 CONFIG_NO_PCI = $(if $(subst n,,$(CONFIG_PCI)),n,y)
119 CONFIG_NO_KVM = $(if $(subst n,,$(CONFIG_KVM)),n,y)
120 CONFIG_NO_XEN = $(if $(subst n,,$(CONFIG_XEN)),n,y)
121 CONFIG_NO_GET_MEMORY_MAPPING = $(if $(subst n,,$(CONFIG_HAVE_GET_MEMORY_MAPPING)),n,y)
122 CONFIG_NO_CORE_DUMP = $(if $(subst n,,$(CONFIG_HAVE_CORE_DUMP)),n,y)
124 obj-y += arch_init.o cpus.o monitor.o gdbstub.o balloon.o ioport.o
125 obj-y += hw/
126 obj-$(CONFIG_KVM) += kvm-all.o
127 obj-$(CONFIG_NO_KVM) += kvm-stub.o
128 obj-y += memory.o savevm.o cputlb.o
129 obj-$(CONFIG_HAVE_GET_MEMORY_MAPPING) += memory_mapping.o
130 obj-$(CONFIG_HAVE_CORE_DUMP) += dump.o
131 obj-$(CONFIG_NO_GET_MEMORY_MAPPING) += memory_mapping-stub.o
132 obj-$(CONFIG_NO_CORE_DUMP) += dump-stub.o
133 LIBS+=-lz
135 QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
136 QEMU_CFLAGS += $(VNC_SASL_CFLAGS)
137 QEMU_CFLAGS += $(VNC_JPEG_CFLAGS)
138 QEMU_CFLAGS += $(VNC_PNG_CFLAGS)
140 # xen support
141 obj-$(CONFIG_XEN) += xen-all.o xen-mapcache.o
142 obj-$(CONFIG_NO_XEN) += xen-stub.o
144 # Hardware support
145 ifeq ($(TARGET_ARCH), sparc64)
146 obj-y += hw/sparc64/
147 else
148 obj-y += hw/$(TARGET_BASE_ARCH)/
149 endif
151 main.o: QEMU_CFLAGS+=$(GPROF_CFLAGS)
153 GENERATED_HEADERS += hmp-commands.h qmp-commands-old.h
155 endif # CONFIG_SOFTMMU
157 nested-vars += obj-y
159 # This resolves all nested paths, so it must come last
160 include $(SRC_PATH)/Makefile.objs
162 all-obj-y = $(obj-y)
163 all-obj-y += $(addprefix ../, $(universal-obj-y))
165 ifdef CONFIG_SOFTMMU
166 all-obj-y += $(addprefix ../, $(common-obj-y))
167 all-obj-y += $(addprefix ../libdis/, $(libdis-y))
168 all-obj-y += $(addprefix $(HWDIR)/, $(hw-obj-y))
169 all-obj-y += $(addprefix ../, $(trace-obj-y))
170 else
171 all-obj-y += $(addprefix ../libuser/, $(user-obj-y))
172 all-obj-y += $(addprefix ../libdis-user/, $(libdis-y))
173 endif #CONFIG_LINUX_USER
175 ifdef QEMU_PROGW
176 # The linker builds a windows executable. Make also a console executable.
177 $(QEMU_PROGW): $(all-obj-y)
178         $(call LINK,$^)
179 $(QEMU_PROG): $(QEMU_PROGW)
180         $(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG),"  GEN   $(TARGET_DIR)$(QEMU_PROG)")
181 else
182 $(QEMU_PROG): $(all-obj-y)
183         $(call LINK,$^)
184 endif
186 gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh
187         $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES),"  GEN   $(TARGET_DIR)$@")
189 hmp-commands.h: $(SRC_PATH)/hmp-commands.hx
190         $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
192 qmp-commands-old.h: $(SRC_PATH)/qmp-commands.hx
193         $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
195 clean:
196         rm -f *.a *~ $(PROGS)
197         rm -f $(shell find . -name '*.[od]')
198         rm -f hmp-commands.h qmp-commands-old.h gdbstub-xml.c
199 ifdef CONFIG_TRACE_SYSTEMTAP
200         rm -f *.stp
201 endif
203 install: all
204 ifneq ($(PROGS),)
205         $(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)"
206 ifneq ($(STRIP),)
207         $(STRIP) $(patsubst %,"$(DESTDIR)$(bindir)/%",$(PROGS))
208 endif
209 endif
210 ifdef CONFIG_TRACE_SYSTEMTAP
211         $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
212         $(INSTALL_DATA) $(QEMU_PROG).stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
213 endif
215 GENERATED_HEADERS += config-target.h
216 Makefile: $(GENERATED_HEADERS)
218 # Include automatically generated dependency files
219 -include $(wildcard *.d fpu/*.d tcg/*.d)