]> git.proxmox.com Git - qemu.git/blob - Makefile.target
build: move device tree to per-target Makefile.objs
[qemu.git] / Makefile.target
1 # -*- Mode: makefile -*-
2
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
10
11 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
12 $(call set-vpath, $(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw)
13 ifdef CONFIG_LINUX
14 QEMU_CFLAGS += -I../linux-headers
15 endif
16 QEMU_CFLAGS += -I.. -I$(TARGET_PATH) -DNEED_CPU_H
17
18 QEMU_CFLAGS+=-I$(SRC_PATH)/include
19
20 ifdef CONFIG_USER_ONLY
21 # user emulator name
22 QEMU_PROG=qemu-$(TARGET_ARCH2)
23 else
24 # system emulator name
25 ifneq (,$(findstring -mwindows,$(LIBS)))
26 # Terminate program name with a 'w' because the linker builds a windows executable.
27 QEMU_PROGW=qemu-system-$(TARGET_ARCH2)w$(EXESUF)
28 endif # windows executable
29 QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF)
30 endif
31
32 PROGS=$(QEMU_PROG)
33 ifdef QEMU_PROGW
34 PROGS+=$(QEMU_PROGW)
35 endif
36 STPFILES=
37
38 ifndef CONFIG_HAIKU
39 LIBS+=-lm
40 endif
41
42 config-target.h: config-target.h-timestamp
43 config-target.h-timestamp: config-target.mak
44
45 ifdef CONFIG_TRACE_SYSTEMTAP
46 stap: $(QEMU_PROG).stp
47
48 ifdef CONFIG_USER_ONLY
49 TARGET_TYPE=user
50 else
51 TARGET_TYPE=system
52 endif
53
54 $(QEMU_PROG).stp: $(SRC_PATH)/trace-events
55 $(call quiet-command,$(TRACETOOL) \
56 --format=stap \
57 --backend=$(TRACE_BACKEND) \
58 --binary=$(bindir)/$(QEMU_PROG) \
59 --target-arch=$(TARGET_ARCH) \
60 --target-type=$(TARGET_TYPE) \
61 < $< > $@," GEN $(QEMU_PROG).stp")
62 else
63 stap:
64 endif
65
66 all: $(PROGS) stap
67
68 # Dummy command so that make thinks it has done something
69 @true
70
71 #########################################################
72 # cpu emulator library
73 obj-y = exec.o translate-all.o cpu-exec.o
74 obj-y += tcg/tcg.o tcg/optimize.o
75 obj-$(CONFIG_TCG_INTERPRETER) += tci.o
76 obj-y += fpu/softfloat.o
77 obj-y += disas.o
78 obj-$(CONFIG_TCI_DIS) += tci-dis.o
79 obj-y += target-$(TARGET_BASE_ARCH)/
80 obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o
81
82 tci-dis.o: QEMU_CFLAGS += -I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/tci
83
84 # HELPER_CFLAGS is used for all the legacy code compiled with static register
85 # variables
86 user-exec.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
87
88 # Note: this is a workaround. The real fix is to avoid compiling
89 # cpu_signal_handler() in user-exec.c.
90 %/signal.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
91
92 #########################################################
93 # Linux user emulator target
94
95 ifdef CONFIG_LINUX_USER
96
97 QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) -I$(SRC_PATH)/linux-user
98
99 obj-y += linux-user/
100 obj-y += gdbstub.o thunk.o user-exec.o $(oslib-obj-y)
101
102 endif #CONFIG_LINUX_USER
103
104 #########################################################
105 # BSD user emulator target
106
107 ifdef CONFIG_BSD_USER
108
109 QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
110
111 obj-y += bsd-user/
112 obj-y += gdbstub.o user-exec.o
113
114 endif #CONFIG_BSD_USER
115
116 #########################################################
117 # System emulator target
118 ifdef CONFIG_SOFTMMU
119 CONFIG_NO_PCI = $(if $(subst n,,$(CONFIG_PCI)),n,y)
120 CONFIG_NO_KVM = $(if $(subst n,,$(CONFIG_KVM)),n,y)
121 CONFIG_NO_XEN = $(if $(subst n,,$(CONFIG_XEN)),n,y)
122 CONFIG_NO_GET_MEMORY_MAPPING = $(if $(subst n,,$(CONFIG_HAVE_GET_MEMORY_MAPPING)),n,y)
123 CONFIG_NO_CORE_DUMP = $(if $(subst n,,$(CONFIG_HAVE_CORE_DUMP)),n,y)
124
125 obj-y += arch_init.o cpus.o monitor.o gdbstub.o balloon.o ioport.o
126 obj-y += hw/
127 obj-$(CONFIG_KVM) += kvm-all.o
128 obj-$(CONFIG_NO_KVM) += kvm-stub.o
129 obj-y += memory.o savevm.o cputlb.o
130 obj-$(CONFIG_HAVE_GET_MEMORY_MAPPING) += memory_mapping.o
131 obj-$(CONFIG_HAVE_CORE_DUMP) += dump.o
132 obj-$(CONFIG_NO_GET_MEMORY_MAPPING) += memory_mapping-stub.o
133 obj-$(CONFIG_NO_CORE_DUMP) += dump-stub.o
134 LIBS+=-lz
135
136 QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
137 QEMU_CFLAGS += $(VNC_SASL_CFLAGS)
138 QEMU_CFLAGS += $(VNC_JPEG_CFLAGS)
139 QEMU_CFLAGS += $(VNC_PNG_CFLAGS)
140
141 # xen support
142 obj-$(CONFIG_XEN) += xen-all.o xen-mapcache.o
143 obj-$(CONFIG_NO_XEN) += xen-stub.o
144
145 # Hardware support
146 ifeq ($(TARGET_ARCH), sparc64)
147 obj-y += hw/sparc64/
148 else
149 obj-y += hw/$(TARGET_BASE_ARCH)/
150 endif
151
152 main.o: QEMU_CFLAGS+=$(GPROF_CFLAGS)
153
154 GENERATED_HEADERS += hmp-commands.h qmp-commands-old.h
155
156 endif # CONFIG_SOFTMMU
157
158 nested-vars += obj-y
159
160 # This resolves all nested paths, so it must come last
161 include $(SRC_PATH)/Makefile.objs
162
163 all-obj-y = $(obj-y)
164 all-obj-y += $(addprefix ../, $(universal-obj-y))
165
166 ifdef CONFIG_SOFTMMU
167
168 all-obj-y += $(addprefix ../, $(common-obj-y))
169 all-obj-y += $(addprefix ../libdis/, $(libdis-y))
170 all-obj-y += $(addprefix $(HWDIR)/, $(hw-obj-y))
171 all-obj-y += $(addprefix ../, $(trace-obj-y))
172
173 # libcacard needs qemu-thread support, and besides is only needed by devices
174 # so not requires with linux-user / bsd-user targets
175 all-obj-$(CONFIG_SMARTCARD_NSS) += $(addprefix ../libcacard/, $(libcacard-y))
176
177 else
178 all-obj-y += $(addprefix ../libuser/, $(user-obj-y))
179 all-obj-y += $(addprefix ../libdis-user/, $(libdis-y))
180 endif #CONFIG_LINUX_USER
181
182 ifdef QEMU_PROGW
183 # The linker builds a windows executable. Make also a console executable.
184 $(QEMU_PROGW): $(all-obj-y)
185 $(call LINK,$^)
186 $(QEMU_PROG): $(QEMU_PROGW)
187 $(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG)," GEN $(TARGET_DIR)$(QEMU_PROG)")
188 else
189 $(QEMU_PROG): $(all-obj-y)
190 $(call LINK,$^)
191 endif
192
193 gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh
194 $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES)," GEN $(TARGET_DIR)$@")
195
196 hmp-commands.h: $(SRC_PATH)/hmp-commands.hx
197 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@")
198
199 qmp-commands-old.h: $(SRC_PATH)/qmp-commands.hx
200 $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@")
201
202 clean:
203 rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o
204 rm -f *.d */*.d tcg/*.o ide/*.o 9pfs/*.o kvm/*.o
205 rm -f hmp-commands.h qmp-commands-old.h gdbstub-xml.c
206 ifdef CONFIG_TRACE_SYSTEMTAP
207 rm -f *.stp
208 endif
209
210 install: all
211 ifneq ($(PROGS),)
212 $(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)"
213 ifneq ($(STRIP),)
214 $(STRIP) $(patsubst %,"$(DESTDIR)$(bindir)/%",$(PROGS))
215 endif
216 endif
217 ifdef CONFIG_TRACE_SYSTEMTAP
218 $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
219 $(INSTALL_DATA) $(QEMU_PROG).stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
220 endif
221
222 GENERATED_HEADERS += config-target.h
223 Makefile: $(GENERATED_HEADERS)
224
225 # Include automatically generated dependency files
226 -include $(wildcard *.d */*.d)