]> git.proxmox.com Git - mirror_qemu.git/blame - Makefile.target
build: move obj-TARGET-y variables to nested Makefile.objs
[mirror_qemu.git] / Makefile.target
CommitLineData
562593aa
AL
1# -*- Mode: makefile -*-
2
b3a29fd5 3CONFIG_NO_PCI = $(if $(subst n,,$(CONFIG_PCI)),n,y)
98c8573e 4CONFIG_NO_KVM = $(if $(subst n,,$(CONFIG_KVM)),n,y)
6dbd588a 5CONFIG_NO_XEN = $(if $(subst n,,$(CONFIG_XEN)),n,y)
f527c579 6
deed3ccf 7include ../config-host.mak
1f3d3c8f 8include config-devices.mak
25be210f 9include config-target.mak
17759187 10include $(SRC_PATH)/rules.mak
0e8c9214
AF
11ifneq ($(HWDIR),)
12include $(HWDIR)/config.mak
13endif
626df76a 14
0b0babc6 15TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
076d2471 16$(call set-vpath, $(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw)
af2be207
JK
17ifdef CONFIG_LINUX
18QEMU_CFLAGS += -I../linux-headers
19endif
20QEMU_CFLAGS += -I.. -I$(TARGET_PATH) -DNEED_CPU_H
40293e58 21
0e8c9214
AF
22include $(SRC_PATH)/Makefile.objs
23
2f28d2ff
AL
24QEMU_CFLAGS+=-I$(SRC_PATH)/include
25
40293e58
FB
26ifdef CONFIG_USER_ONLY
27# user emulator name
28QEMU_PROG=qemu-$(TARGET_ARCH2)
29else
1e43adfc 30# system emulator name
0fa5491e
SW
31ifneq (,$(findstring -mwindows,$(LIBS)))
32# Terminate program name with a 'w' because the linker builds a windows executable.
33QEMU_PROGW=qemu-system-$(TARGET_ARCH2)w$(EXESUF)
34endif # windows executable
40293e58 35QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF)
a541f297 36endif
626df76a 37
40293e58 38PROGS=$(QEMU_PROG)
0fa5491e
SW
39ifdef QEMU_PROGW
40PROGS+=$(QEMU_PROGW)
41endif
b8841706 42STPFILES=
626df76a 43
aff447c9 44ifndef CONFIG_HAIKU
626df76a 45LIBS+=-lm
aff447c9 46endif
831b7825 47
91880d96
JQ
48config-target.h: config-target.h-timestamp
49config-target.h-timestamp: config-target.mak
50
6d8a764e 51ifdef CONFIG_TRACE_SYSTEMTAP
c276b17d
DB
52stap: $(QEMU_PROG).stp
53
54ifdef CONFIG_USER_ONLY
55TARGET_TYPE=user
56else
57TARGET_TYPE=system
58endif
59
2174e238 60$(QEMU_PROG).stp: $(SRC_PATH)/trace-events
c0424934 61 $(call quiet-command,$(TRACETOOL) \
650ab98d
LV
62 --format=stap \
63 --backend=$(TRACE_BACKEND) \
64 --binary=$(bindir)/$(QEMU_PROG) \
65 --target-arch=$(TARGET_ARCH) \
66 --target-type=$(TARGET_TYPE) \
c0424934 67 < $< > $@," GEN $(QEMU_PROG).stp")
c276b17d
DB
68else
69stap:
70endif
71
72all: $(PROGS) stap
91880d96 73
c2fb2637
PB
74# Dummy command so that make thinks it has done something
75 @true
626df76a 76
40293e58 77#########################################################
626df76a 78# cpu emulator library
c2b023b6 79libobj-y = exec.o translate-all.o cpu-exec.o translate.o
8f2e8c07 80libobj-y += tcg/tcg.o tcg/optimize.o
9195b2c2 81libobj-$(CONFIG_TCG_INTERPRETER) += tci.o
cf67c6ba 82libobj-y += fpu/softfloat.o
0184e266 83ifneq ($(TARGET_BASE_ARCH), sparc)
c3082755 84ifneq ($(TARGET_BASE_ARCH), alpha)
0184e266
BS
85libobj-y += op_helper.o
86endif
c3082755 87endif
0184e266 88libobj-y += helper.o
894a84e6 89ifneq ($(TARGET_BASE_ARCH), ppc)
30471bc9 90libobj-y += cpu.o
c6dc6f63 91endif
1bccec25 92libobj-$(TARGET_SPARC64) += vis_helper.o
471857dd 93libobj-$(CONFIG_NEED_MMU) += mmu.o
e18ea868 94libobj-$(TARGET_ARM) += neon_helper.o iwmmxt_helper.o
ab3b491f 95ifeq ($(TARGET_BASE_ARCH), sparc)
fafd8bce 96libobj-y += fop_helper.o cc_helper.o win_helper.o mmu_helper.o ldst_helper.o
ab3b491f
BS
97endif
98libobj-$(TARGET_SPARC) += int32_helper.o
99libobj-$(TARGET_SPARC64) += int64_helper.o
c3082755 100libobj-$(TARGET_ALPHA) += int_helper.o fpu_helper.o sys_helper.o mem_helper.o
cf6c1b16 101
c9e0df73 102libobj-y += disas.o
9195b2c2
SW
103libobj-$(CONFIG_TCI_DIS) += tci-dis.o
104
5e8861a0
PB
105obj-y += target-$(TARGET_BASE_ARCH)/
106
9195b2c2 107tci-dis.o: QEMU_CFLAGS += -I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/tci
626df76a 108
0184e266 109# HELPER_CFLAGS is used for all the legacy code compiled with static register
40293e58 110# variables
0184e266
BS
111ifneq ($(TARGET_BASE_ARCH), sparc)
112op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
113endif
114user-exec.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
40293e58 115
c81da56e 116# Note: this is a workaround. The real fix is to avoid compiling
42a623c7 117# cpu_signal_handler() in user-exec.c.
7fc5152c 118%/signal.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
c81da56e 119
40293e58
FB
120#########################################################
121# Linux user emulator target
122
123ifdef CONFIG_LINUX_USER
124
c3109ba1 125QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) -I$(SRC_PATH)/linux-user
1c872672 126
7fc5152c
PB
127obj-y += linux-user/
128obj-y += gdbstub.o thunk.o user-exec.o $(oslib-obj-y)
40293e58 129
ce008c1f 130obj-y += $(addprefix ../, $(universal-obj-y))
0e8c9214 131obj-y += $(addprefix ../libuser/, $(user-obj-y))
4d904533 132obj-y += $(addprefix ../libdis-user/, $(libdis-y))
0e8c9214 133obj-y += $(libobj-y)
add16157 134
40293e58
FB
135endif #CONFIG_LINUX_USER
136
84778508
BS
137#########################################################
138# BSD user emulator target
139
140ifdef CONFIG_BSD_USER
141
a558ee17 142QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
84778508 143
7fc5152c
PB
144obj-y += bsd-user/
145obj-y += gdbstub.o user-exec.o
84778508 146
ce008c1f 147obj-y += $(addprefix ../, $(universal-obj-y))
0e8c9214 148obj-y += $(addprefix ../libuser/, $(user-obj-y))
4d904533 149obj-y += $(addprefix ../libdis-user/, $(libdis-y))
0e8c9214 150obj-y += $(libobj-y)
84778508
BS
151
152endif #CONFIG_BSD_USER
153
40293e58
FB
154#########################################################
155# System emulator target
76dfdd24 156ifdef CONFIG_SOFTMMU
40293e58 157
5e8861a0 158obj-y += arch_init.o cpus.o monitor.o machine.o gdbstub.o balloon.o ioport.o
1fd31ad7
AL
159# virtio has to be here due to weird dependency between PCI and virtio-net.
160# need to fix this properly
b3a29fd5 161obj-$(CONFIG_NO_PCI) += pci-stub.o
21673cde 162obj-$(CONFIG_VIRTIO) += virtio.o virtio-blk.o virtio-balloon.o virtio-net.o virtio-serial-bus.o
7725d146 163obj-$(CONFIG_VIRTIO) += virtio-scsi.o
d5970055
MT
164obj-y += vhost_net.o
165obj-$(CONFIG_VHOST_NET) += vhost.o
f4f61d27 166obj-$(CONFIG_REALLY_VIRTFS) += 9pfs/virtio-9p-device.o
a8e492c0 167obj-$(CONFIG_KVM) += kvm.o kvm-all.o
98c8573e 168obj-$(CONFIG_NO_KVM) += kvm-stub.o
3d402831 169obj-$(CONFIG_VGA) += vga.o
0cac1b66 170obj-y += memory.o savevm.o cputlb.o
80167a8a 171obj-y += memory_mapping.o
fae001f5 172obj-$(CONFIG_HAVE_GET_MEMORY_MAPPING) += arch_memory_mapping.o
9fecbed0 173obj-$(CONFIG_HAVE_CORE_DUMP) += arch_dump.o
40293e58 174LIBS+=-lz
4fb240a4 175
a558ee17 176QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
a558ee17 177QEMU_CFLAGS += $(VNC_SASL_CFLAGS)
2f6f5c7a 178QEMU_CFLAGS += $(VNC_JPEG_CFLAGS)
efe556ad 179QEMU_CFLAGS += $(VNC_PNG_CFLAGS)
2f9606b3 180
3285cf4f 181# xen support
868bb33f 182obj-$(CONFIG_XEN) += xen-all.o xen_machine_pv.o xen_domainbuild.o xen-mapcache.o
3285cf4f
AP
183obj-$(CONFIG_NO_XEN) += xen-stub.o
184
6cbf4c8c 185# Inter-VM PCI shared memory
1b01b4e7
AG
186CONFIG_IVSHMEM =
187ifeq ($(CONFIG_KVM), y)
188 ifeq ($(CONFIG_PCI), y)
189 CONFIG_IVSHMEM = y
190 endif
191endif
192obj-$(CONFIG_IVSHMEM) += ivshmem.o
6cbf4c8c 193
963d83c8
AG
194# Generic hotplugging
195obj-y += device-hotplug.o
196
a541f297 197# Hardware support
3475187d 198ifeq ($(TARGET_ARCH), sparc64)
5e8861a0 199obj-y += hw/sparc64/
3475187d 200else
5e8861a0 201obj-y += hw/$(TARGET_BASE_ARCH)/
9637443f
JQ
202endif
203
5e8861a0
PB
204# Device tree
205ifeq ($(CONFIG_FDT), y)
206obj-$(TARGET_ARM) += device_tree.o
207obj-$(TARGET_MICROBLAZE) += device_tree.o
208obj-$(TARGET_PPC) += device_tree.o
209endif
2328826b 210
ad96090a 211main.o: QEMU_CFLAGS+=$(GPROF_CFLAGS)
5824d651 212
4115852b 213GENERATED_HEADERS += hmp-commands.h qmp-commands-old.h
0e8c9214 214
ce008c1f 215obj-y += $(addprefix ../, $(universal-obj-y))
0e8c9214 216obj-y += $(addprefix ../, $(common-obj-y))
4d904533 217obj-y += $(addprefix ../libdis/, $(libdis-y))
0e8c9214
AF
218obj-y += $(libobj-y)
219obj-y += $(addprefix $(HWDIR)/, $(hw-obj-y))
937b1258 220obj-y += $(addprefix ../, $(trace-obj-y))
626df76a 221
76dfdd24 222endif # CONFIG_SOFTMMU
00a67ba1 223
783e9b48
WC
224obj-y += dump.o
225
111a38b0 226ifndef CONFIG_LINUX_USER
0fc6b582 227ifndef CONFIG_BSD_USER
111a38b0 228# libcacard needs qemu-thread support, and besides is only needed by devices
0fc6b582 229# so not requires with linux-user / bsd-user targets
111a38b0 230obj-$(CONFIG_SMARTCARD_NSS) += $(addprefix ../libcacard/, $(libcacard-y))
0fc6b582 231endif # CONFIG_BSD_USER
111a38b0
RR
232endif # CONFIG_LINUX_USER
233
3d0f1517
JQ
234obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o
235
7fc5152c
PB
236nested-vars = obj-y
237dummy := $(call unnest-vars)
238
0fa5491e
SW
239ifdef QEMU_PROGW
240# The linker builds a windows executable. Make also a console executable.
5e8861a0 241$(QEMU_PROGW): $(obj-y)
0fa5491e
SW
242 $(call LINK,$^)
243$(QEMU_PROG): $(QEMU_PROGW)
244 $(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG)," GEN $(TARGET_DIR)$(QEMU_PROG)")
245else
5e8861a0 246$(QEMU_PROG): $(obj-y)
e03b41d4 247 $(call LINK,$^)
0fa5491e 248endif
16394485 249
4c3b5a48
BS
250gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh
251 $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES)," GEN $(TARGET_DIR)$@")
56aebc89 252
acd0a093 253hmp-commands.h: $(SRC_PATH)/hmp-commands.hx
4c3b5a48 254 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@")
2313086a 255
e3193601 256qmp-commands-old.h: $(SRC_PATH)/qmp-commands.hx
4c3b5a48 257 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@")
2313086a 258
626df76a 259clean:
2313086a 260 rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o
3b9a6ee5 261 rm -f *.d */*.d tcg/*.o ide/*.o 9pfs/*.o kvm/*.o
e3193601 262 rm -f hmp-commands.h qmp-commands-old.h gdbstub-xml.c
6d8a764e 263ifdef CONFIG_TRACE_SYSTEMTAP
c276b17d
DB
264 rm -f *.stp
265endif
1e43adfc 266
5fafdf24 267install: all
9b14bb04 268ifneq ($(PROGS),)
52ba784d
HB
269 $(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)"
270ifneq ($(STRIP),)
271 $(STRIP) $(patsubst %,"$(DESTDIR)$(bindir)/%",$(PROGS))
272endif
9b14bb04 273endif
6d8a764e 274ifdef CONFIG_TRACE_SYSTEMTAP
6aae2a2e
EH
275 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
276 $(INSTALL_DATA) $(QEMU_PROG).stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
c276b17d 277endif
626df76a 278
4115852b
PB
279GENERATED_HEADERS += config-target.h
280Makefile: $(GENERATED_HEADERS)
281
2f96c28d
JM
282# Include automatically generated dependency files
283-include $(wildcard *.d */*.d)