]>
Commit | Line | Data |
---|---|---|
626df76a | 1 | include config.mak |
17759187 | 2 | include $(SRC_PATH)/rules.mak |
626df76a | 3 | |
0b0babc6 FB |
4 | TARGET_BASE_ARCH:=$(TARGET_ARCH) |
5 | ifeq ($(TARGET_ARCH), x86_64) | |
6 | TARGET_BASE_ARCH:=i386 | |
7 | endif | |
540635ba TS |
8 | ifeq ($(TARGET_ARCH), mipsn32) |
9 | TARGET_BASE_ARCH:=mips | |
10 | endif | |
fbe4f65b TS |
11 | ifeq ($(TARGET_ARCH), mips64) |
12 | TARGET_BASE_ARCH:=mips | |
13 | endif | |
a2458627 FB |
14 | ifeq ($(TARGET_ARCH), ppc64) |
15 | TARGET_BASE_ARCH:=ppc | |
16 | endif | |
22f8a8b3 JM |
17 | ifeq ($(TARGET_ARCH), ppc64h) |
18 | TARGET_BASE_ARCH:=ppc | |
19 | endif | |
d4082e95 JM |
20 | ifeq ($(TARGET_ARCH), ppcemb) |
21 | TARGET_BASE_ARCH:=ppc | |
22 | endif | |
64b3ab24 FB |
23 | ifeq ($(TARGET_ARCH), sparc64) |
24 | TARGET_BASE_ARCH:=sparc | |
25 | endif | |
0b0babc6 | 26 | TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH) |
4fb240a4 | 27 | VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw |
46dc3881 | 28 | CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MT $@ -MP -DNEED_CPU_H |
0b0babc6 | 29 | #CFLAGS+=-Werror |
626df76a | 30 | LIBS= |
1e43adfc | 31 | # user emulator name |
0c64b9cd | 32 | ifndef TARGET_ARCH2 |
c91fde65 | 33 | TARGET_ARCH2=$(TARGET_ARCH) |
0c64b9cd | 34 | endif |
808c4954 FB |
35 | ifeq ($(TARGET_ARCH),arm) |
36 | ifeq ($(TARGET_WORDS_BIGENDIAN),yes) | |
c91fde65 | 37 | TARGET_ARCH2=armeb |
808c4954 | 38 | endif |
c91fde65 | 39 | endif |
908f52b0 PB |
40 | ifeq ($(TARGET_ARCH),sh4) |
41 | ifeq ($(TARGET_WORDS_BIGENDIAN),yes) | |
42 | TARGET_ARCH2=sh4eb | |
43 | endif | |
44 | endif | |
01f5e596 | 45 | ifeq ($(TARGET_ARCH),mips) |
c91fde65 FB |
46 | ifneq ($(TARGET_WORDS_BIGENDIAN),yes) |
47 | TARGET_ARCH2=mipsel | |
01f5e596 | 48 | endif |
01f5e596 | 49 | endif |
540635ba TS |
50 | ifeq ($(TARGET_ARCH),mipsn32) |
51 | ifneq ($(TARGET_WORDS_BIGENDIAN),yes) | |
52 | TARGET_ARCH2=mipsn32el | |
53 | endif | |
54 | endif | |
fbe4f65b TS |
55 | ifeq ($(TARGET_ARCH),mips64) |
56 | ifneq ($(TARGET_WORDS_BIGENDIAN),yes) | |
57 | TARGET_ARCH2=mips64el | |
58 | endif | |
59 | endif | |
40293e58 FB |
60 | |
61 | ifdef CONFIG_USER_ONLY | |
62 | # user emulator name | |
63 | QEMU_PROG=qemu-$(TARGET_ARCH2) | |
64 | else | |
1e43adfc | 65 | # system emulator name |
a541f297 | 66 | ifeq ($(TARGET_ARCH), i386) |
40293e58 | 67 | QEMU_PROG=qemu$(EXESUF) |
0db63474 | 68 | else |
40293e58 | 69 | QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF) |
a541f297 | 70 | endif |
de5eaa64 | 71 | endif |
626df76a | 72 | |
40293e58 | 73 | PROGS=$(QEMU_PROG) |
626df76a | 74 | |
6c041c54 | 75 | # cc-option |
c7328801 | 76 | # Usage: CFLAGS+=$(call cc-option, $(CFLAGS), -falign-functions=0, -malign-functions=0) |
6c041c54 | 77 | |
c7328801 AL |
78 | cc-option = $(shell if $(CC) $(1) $(2) -S -o /dev/null -xc /dev/null \ |
79 | > /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi ;) | |
6f30fa85 | 80 | |
40293e58 FB |
81 | HELPER_CFLAGS= |
82 | ||
626df76a | 83 | ifeq ($(ARCH),i386) |
6f30fa85 | 84 | HELPER_CFLAGS+=-fomit-frame-pointer |
bc51c5c9 FB |
85 | endif |
86 | ||
d19076fa | 87 | ifeq ($(subst ppc64,ppc,$(ARCH))$(TARGET_BASE_ARCH),ppcppc) |
88 | translate.o: CFLAGS := $(CFLAGS) $(call cc-option, $(CFLAGS), -fno-unit-at-a-time,) | |
89 | endif | |
90 | ||
626df76a | 91 | ifeq ($(ARCH),sparc) |
c7328801 | 92 | ifneq ($(CONFIG_SOLARIS),yes) |
40293e58 | 93 | HELPER_CFLAGS+=-ffixed-i0 |
3142255c | 94 | endif |
fdbb4691 | 95 | endif |
626df76a | 96 | |
626df76a | 97 | ifeq ($(ARCH),alpha) |
626df76a | 98 | # Ensure there's only a single GP |
40293e58 | 99 | CFLAGS+=-msmall-data |
626df76a FB |
100 | endif |
101 | ||
f54b3f92 | 102 | ifeq ($(ARCH),hppa) |
f54b3f92 AJ |
103 | BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld |
104 | endif | |
105 | ||
626df76a | 106 | ifeq ($(ARCH),ia64) |
40293e58 | 107 | CFLAGS+=-mno-sdata |
83fb7adf FB |
108 | endif |
109 | ||
40293e58 FB |
110 | CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS) |
111 | LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS) | |
626df76a | 112 | |
6f30fa85 | 113 | CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE |
4a244704 | 114 | CPPFLAGS+=-U_FORTIFY_SOURCE |
626df76a | 115 | LIBS+=-lm |
67b915a5 | 116 | ifdef CONFIG_WIN32 |
3db38e87 | 117 | LIBS+=-lwinmm -lws2_32 -liphlpapi |
67b915a5 | 118 | endif |
ec530c81 FB |
119 | ifdef CONFIG_SOLARIS |
120 | LIBS+=-lsocket -lnsl -lresolv | |
0475a5ca TS |
121 | ifdef NEEDS_LIBSUNMATH |
122 | LIBS+=-lsunmath | |
123 | LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib | |
40293e58 | 124 | CFLAGS+=-I/opt/SUNWspro/prod/include/cc |
f72b519c | 125 | endif |
831b7825 TS |
126 | endif |
127 | ||
7ba1e619 AL |
128 | kvm.o: CFLAGS+=$(KVM_CFLAGS) |
129 | kvm-all.o: CFLAGS+=$(KVM_CFLAGS) | |
130 | ||
40293e58 | 131 | all: $(PROGS) |
c2fb2637 PB |
132 | # Dummy command so that make thinks it has done something |
133 | @true | |
626df76a | 134 | |
40293e58 | 135 | ######################################################### |
626df76a | 136 | # cpu emulator library |
c9e0df73 | 137 | libobj-y = exec.o translate-all.o cpu-exec.o translate.o host-utils.o |
943e0a31 | 138 | libobj-$(CONFIG_KQEMU) += kqemu.o |
57fec1fe | 139 | # TCG code generator |
c9e0df73 | 140 | libobj-y += tcg/tcg.o tcg/tcg-runtime.o |
57fec1fe | 141 | CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH) |
8289b279 BS |
142 | ifeq ($(ARCH),sparc64) |
143 | CPPFLAGS+=-I$(SRC_PATH)/tcg/sparc | |
144 | endif | |
158142c2 | 145 | ifdef CONFIG_SOFTFLOAT |
c9e0df73 | 146 | libobj-y += fpu/softfloat.o |
158142c2 | 147 | else |
c9e0df73 | 148 | libobj-y += fpu/softfloat-native.o |
158142c2 | 149 | endif |
6f30fa85 | 150 | CPPFLAGS+=-I$(SRC_PATH)/fpu |
c9e0df73 | 151 | libobj-y += op_helper.o helper.o |
e95c8d51 | 152 | |
b7bcbe95 | 153 | ifeq ($(TARGET_BASE_ARCH), arm) |
c9e0df73 | 154 | libobj-y += neon_helper.o iwmmxt_helper.o |
e6e5906b PB |
155 | endif |
156 | ||
cf6c1b16 | 157 | ifeq ($(TARGET_BASE_ARCH), alpha) |
c9e0df73 | 158 | libobj-y += alpha_palcode.o |
cf6c1b16 JM |
159 | endif |
160 | ||
e7daa605 | 161 | ifeq ($(TARGET_BASE_ARCH), cris) |
c9e0df73 | 162 | libobj-y += cris-dis.o |
e7daa605 TS |
163 | |
164 | ifndef CONFIG_USER_ONLY | |
c9e0df73 | 165 | libobj-y += mmu.o |
e7daa605 TS |
166 | endif |
167 | endif | |
168 | ||
626df76a | 169 | # NOTE: the disassembler code is only needed for debugging |
c9e0df73 | 170 | libobj-y += disas.o |
626df76a | 171 | ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386) |
bc51c5c9 FB |
172 | USE_I386_DIS=y |
173 | endif | |
0b0babc6 | 174 | ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64) |
bc51c5c9 FB |
175 | USE_I386_DIS=y |
176 | endif | |
943e0a31 | 177 | libobj-$(USE_I386_DIS) += i386-dis.o |
626df76a | 178 | ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha) |
c9e0df73 | 179 | libobj-y += alpha-dis.o |
626df76a | 180 | endif |
a2458627 | 181 | ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc) |
c9e0df73 | 182 | libobj-y += ppc-dis.o |
626df76a | 183 | endif |
72b675ca | 184 | ifeq ($(findstring microblaze, $(TARGET_BASE_ARCH) $(ARCH)),microblaze) |
c9e0df73 | 185 | libobj-y += microblaze-dis.o |
72b675ca | 186 | ifndef CONFIG_USER_ONLY |
c9e0df73 | 187 | libobj-y += mmu.o |
72b675ca EI |
188 | endif |
189 | endif | |
fbe4f65b | 190 | ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips) |
c9e0df73 | 191 | libobj-y += mips-dis.o |
6af0bf9c | 192 | endif |
64b3ab24 | 193 | ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc) |
c9e0df73 | 194 | libobj-y += sparc-dis.o |
626df76a FB |
195 | endif |
196 | ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm) | |
c9e0df73 | 197 | libobj-y += arm-dis.o |
626df76a | 198 | endif |
48024e4a | 199 | ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k) |
c9e0df73 | 200 | libobj-y += m68k-dis.o |
48024e4a | 201 | endif |
fdf9b3e8 | 202 | ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4) |
c9e0df73 | 203 | libobj-y += sh4-dis.o |
fdf9b3e8 | 204 | endif |
f54b3f92 | 205 | ifeq ($(findstring hppa, $(TARGET_BASE_ARCH) $(ARCH)),hppa) |
c9e0df73 | 206 | libobj-y += hppa-dis.o |
f54b3f92 | 207 | endif |
8f860bb8 | 208 | ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390) |
c9e0df73 | 209 | libobj-y += s390-dis.o |
8f860bb8 | 210 | endif |
626df76a | 211 | |
40293e58 FB |
212 | # libqemu |
213 | ||
c9e0df73 | 214 | libqemu.a: $(libobj-y) |
40293e58 | 215 | |
86e840ee | 216 | translate.o: translate.c cpu.h |
40293e58 | 217 | |
86e840ee | 218 | translate-all.o: translate-all.c cpu.h |
40293e58 | 219 | |
86e840ee | 220 | tcg/tcg.o: cpu.h |
40293e58 FB |
221 | |
222 | # HELPER_CFLAGS is used for all the code compiled with static register | |
223 | # variables | |
807544e2 | 224 | op_helper.o: CFLAGS += $(HELPER_CFLAGS) $(I386_CFLAGS) |
40293e58 | 225 | |
807544e2 | 226 | cpu-exec.o: CFLAGS += $(HELPER_CFLAGS) |
40293e58 FB |
227 | |
228 | ######################################################### | |
229 | # Linux user emulator target | |
230 | ||
231 | ifdef CONFIG_LINUX_USER | |
232 | ||
40293e58 FB |
233 | ifndef TARGET_ABI_DIR |
234 | TARGET_ABI_DIR=$(TARGET_ARCH) | |
235 | endif | |
3ebdd119 | 236 | VPATH+=:$(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) |
40293e58 FB |
237 | CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) |
238 | ||
239 | ifdef CONFIG_STATIC | |
240 | LDFLAGS+=-static | |
241 | endif | |
242 | ||
243 | ifeq ($(ARCH),i386) | |
244 | ifdef TARGET_GPROF | |
245 | USE_I386_LD=y | |
246 | endif | |
247 | ifdef CONFIG_STATIC | |
248 | USE_I386_LD=y | |
249 | endif | |
250 | ifdef USE_I386_LD | |
251 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
252 | else | |
253 | # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object | |
254 | # that the kernel ELF loader considers as an executable. I think this | |
255 | # is the simplest way to make it self virtualizable! | |
256 | LDFLAGS+=-Wl,-shared | |
257 | endif | |
258 | endif | |
259 | ||
260 | ifeq ($(ARCH),x86_64) | |
261 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
262 | endif | |
263 | ||
264 | ifeq ($(ARCH),ppc) | |
265 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
266 | endif | |
267 | ||
810260a8 | 268 | ifeq ($(ARCH),ppc64) |
269 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
270 | endif | |
271 | ||
40293e58 FB |
272 | ifeq ($(ARCH),s390) |
273 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
274 | endif | |
275 | ||
276 | ifeq ($(ARCH),sparc) | |
277 | # -static is used to avoid g1/g3 usage by the dynamic linker | |
278 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static | |
279 | endif | |
280 | ||
281 | ifeq ($(ARCH),sparc64) | |
282 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
283 | endif | |
284 | ||
285 | ifeq ($(ARCH),alpha) | |
286 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
287 | endif | |
288 | ||
289 | ifeq ($(ARCH),ia64) | |
290 | LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
291 | endif | |
292 | ||
293 | ifeq ($(ARCH),arm) | |
294 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
295 | endif | |
296 | ||
297 | ifeq ($(ARCH),m68k) | |
298 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
299 | endif | |
300 | ||
301 | ifeq ($(ARCH),mips) | |
302 | ifeq ($(WORDS_BIGENDIAN),yes) | |
303 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
304 | else | |
305 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld | |
306 | endif | |
307 | endif | |
308 | ||
309 | ifeq ($(ARCH),mips64) | |
310 | ifeq ($(WORDS_BIGENDIAN),yes) | |
311 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
312 | else | |
313 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld | |
314 | endif | |
315 | endif | |
316 | ||
6d946cda AJ |
317 | # profiling code |
318 | ifdef TARGET_GPROF | |
319 | LDFLAGS+=-p | |
320 | CFLAGS+=-p | |
321 | endif | |
322 | ||
a8e492c0 | 323 | obj-y = main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \ |
322f9d01 | 324 | elfload.o linuxload.o uaccess.o envlist.o gdbstub.o gdbstub-xml.o |
e5d355d1 AL |
325 | LIBS+= $(PTHREADLIBS) |
326 | LIBS+= $(CLOCKLIBS) | |
943e0a31 JQ |
327 | obj-$(TARGET_HAS_BFLT) += flatload.o |
328 | ||
40293e58 | 329 | ifdef TARGET_HAS_ELFLOAD32 |
40293e58 FB |
330 | elfload32.o: elfload.c |
331 | endif | |
943e0a31 | 332 | obj-$(TARGET_HAS_ELFLOAD32) += elfload32.o |
40293e58 FB |
333 | |
334 | ifeq ($(TARGET_ARCH), i386) | |
a8e492c0 | 335 | obj-y += vm86.o |
40293e58 FB |
336 | endif |
337 | ifeq ($(TARGET_ARCH), arm) | |
a8e492c0 | 338 | obj-y += nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \ |
40293e58 FB |
339 | nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \ |
340 | nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o | |
341 | endif | |
342 | ifeq ($(TARGET_ARCH), m68k) | |
a8e492c0 | 343 | obj-y += m68k-sim.o m68k-semi.o |
40293e58 FB |
344 | endif |
345 | ||
40293e58 FB |
346 | # Note: this is a workaround. The real fix is to avoid compiling |
347 | # cpu_signal_handler() in cpu-exec.c. | |
807544e2 | 348 | signal.o: CFLAGS += $(HELPER_CFLAGS) |
626df76a | 349 | |
0bfe3ca5 | 350 | $(QEMU_PROG): ARLIBS=../libqemu_user.a libqemu.a |
a8e492c0 JQ |
351 | $(QEMU_PROG): $(obj-y) ../libqemu_user.a libqemu.a |
352 | $(call LINK,$(obj-y)) | |
626df76a FB |
353 | ifeq ($(ARCH),alpha) |
354 | # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of | |
355 | # the address space (31 bit so sign extending doesn't matter) | |
356 | echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc | |
357 | endif | |
358 | ||
40293e58 FB |
359 | endif #CONFIG_LINUX_USER |
360 | ||
361 | ######################################################### | |
362 | # Darwin user emulator target | |
363 | ||
364 | ifdef CONFIG_DARWIN_USER | |
365 | ||
366 | VPATH+=:$(SRC_PATH)/darwin-user | |
367 | CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH) | |
368 | ||
369 | # Leave some space for the regular program loading zone | |
370 | LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000 | |
371 | ||
372 | LIBS+=-lmx | |
373 | ||
a8e492c0 JQ |
374 | obj-y = main.o commpage.o machload.o mmap.o signal.o syscall.o thunk.o \ |
375 | gdbstub.o gdbstub-xml.o | |
40293e58 | 376 | |
40293e58 FB |
377 | # Note: this is a workaround. The real fix is to avoid compiling |
378 | # cpu_signal_handler() in cpu-exec.c. | |
807544e2 | 379 | signal.o: CFLAGS += $(HELPER_CFLAGS) |
40293e58 | 380 | |
0bfe3ca5 | 381 | $(QEMU_PROG): ARLIBS=libqemu.a |
a8e492c0 JQ |
382 | $(QEMU_PROG): $(obj-y) libqemu.a |
383 | $(call LINK,$(obj-y)) | |
40293e58 FB |
384 | |
385 | endif #CONFIG_DARWIN_USER | |
386 | ||
84778508 BS |
387 | ######################################################### |
388 | # BSD user emulator target | |
389 | ||
390 | ifdef CONFIG_BSD_USER | |
391 | ||
392 | VPATH+=:$(SRC_PATH)/bsd-user | |
393 | CPPFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH) | |
394 | ||
395 | ifdef CONFIG_STATIC | |
396 | LDFLAGS+=-static | |
397 | endif | |
398 | ||
399 | ifeq ($(ARCH),i386) | |
400 | ifdef TARGET_GPROF | |
401 | USE_I386_LD=y | |
402 | endif | |
403 | ifdef CONFIG_STATIC | |
404 | USE_I386_LD=y | |
405 | endif | |
406 | ifdef USE_I386_LD | |
407 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
408 | else | |
409 | # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object | |
410 | # that the kernel ELF loader considers as an executable. I think this | |
411 | # is the simplest way to make it self virtualizable! | |
412 | LDFLAGS+=-Wl,-shared | |
413 | endif | |
414 | endif | |
415 | ||
416 | ifeq ($(ARCH),x86_64) | |
417 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
418 | endif | |
419 | ||
420 | ifeq ($(ARCH),ppc) | |
421 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
422 | endif | |
423 | ||
424 | ifeq ($(ARCH),ppc64) | |
425 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
426 | endif | |
427 | ||
428 | ifeq ($(ARCH),s390) | |
429 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
430 | endif | |
431 | ||
432 | ifeq ($(ARCH),sparc) | |
433 | # -static is used to avoid g1/g3 usage by the dynamic linker | |
434 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static | |
435 | endif | |
436 | ||
437 | ifeq ($(ARCH),sparc64) | |
438 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
439 | endif | |
440 | ||
441 | ifeq ($(ARCH),alpha) | |
442 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
443 | endif | |
444 | ||
445 | ifeq ($(ARCH),ia64) | |
446 | LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
447 | endif | |
448 | ||
449 | ifeq ($(ARCH),arm) | |
450 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
451 | endif | |
452 | ||
453 | ifeq ($(ARCH),m68k) | |
454 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
455 | endif | |
456 | ||
457 | ifeq ($(ARCH),mips) | |
458 | ifeq ($(WORDS_BIGENDIAN),yes) | |
459 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
460 | else | |
461 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld | |
462 | endif | |
463 | endif | |
464 | ||
465 | ifeq ($(ARCH),mips64) | |
466 | ifeq ($(WORDS_BIGENDIAN),yes) | |
467 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
468 | else | |
469 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld | |
470 | endif | |
471 | endif | |
472 | ||
a8e492c0 JQ |
473 | obj-y = main.o bsdload.o elfload.o mmap.o path.o signal.o strace.o syscall.o \ |
474 | gdbstub.o gdbstub-xml.o | |
475 | obj-y += uaccess.o | |
84778508 | 476 | |
84778508 BS |
477 | # Note: this is a workaround. The real fix is to avoid compiling |
478 | # cpu_signal_handler() in cpu-exec.c. | |
807544e2 | 479 | signal.o: CFLAGS += $(HELPER_CFLAGS) |
84778508 | 480 | |
0bfe3ca5 | 481 | $(QEMU_PROG): ARLIBS=libqemu.a ../libqemu_user.a |
a8e492c0 JQ |
482 | $(QEMU_PROG): $(obj-y) libqemu.a ../libqemu_user.a |
483 | $(call LINK,$(obj-y)) | |
84778508 BS |
484 | |
485 | endif #CONFIG_BSD_USER | |
486 | ||
40293e58 FB |
487 | ######################################################### |
488 | # System emulator target | |
489 | ifndef CONFIG_USER_ONLY | |
490 | ||
a8e492c0 JQ |
491 | obj-y = vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o \ |
492 | gdbstub.o gdbstub-xml.o msix.o | |
1fd31ad7 AL |
493 | # virtio has to be here due to weird dependency between PCI and virtio-net. |
494 | # need to fix this properly | |
a8e492c0 JQ |
495 | obj-y += virtio-blk.o virtio-balloon.o virtio-net.o virtio-console.o |
496 | obj-$(CONFIG_KVM) += kvm.o kvm-all.o | |
a3392f9b | 497 | |
40293e58 | 498 | LIBS+=-lz |
1d14ffa9 | 499 | ifdef CONFIG_ALSA |
1d14ffa9 FB |
500 | LIBS += -lasound |
501 | endif | |
ca9cc28c AZ |
502 | ifdef CONFIG_ESD |
503 | LIBS += -lesd | |
504 | endif | |
b8e59f18 | 505 | ifdef CONFIG_PA |
506 | LIBS += -lpulse-simple | |
507 | endif | |
1d14ffa9 | 508 | ifdef CONFIG_DSOUND |
1d14ffa9 | 509 | LIBS += -lole32 -ldxguid |
85571bc7 | 510 | endif |
102a52e4 | 511 | ifdef CONFIG_FMOD |
102a52e4 | 512 | LIBS += $(CONFIG_FMOD_LIB) |
85571bc7 | 513 | endif |
2f6a1ab0 BS |
514 | ifdef CONFIG_OSS |
515 | LIBS += $(CONFIG_OSS_LIB) | |
516 | endif | |
4fb240a4 | 517 | |
b0f3b8fa | 518 | SOUND_HW = sb16.o es1370.o ac97.o |
1d14ffa9 FB |
519 | ifdef CONFIG_ADLIB |
520 | SOUND_HW += fmopl.o adlib.o | |
c40e866f | 521 | adlib.o fmopl.o: CFLAGS := ${CFLAGS} -DBUILD_Y8950=0 |
1d14ffa9 | 522 | endif |
423d65f4 AZ |
523 | ifdef CONFIG_GUS |
524 | SOUND_HW += gus.o gusemu_hal.o gusemu_mixer.o | |
525 | endif | |
cc53d26d | 526 | ifdef CONFIG_CS4231A |
527 | SOUND_HW += cs4231a.o | |
528 | endif | |
85571bc7 | 529 | |
8d5d2d4c TS |
530 | ifdef CONFIG_VNC_TLS |
531 | CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS) | |
532 | LIBS += $(CONFIG_VNC_TLS_LIBS) | |
533 | endif | |
534 | ||
2f9606b3 AL |
535 | ifdef CONFIG_VNC_SASL |
536 | CPPFLAGS += $(CONFIG_VNC_SASL_CFLAGS) | |
537 | LIBS += $(CONFIG_VNC_SASL_LIBS) | |
538 | endif | |
539 | ||
fb599c9a AZ |
540 | ifdef CONFIG_BLUEZ |
541 | LIBS += $(CONFIG_BLUEZ_LIBS) | |
542 | endif | |
543 | ||
e37630ca | 544 | # xen backend driver support |
943e0a31 | 545 | obj-$(CONFIG_XEN) += xen_machine_pv.o xen_domainbuild.o |
e37630ca | 546 | ifeq ($(CONFIG_XEN), yes) |
e37630ca AL |
547 | LIBS += $(XEN_LIBS) |
548 | endif | |
549 | ||
a594cfbf | 550 | # USB layer |
a8e492c0 | 551 | obj-y += usb-ohci.o |
a594cfbf | 552 | |
a41b2ff2 | 553 | # PCI network cards |
a8e492c0 JQ |
554 | obj-y += eepro100.o |
555 | obj-y += ne2000.o | |
556 | obj-y += pcnet.o | |
557 | obj-y += rtl8139.o | |
558 | obj-y += e1000.o | |
a41b2ff2 | 559 | |
9dd986cc | 560 | # Generic watchdog support and some watchdog devices |
a8e492c0 | 561 | obj-y += wdt_ib700.o wdt_i6300esb.o |
9dd986cc | 562 | |
0b0babc6 | 563 | ifeq ($(TARGET_BASE_ARCH), i386) |
a541f297 | 564 | # Hardware support |
a8e492c0 JQ |
565 | obj-y += ide.o pckbd.o vga.o $(SOUND_HW) dma.o |
566 | obj-y += fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o | |
567 | obj-y += cirrus_vga.o apic.o ioapic.o parallel.o acpi.o piix_pci.o | |
568 | obj-y += usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o | |
569 | obj-y += device-hotplug.o pci-hotplug.o smbios.o | |
b00052e4 | 570 | CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE |
67b915a5 | 571 | endif |
a2458627 | 572 | ifeq ($(TARGET_BASE_ARCH), ppc) |
70ad3dec | 573 | CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE |
3cbee15b | 574 | # shared objects |
a8e492c0 | 575 | obj-y += ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o |
3cbee15b | 576 | # PREP target |
a8e492c0 JQ |
577 | obj-y += pckbd.o serial.o i8259.o i8254.o fdc.o mc146818rtc.o |
578 | obj-y += prep_pci.o ppc_prep.o | |
3cbee15b | 579 | # Mac shared devices |
a8e492c0 | 580 | obj-y += macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o |
3cbee15b | 581 | # OldWorld PowerMac |
a8e492c0 | 582 | obj-y += heathrow_pic.o grackle_pci.o ppc_oldworld.o |
3cbee15b | 583 | # NewWorld PowerMac |
a8e492c0 | 584 | obj-y += unin_pci.o ppc_newworld.o |
3cbee15b | 585 | # PowerPC 4xx boards |
a8e492c0 JQ |
586 | obj-y += pflash_cfi02.o ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o |
587 | obj-y += ppc440.o ppc440_bamboo.o | |
74c62ba8 | 588 | # PowerPC E500 boards |
a8e492c0 | 589 | obj-y += ppce500_pci.o ppce500_mpc8544ds.o |
f652e6af | 590 | ifdef FDT_LIBS |
a8e492c0 | 591 | obj-y += device_tree.o |
f652e6af AJ |
592 | LIBS+= $(FDT_LIBS) |
593 | endif | |
943e0a31 | 594 | obj-$(CONFIG_KVM) += kvm_ppc.o |
a541f297 | 595 | endif |
fbe4f65b | 596 | ifeq ($(TARGET_BASE_ARCH), mips) |
a8e492c0 JQ |
597 | obj-y += mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o |
598 | obj-y += mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o rc4030.o | |
599 | obj-y += g364fb.o jazz_led.o dp8393x.o | |
600 | obj-y += ide.o gt64xxx.o pckbd.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o | |
601 | obj-y += piix_pci.o parallel.o cirrus_vga.o pcspk.o $(SOUND_HW) | |
602 | obj-y += mipsnet.o | |
603 | obj-y += pflash_cfi01.o | |
604 | obj-y += vmware_vga.o | |
4ce7ff6e | 605 | CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE |
6af0bf9c | 606 | endif |
72b675ca | 607 | ifeq ($(TARGET_BASE_ARCH), microblaze) |
a8e492c0 | 608 | obj-y += petalogix_s3adsp1800_mmu.o |
72b675ca | 609 | |
a8e492c0 JQ |
610 | obj-y += microblaze_pic_cpu.o |
611 | obj-y += xilinx_intc.o | |
612 | obj-y += xilinx_timer.o | |
613 | obj-y += xilinx_uartlite.o | |
614 | obj-y += xilinx_ethlite.o | |
72b675ca | 615 | |
a8e492c0 | 616 | obj-y += pflash_cfi02.o |
72b675ca | 617 | ifdef FDT_LIBS |
a8e492c0 | 618 | obj-y += device_tree.o |
72b675ca EI |
619 | LIBS+= $(FDT_LIBS) |
620 | endif | |
621 | endif | |
e7daa605 | 622 | ifeq ($(TARGET_BASE_ARCH), cris) |
10c144e2 | 623 | # Boards |
a8e492c0 | 624 | obj-y += cris_pic_cpu.o etraxfs.o axis_dev88.o |
10c144e2 EI |
625 | |
626 | # IO blocks | |
a8e492c0 JQ |
627 | obj-y += etraxfs_dma.o |
628 | obj-y += etraxfs_pic.o | |
629 | obj-y += etraxfs_eth.o | |
630 | obj-y += etraxfs_timer.o | |
631 | obj-y += etraxfs_ser.o | |
e62b5b13 | 632 | |
a8e492c0 | 633 | obj-y += pflash_cfi02.o |
e7daa605 | 634 | endif |
64b3ab24 | 635 | ifeq ($(TARGET_BASE_ARCH), sparc) |
3475187d | 636 | ifeq ($(TARGET_ARCH), sparc64) |
a8e492c0 JQ |
637 | obj-y += sun4u.o ide.o pckbd.o vga.o apb_pci.o |
638 | obj-y += fdc.o mc146818rtc.o serial.o | |
639 | obj-y += cirrus_vga.o parallel.o | |
3475187d | 640 | else |
a8e492c0 JQ |
641 | obj-y += sun4m.o tcx.o iommu.o slavio_intctl.o |
642 | obj-y += slavio_timer.o slavio_misc.o fdc.o sparc32_dma.o | |
643 | obj-y += cs4231.o eccmemctl.o sbi.o sun4c_intctl.o | |
3475187d | 644 | endif |
e95c8d51 | 645 | endif |
b5ff1b31 | 646 | ifeq ($(TARGET_BASE_ARCH), arm) |
a8e492c0 JQ |
647 | obj-y += integratorcp.o versatilepb.o smc91c111.o arm_pic.o arm_timer.o |
648 | obj-y += arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o | |
649 | obj-y += versatile_pci.o | |
650 | obj-y += realview_gic.o realview.o arm_sysctl.o mpcore.o | |
651 | obj-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o | |
652 | obj-y += pl061.o | |
653 | obj-y += arm-semi.o | |
654 | obj-y += pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o | |
655 | obj-y += pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o | |
656 | obj-y += pflash_cfi01.o gumstix.o | |
657 | obj-y += zaurus.o ide.o serial.o spitz.o tosa.o tc6393xb.o | |
658 | obj-y += omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o | |
659 | obj-y += omap2.o omap_dss.o soc_dma.o | |
660 | obj-y += omap_sx1.o palm.o tsc210x.o | |
661 | obj-y += nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o | |
662 | obj-y += mst_fpga.o mainstone.o | |
663 | obj-y += musicpal.o pflash_cfi02.o | |
664 | obj-y += framebuffer.o | |
665 | obj-y += syborg.o syborg_fb.o syborg_interrupt.o syborg_keyboard.o | |
666 | obj-y += syborg_serial.o syborg_timer.o syborg_pointer.o syborg_rtc.o | |
667 | obj-y += syborg_virtio.o | |
5a1237c4 | 668 | CPPFLAGS += -DHAS_AUDIO |
b5ff1b31 | 669 | endif |
fdf9b3e8 | 670 | ifeq ($(TARGET_BASE_ARCH), sh4) |
a8e492c0 JQ |
671 | obj-y += shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o |
672 | obj-y += sh_timer.o sh_serial.o sh_intc.o sh_pci.o sm501.o serial.o | |
673 | obj-y += ide.o | |
fdf9b3e8 | 674 | endif |
0633879f | 675 | ifeq ($(TARGET_BASE_ARCH), m68k) |
a8e492c0 JQ |
676 | obj-y += an5206.o mcf5206.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o |
677 | obj-y += m68k-semi.o dummy_m68k.o | |
0633879f | 678 | endif |
5b0753e0 | 679 | ifdef CONFIG_COCOA |
1d14ffa9 FB |
680 | COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit |
681 | ifdef CONFIG_COREAUDIO | |
682 | COCOA_LIBS+=-framework CoreAudio | |
683 | endif | |
5b0753e0 | 684 | endif |
7c1f25b4 | 685 | ifdef CONFIG_SLIRP |
6f30fa85 | 686 | CPPFLAGS+=-I$(SRC_PATH)/slirp |
626df76a FB |
687 | endif |
688 | ||
e5d355d1 AL |
689 | LIBS+=$(PTHREADLIBS) |
690 | LIBS+=$(CLOCKLIBS) | |
c321f673 | 691 | # specific flags are needed for non soft mmu emulator |
c321f673 | 692 | ifdef CONFIG_STATIC |
40293e58 | 693 | LDFLAGS+=-static |
de5eaa64 | 694 | endif |
83fb7adf | 695 | ifndef CONFIG_DARWIN |
11d9f695 | 696 | ifndef CONFIG_WIN32 |
ec530c81 | 697 | ifndef CONFIG_SOLARIS |
b29fe3ed | 698 | ifndef CONFIG_AIX |
40293e58 | 699 | LIBS+=-lutil |
11d9f695 | 700 | endif |
b29fe3ed | 701 | endif |
83fb7adf | 702 | endif |
ec530c81 | 703 | endif |
e3086fbf | 704 | ifdef TARGET_GPROF |
40293e58 FB |
705 | vl.o: CFLAGS+=-p |
706 | LDFLAGS+=-p | |
e3086fbf | 707 | endif |
c321f673 | 708 | |
b8076a74 | 709 | ifeq ($(ARCH),ia64) |
40293e58 | 710 | LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld |
74ccb34e FB |
711 | endif |
712 | ||
1d14ffa9 FB |
713 | ifdef CONFIG_WIN32 |
714 | SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole | |
715 | endif | |
716 | ||
40293e58 FB |
717 | # profiling code |
718 | ifdef TARGET_GPROF | |
719 | LDFLAGS+=-p | |
720 | main.o: CFLAGS+=-p | |
6e1b3e4d FB |
721 | endif |
722 | ||
537fe2d6 AL |
723 | vl.o: CFLAGS+=$(SDL_CFLAGS) |
724 | ||
5824d651 BS |
725 | vl.o: qemu-options.h |
726 | ||
2313086a BS |
727 | monitor.o: qemu-monitor.h |
728 | ||
769ce76d | 729 | $(QEMU_PROG): LIBS += $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS) $(CURL_LIBS) |
79eb76ad | 730 | $(QEMU_PROG): ARLIBS=../libqemu_common.a libqemu.a $(HWLIB) |
a8e492c0 JQ |
731 | $(QEMU_PROG): $(obj-y) ../libqemu_common.a libqemu.a $(HWLIB) |
732 | $(call LINK,$(obj-y)) | |
626df76a | 733 | |
40293e58 | 734 | endif # !CONFIG_USER_ONLY |
00a67ba1 | 735 | |
56aebc89 | 736 | gdbstub-xml.c: $(TARGET_XML_FILES) feature_to_c.sh |
56aebc89 | 737 | ifeq ($(TARGET_XML_FILES),) |
1aef4c57 | 738 | $(call quiet-command,rm -f $@ && echo > $@," GEN $(TARGET_DIR)$@") |
56aebc89 | 739 | else |
1aef4c57 | 740 | $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/feature_to_c.sh $@ $(TARGET_XML_FILES)," GEN $(TARGET_DIR)$@") |
56aebc89 PB |
741 | endif |
742 | ||
5824d651 | 743 | qemu-options.h: $(SRC_PATH)/qemu-options.hx |
0d00e563 | 744 | $(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@") |
5824d651 | 745 | |
2313086a BS |
746 | qemu-monitor.h: $(SRC_PATH)/qemu-monitor.hx |
747 | $(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@") | |
748 | ||
626df76a | 749 | clean: |
2313086a | 750 | rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o |
57fec1fe | 751 | rm -f *.d */*.d tcg/*.o |
2313086a | 752 | rm -f qemu-options.h qemu-monitor.h gdbstub-xml.c |
1e43adfc | 753 | |
5fafdf24 | 754 | install: all |
9b14bb04 | 755 | ifneq ($(PROGS),) |
1625af87 | 756 | $(INSTALL) -m 755 $(STRIP_OPT) $(PROGS) "$(DESTDIR)$(bindir)" |
9b14bb04 | 757 | endif |
626df76a | 758 | |
2f96c28d JM |
759 | # Include automatically generated dependency files |
760 | -include $(wildcard *.d */*.d) |