]> git.proxmox.com Git - qemu.git/blob - Makefile.target
build: move libobj-y variable to nested Makefile.objs
[qemu.git] / Makefile.target
1 # -*- Mode: makefile -*-
2
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)
6
7 include ../config-host.mak
8 include config-devices.mak
9 include config-target.mak
10 include $(SRC_PATH)/rules.mak
11 ifneq ($(HWDIR),)
12 include $(HWDIR)/config.mak
13 endif
14
15 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
16 $(call set-vpath, $(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw)
17 ifdef CONFIG_LINUX
18 QEMU_CFLAGS += -I../linux-headers
19 endif
20 QEMU_CFLAGS += -I.. -I$(TARGET_PATH) -DNEED_CPU_H
21
22 include $(SRC_PATH)/Makefile.objs
23
24 QEMU_CFLAGS+=-I$(SRC_PATH)/include
25
26 ifdef CONFIG_USER_ONLY
27 # user emulator name
28 QEMU_PROG=qemu-$(TARGET_ARCH2)
29 else
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)
36 endif
37
38 PROGS=$(QEMU_PROG)
39 ifdef QEMU_PROGW
40 PROGS+=$(QEMU_PROGW)
41 endif
42 STPFILES=
43
44 ifndef CONFIG_HAIKU
45 LIBS+=-lm
46 endif
47
48 config-target.h: config-target.h-timestamp
49 config-target.h-timestamp: config-target.mak
50
51 ifdef CONFIG_TRACE_SYSTEMTAP
52 stap: $(QEMU_PROG).stp
53
54 ifdef CONFIG_USER_ONLY
55 TARGET_TYPE=user
56 else
57 TARGET_TYPE=system
58 endif
59
60 $(QEMU_PROG).stp: $(SRC_PATH)/trace-events
61 $(call quiet-command,$(TRACETOOL) \
62 --format=stap \
63 --backend=$(TRACE_BACKEND) \
64 --binary=$(bindir)/$(QEMU_PROG) \
65 --target-arch=$(TARGET_ARCH) \
66 --target-type=$(TARGET_TYPE) \
67 < $< > $@," GEN $(QEMU_PROG).stp")
68 else
69 stap:
70 endif
71
72 all: $(PROGS) stap
73
74 # Dummy command so that make thinks it has done something
75 @true
76
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
83 obj-y += disas.o
84 obj-$(CONFIG_TCI_DIS) += tci-dis.o
85 obj-y += target-$(TARGET_BASE_ARCH)/
86 obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o
87
88 tci-dis.o: QEMU_CFLAGS += -I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/tci
89
90 # HELPER_CFLAGS is used for all the legacy code compiled with static register
91 # variables
92 user-exec.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
93
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)
97
98 #########################################################
99 # Linux user emulator target
100
101 ifdef CONFIG_LINUX_USER
102
103 QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) -I$(SRC_PATH)/linux-user
104
105 obj-y += linux-user/
106 obj-y += gdbstub.o thunk.o user-exec.o $(oslib-obj-y)
107
108 obj-y += $(addprefix ../, $(universal-obj-y))
109 obj-y += $(addprefix ../libuser/, $(user-obj-y))
110 obj-y += $(addprefix ../libdis-user/, $(libdis-y))
111
112 endif #CONFIG_LINUX_USER
113
114 #########################################################
115 # BSD user emulator target
116
117 ifdef CONFIG_BSD_USER
118
119 QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
120
121 obj-y += bsd-user/
122 obj-y += gdbstub.o user-exec.o
123
124 obj-y += $(addprefix ../, $(universal-obj-y))
125 obj-y += $(addprefix ../libuser/, $(user-obj-y))
126 obj-y += $(addprefix ../libdis-user/, $(libdis-y))
127
128 endif #CONFIG_BSD_USER
129
130 #########################################################
131 # System emulator target
132 ifdef CONFIG_SOFTMMU
133
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
140 obj-y += vhost_net.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
150 LIBS+=-lz
151
152 QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
153 QEMU_CFLAGS += $(VNC_SASL_CFLAGS)
154 QEMU_CFLAGS += $(VNC_JPEG_CFLAGS)
155 QEMU_CFLAGS += $(VNC_PNG_CFLAGS)
156
157 # xen support
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
160
161 # Inter-VM PCI shared memory
162 CONFIG_IVSHMEM =
163 ifeq ($(CONFIG_KVM), y)
164 ifeq ($(CONFIG_PCI), y)
165 CONFIG_IVSHMEM = y
166 endif
167 endif
168 obj-$(CONFIG_IVSHMEM) += ivshmem.o
169
170 # Generic hotplugging
171 obj-y += device-hotplug.o
172
173 # Hardware support
174 ifeq ($(TARGET_ARCH), sparc64)
175 obj-y += hw/sparc64/
176 else
177 obj-y += hw/$(TARGET_BASE_ARCH)/
178 endif
179
180 # Device tree
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
185 endif
186
187 main.o: QEMU_CFLAGS+=$(GPROF_CFLAGS)
188
189 GENERATED_HEADERS += hmp-commands.h qmp-commands-old.h
190
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))
196
197 endif # CONFIG_SOFTMMU
198
199 obj-y += dump.o
200
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
208
209 nested-vars = obj-y
210 dummy := $(call unnest-vars)
211
212 ifdef QEMU_PROGW
213 # The linker builds a windows executable. Make also a console executable.
214 $(QEMU_PROGW): $(obj-y)
215 $(call LINK,$^)
216 $(QEMU_PROG): $(QEMU_PROGW)
217 $(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG)," GEN $(TARGET_DIR)$(QEMU_PROG)")
218 else
219 $(QEMU_PROG): $(obj-y)
220 $(call LINK,$^)
221 endif
222
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)$@")
225
226 hmp-commands.h: $(SRC_PATH)/hmp-commands.hx
227 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@")
228
229 qmp-commands-old.h: $(SRC_PATH)/qmp-commands.hx
230 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@")
231
232 clean:
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
237 rm -f *.stp
238 endif
239
240 install: all
241 ifneq ($(PROGS),)
242 $(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)"
243 ifneq ($(STRIP),)
244 $(STRIP) $(patsubst %,"$(DESTDIR)$(bindir)/%",$(PROGS))
245 endif
246 endif
247 ifdef CONFIG_TRACE_SYSTEMTAP
248 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
249 $(INSTALL_DATA) $(QEMU_PROG).stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
250 endif
251
252 GENERATED_HEADERS += config-target.h
253 Makefile: $(GENERATED_HEADERS)
254
255 # Include automatically generated dependency files
256 -include $(wildcard *.d */*.d)