build: move fsdev/ objects to nested Makefile.objs
[qemu-kvm.git] / Makefile.target
blobf1d5fe2566a34ba7c0f51fe05d5bbc9ed2a19b1a
1 # -*- Mode: makefile -*-
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 CONFIG_NO_GET_MEMORY_MAPPING = $(if $(subst n,,$(CONFIG_HAVE_GET_MEMORY_MAPPING)),n,y)
7 CONFIG_NO_CORE_DUMP = $(if $(subst n,,$(CONFIG_HAVE_CORE_DUMP)),n,y)
9 include ../config-host.mak
10 include config-devices.mak
11 include config-target.mak
12 include $(SRC_PATH)/rules.mak
13 ifneq ($(HWDIR),)
14 include $(HWDIR)/config.mak
15 endif
17 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
18 $(call set-vpath, $(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw)
19 ifdef CONFIG_LINUX
20 QEMU_CFLAGS += -I../linux-headers
21 endif
22 QEMU_CFLAGS += -I.. -I$(TARGET_PATH) -DNEED_CPU_H
24 QEMU_CFLAGS+=-I$(SRC_PATH)/include
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
38 PROGS=$(QEMU_PROG)
39 ifdef QEMU_PROGW
40 PROGS+=$(QEMU_PROGW)
41 endif
42 STPFILES=
44 ifndef CONFIG_HAIKU
45 LIBS+=-lm
46 endif
48 config-target.h: config-target.h-timestamp
49 config-target.h-timestamp: config-target.mak
51 ifdef CONFIG_TRACE_SYSTEMTAP
52 stap: $(QEMU_PROG).stp
54 ifdef CONFIG_USER_ONLY
55 TARGET_TYPE=user
56 else
57 TARGET_TYPE=system
58 endif
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
72 all: $(PROGS) stap
74 # Dummy command so that make thinks it has done something
75         @true
77 #########################################################
78 # cpu emulator library
79 obj-y = exec.o translate-all.o cpu-exec.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
88 tci-dis.o: QEMU_CFLAGS += -I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/tci
90 # HELPER_CFLAGS is used for all the legacy code compiled with static register
91 # variables
92 user-exec.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
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)
98 #########################################################
99 # Linux user emulator target
101 ifdef CONFIG_LINUX_USER
103 QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) -I$(SRC_PATH)/linux-user
105 obj-y += linux-user/
106 obj-y += gdbstub.o thunk.o user-exec.o $(oslib-obj-y)
108 endif #CONFIG_LINUX_USER
110 #########################################################
111 # BSD user emulator target
113 ifdef CONFIG_BSD_USER
115 QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
117 obj-y += bsd-user/
118 obj-y += gdbstub.o user-exec.o
120 endif #CONFIG_BSD_USER
122 #########################################################
123 # System emulator target
124 ifdef CONFIG_SOFTMMU
126 obj-y += arch_init.o cpus.o monitor.o gdbstub.o balloon.o ioport.o
127 # virtio has to be here due to weird dependency between PCI and virtio-net.
128 # need to fix this properly
129 obj-$(CONFIG_NO_PCI) += pci-stub.o
130 obj-$(CONFIG_VIRTIO) += virtio.o virtio-blk.o virtio-balloon.o virtio-net.o virtio-serial-bus.o
131 obj-$(CONFIG_VIRTIO) += virtio-scsi.o
132 obj-y += vhost_net.o
133 obj-$(CONFIG_VHOST_NET) += vhost.o
134 obj-$(CONFIG_REALLY_VIRTFS) += 9pfs/virtio-9p-device.o
135 obj-$(CONFIG_KVM) += kvm-all.o
136 obj-$(CONFIG_NO_KVM) += kvm-stub.o
137 obj-$(CONFIG_VGA) += vga.o
138 obj-y += memory.o savevm.o cputlb.o
139 obj-$(CONFIG_HAVE_GET_MEMORY_MAPPING) += memory_mapping.o
140 obj-$(CONFIG_HAVE_CORE_DUMP) += dump.o
141 obj-$(CONFIG_NO_GET_MEMORY_MAPPING) += memory_mapping-stub.o
142 obj-$(CONFIG_NO_CORE_DUMP) += dump-stub.o
143 LIBS+=-lz
145 QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
146 QEMU_CFLAGS += $(VNC_SASL_CFLAGS)
147 QEMU_CFLAGS += $(VNC_JPEG_CFLAGS)
148 QEMU_CFLAGS += $(VNC_PNG_CFLAGS)
150 # xen support
151 obj-$(CONFIG_XEN) += xen-all.o xen_machine_pv.o xen_domainbuild.o xen-mapcache.o
152 obj-$(CONFIG_NO_XEN) += xen-stub.o
154 # Inter-VM PCI shared memory
155 CONFIG_IVSHMEM =
156 ifeq ($(CONFIG_KVM), y)
157   ifeq ($(CONFIG_PCI), y)
158     CONFIG_IVSHMEM = y
159   endif
160 endif
161 obj-$(CONFIG_IVSHMEM) += ivshmem.o
163 # Generic hotplugging
164 obj-y += device-hotplug.o
166 # Hardware support
167 ifeq ($(TARGET_ARCH), sparc64)
168 obj-y += hw/sparc64/
169 else
170 obj-y += hw/$(TARGET_BASE_ARCH)/
171 endif
173 # Device tree
174 ifeq ($(CONFIG_FDT), y)
175 obj-$(TARGET_ARM) += device_tree.o
176 obj-$(TARGET_MICROBLAZE) += device_tree.o
177 obj-$(TARGET_PPC) += device_tree.o
178 endif
180 main.o: QEMU_CFLAGS+=$(GPROF_CFLAGS)
182 GENERATED_HEADERS += hmp-commands.h qmp-commands-old.h
184 endif # CONFIG_SOFTMMU
186 nested-vars += obj-y
188 # This resolves all nested paths, so it must come last
189 include $(SRC_PATH)/Makefile.objs
191 all-obj-y = $(obj-y)
192 all-obj-y += $(addprefix ../, $(universal-obj-y))
194 ifdef CONFIG_SOFTMMU
196 all-obj-y += $(addprefix ../, $(common-obj-y))
197 all-obj-y += $(addprefix ../libdis/, $(libdis-y))
198 all-obj-y += $(addprefix $(HWDIR)/, $(hw-obj-y))
199 all-obj-y += $(addprefix ../, $(trace-obj-y))
201 # libcacard needs qemu-thread support, and besides is only needed by devices
202 # so not requires with linux-user / bsd-user targets
203 all-obj-$(CONFIG_SMARTCARD_NSS) += $(addprefix ../libcacard/, $(libcacard-y))
205 else
206 all-obj-y += $(addprefix ../libuser/, $(user-obj-y))
207 all-obj-y += $(addprefix ../libdis-user/, $(libdis-y))
208 endif #CONFIG_LINUX_USER
210 ifdef QEMU_PROGW
211 # The linker builds a windows executable. Make also a console executable.
212 $(QEMU_PROGW): $(all-obj-y)
213         $(call LINK,$^)
214 $(QEMU_PROG): $(QEMU_PROGW)
215         $(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG),"  GEN   $(TARGET_DIR)$(QEMU_PROG)")
216 else
217 $(QEMU_PROG): $(all-obj-y)
218         $(call LINK,$^)
219 endif
221 gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh
222         $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES),"  GEN   $(TARGET_DIR)$@")
224 hmp-commands.h: $(SRC_PATH)/hmp-commands.hx
225         $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
227 qmp-commands-old.h: $(SRC_PATH)/qmp-commands.hx
228         $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
230 clean:
231         rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o
232         rm -f *.d */*.d tcg/*.o ide/*.o 9pfs/*.o kvm/*.o
233         rm -f hmp-commands.h qmp-commands-old.h gdbstub-xml.c
234 ifdef CONFIG_TRACE_SYSTEMTAP
235         rm -f *.stp
236 endif
238 install: all
239 ifneq ($(PROGS),)
240         $(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)"
241 ifneq ($(STRIP),)
242         $(STRIP) $(patsubst %,"$(DESTDIR)$(bindir)/%",$(PROGS))
243 endif
244 endif
245 ifdef CONFIG_TRACE_SYSTEMTAP
246         $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
247         $(INSTALL_DATA) $(QEMU_PROG).stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
248 endif
250 GENERATED_HEADERS += config-target.h
251 Makefile: $(GENERATED_HEADERS)
253 # Include automatically generated dependency files
254 -include $(wildcard *.d */*.d)