Consolidate compiler invocations (Avi Kivity)
[qemu] / Makefile.target
1 include config.mak
2
3 TARGET_BASE_ARCH:=$(TARGET_ARCH)
4 ifeq ($(TARGET_ARCH), x86_64)
5 TARGET_BASE_ARCH:=i386
6 endif
7 ifeq ($(TARGET_ARCH), mipsn32)
8 TARGET_BASE_ARCH:=mips
9 endif
10 ifeq ($(TARGET_ARCH), mips64)
11 TARGET_BASE_ARCH:=mips
12 endif
13 ifeq ($(TARGET_ARCH), ppc64)
14 TARGET_BASE_ARCH:=ppc
15 endif
16 ifeq ($(TARGET_ARCH), ppc64h)
17 TARGET_BASE_ARCH:=ppc
18 endif
19 ifeq ($(TARGET_ARCH), ppcemb)
20 TARGET_BASE_ARCH:=ppc
21 endif
22 ifeq ($(TARGET_ARCH), sparc64)
23 TARGET_BASE_ARCH:=sparc
24 endif
25 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
26 VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw
27 CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MT $@ -MP -DNEED_CPU_H
28 #CFLAGS+=-Werror
29 LIBS=
30 # user emulator name
31 ifndef TARGET_ARCH2
32 TARGET_ARCH2=$(TARGET_ARCH)
33 endif
34 ifeq ($(TARGET_ARCH),arm)
35   ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
36     TARGET_ARCH2=armeb
37   endif
38 endif
39 ifeq ($(TARGET_ARCH),sh4)
40   ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
41     TARGET_ARCH2=sh4eb
42   endif
43 endif
44 ifeq ($(TARGET_ARCH),mips)
45   ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
46     TARGET_ARCH2=mipsel
47   endif
48 endif
49 ifeq ($(TARGET_ARCH),mipsn32)
50   ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
51     TARGET_ARCH2=mipsn32el
52   endif
53 endif
54 ifeq ($(TARGET_ARCH),mips64)
55   ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
56     TARGET_ARCH2=mips64el
57   endif
58 endif
59
60 ifdef CONFIG_USER_ONLY
61 # user emulator name
62 QEMU_PROG=qemu-$(TARGET_ARCH2)
63 else
64 # system emulator name
65 ifeq ($(TARGET_ARCH), i386)
66 QEMU_PROG=qemu$(EXESUF)
67 else
68 QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF)
69 endif
70 endif
71
72 PROGS=$(QEMU_PROG)
73
74 # cc-option
75 # Usage: CFLAGS+=$(call cc-option, $(CFLAGS), -falign-functions=0, -malign-functions=0)
76
77 cc-option = $(shell if $(CC) $(1) $(2) -S -o /dev/null -xc /dev/null \
78               > /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi ;)
79
80 HELPER_CFLAGS=
81
82 ifeq ($(ARCH),i386)
83 HELPER_CFLAGS+=-fomit-frame-pointer
84 endif
85
86 ifeq ($(ARCH),sparc)
87   CFLAGS+=-ffixed-g2 -ffixed-g3
88   ifneq ($(CONFIG_SOLARIS),yes)
89     CFLAGS+=-ffixed-g1 -ffixed-g6
90     HELPER_CFLAGS+=-ffixed-i0
91   endif
92 endif
93
94 ifeq ($(ARCH),sparc64)
95   ifneq ($(CONFIG_SOLARIS),yes)
96     CFLAGS+=-ffixed-g5 -ffixed-g6 -ffixed-g7
97   else
98     CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
99   endif
100 endif
101
102 ifeq ($(ARCH),alpha)
103 # Ensure there's only a single GP
104 CFLAGS+=-msmall-data
105 endif
106
107 ifeq ($(ARCH),hppa)
108 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
109 endif
110
111 ifeq ($(ARCH),ia64)
112 CFLAGS+=-mno-sdata
113 endif
114
115 CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
116 LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS)
117
118 CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
119 LIBS+=-lm
120 ifdef CONFIG_WIN32
121 LIBS+=-lwinmm -lws2_32 -liphlpapi
122 endif
123 ifdef CONFIG_SOLARIS
124 LIBS+=-lsocket -lnsl -lresolv
125 ifdef NEEDS_LIBSUNMATH
126 LIBS+=-lsunmath
127 LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib
128 CFLAGS+=-I/opt/SUNWspro/prod/include/cc
129 endif
130 endif
131
132 kvm.o: CFLAGS+=$(KVM_CFLAGS)
133 kvm-all.o: CFLAGS+=$(KVM_CFLAGS)
134
135 all: $(PROGS)
136
137 #########################################################
138 # cpu emulator library
139 LIBOBJS=exec.o kqemu.o translate-all.o cpu-exec.o\
140         translate.o host-utils.o
141 # TCG code generator
142 LIBOBJS+= tcg/tcg.o tcg/tcg-runtime.o
143 CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH)
144 ifeq ($(ARCH),sparc64)
145 CPPFLAGS+=-I$(SRC_PATH)/tcg/sparc
146 endif
147 ifdef CONFIG_SOFTFLOAT
148 LIBOBJS+=fpu/softfloat.o
149 else
150 LIBOBJS+=fpu/softfloat-native.o
151 endif
152 CPPFLAGS+=-I$(SRC_PATH)/fpu
153 LIBOBJS+= op_helper.o helper.o
154
155 ifeq ($(TARGET_BASE_ARCH), arm)
156 LIBOBJS+= neon_helper.o iwmmxt_helper.o
157 endif
158
159 ifeq ($(TARGET_BASE_ARCH), alpha)
160 LIBOBJS+= alpha_palcode.o
161 endif
162
163 ifeq ($(TARGET_BASE_ARCH), cris)
164 LIBOBJS+= cris-dis.o
165
166 ifndef CONFIG_USER_ONLY
167 LIBOBJS+= mmu.o
168 endif
169 endif
170
171 # NOTE: the disassembler code is only needed for debugging
172 LIBOBJS+=disas.o
173 ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
174 USE_I386_DIS=y
175 endif
176 ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
177 USE_I386_DIS=y
178 endif
179 ifdef USE_I386_DIS
180 LIBOBJS+=i386-dis.o
181 endif
182 ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
183 LIBOBJS+=alpha-dis.o
184 endif
185 ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
186 LIBOBJS+=ppc-dis.o
187 endif
188 ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips)
189 LIBOBJS+=mips-dis.o
190 endif
191 ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
192 LIBOBJS+=sparc-dis.o
193 endif
194 ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
195 LIBOBJS+=arm-dis.o
196 endif
197 ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
198 LIBOBJS+=m68k-dis.o
199 endif
200 ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
201 LIBOBJS+=sh4-dis.o
202 endif
203 ifeq ($(findstring hppa, $(TARGET_BASE_ARCH) $(ARCH)),hppa)
204 LIBOBJS+=hppa-dis.o
205 endif
206 ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390)
207 LIBOBJS+=s390-dis.o
208 endif
209
210 # libqemu
211
212 libqemu.a: $(LIBOBJS)
213         rm -f $@
214         $(AR) rcs $@ $(LIBOBJS)
215
216 translate.o: translate.c cpu.h
217
218 translate-all.o: translate-all.c cpu.h
219
220 tcg/tcg.o: cpu.h
221
222 # HELPER_CFLAGS is used for all the code compiled with static register
223 # variables
224 op_helper.o: CFLAGS += $(HELPER_CFLAGS) $(I386_CFLAGS)
225
226 cpu-exec.o: CFLAGS += $(HELPER_CFLAGS)
227
228 #########################################################
229 # Linux user emulator target
230
231 ifdef CONFIG_LINUX_USER
232
233 ifndef TARGET_ABI_DIR
234   TARGET_ABI_DIR=$(TARGET_ARCH)
235 endif
236 VPATH+=:$(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
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
268 ifeq ($(ARCH),ppc64)
269 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
270 endif
271
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
317 # profiling code
318 ifdef TARGET_GPROF
319 LDFLAGS+=-p
320 CFLAGS+=-p
321 endif
322
323 OBJS= main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \
324       elfload.o linuxload.o uaccess.o
325 LIBS+= $(AIOLIBS)
326 ifdef TARGET_HAS_BFLT
327 OBJS+= flatload.o
328 endif
329 ifdef TARGET_HAS_ELFLOAD32
330 OBJS+= elfload32.o
331 elfload32.o: elfload.c
332 endif
333
334 ifeq ($(TARGET_ARCH), i386)
335 OBJS+= vm86.o
336 endif
337 ifeq ($(TARGET_ARCH), arm)
338 OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
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)
343 OBJS+= m68k-sim.o m68k-semi.o
344 endif
345
346 ifdef CONFIG_GDBSTUB
347 OBJS+=gdbstub.o gdbstub-xml.o
348 endif
349
350 OBJS+= libqemu.a
351
352 # Note: this is a workaround. The real fix is to avoid compiling
353 # cpu_signal_handler() in cpu-exec.c.
354 signal.o: CFLAGS += $(HELPER_CFLAGS)
355
356 $(QEMU_PROG): $(OBJS) ../libqemu_user.a
357         $(CC) $(LDFLAGS) -o $@ $^  $(LIBS)
358 ifeq ($(ARCH),alpha)
359 # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
360 # the address space (31 bit so sign extending doesn't matter)
361         echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
362 endif
363
364 endif #CONFIG_LINUX_USER
365
366 #########################################################
367 # Darwin user emulator target
368
369 ifdef CONFIG_DARWIN_USER
370
371 VPATH+=:$(SRC_PATH)/darwin-user
372 CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
373
374 # Leave some space for the regular program loading zone
375 LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000
376
377 LIBS+=-lmx
378
379 OBJS= main.o commpage.o machload.o mmap.o signal.o syscall.o thunk.o
380
381 OBJS+= libqemu.a
382
383 ifdef CONFIG_GDBSTUB
384 OBJS+=gdbstub.o gdbstub-xml.o
385 endif
386
387 # Note: this is a workaround. The real fix is to avoid compiling
388 # cpu_signal_handler() in cpu-exec.c.
389 signal.o: CFLAGS += $(HELPER_CFLAGS)
390
391 $(QEMU_PROG): $(OBJS)
392         $(CC) $(LDFLAGS) -o $@ $^  $(LIBS)
393
394 endif #CONFIG_DARWIN_USER
395
396 #########################################################
397 # BSD user emulator target
398
399 ifdef CONFIG_BSD_USER
400
401 VPATH+=:$(SRC_PATH)/bsd-user
402 CPPFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
403
404 ifdef CONFIG_STATIC
405 LDFLAGS+=-static
406 endif
407
408 ifeq ($(ARCH),i386)
409 ifdef TARGET_GPROF
410 USE_I386_LD=y
411 endif
412 ifdef CONFIG_STATIC
413 USE_I386_LD=y
414 endif
415 ifdef USE_I386_LD
416 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
417 else
418 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
419 # that the kernel ELF loader considers as an executable. I think this
420 # is the simplest way to make it self virtualizable!
421 LDFLAGS+=-Wl,-shared
422 endif
423 endif
424
425 ifeq ($(ARCH),x86_64)
426 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
427 endif
428
429 ifeq ($(ARCH),ppc)
430 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
431 endif
432
433 ifeq ($(ARCH),ppc64)
434 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
435 endif
436
437 ifeq ($(ARCH),s390)
438 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
439 endif
440
441 ifeq ($(ARCH),sparc)
442 # -static is used to avoid g1/g3 usage by the dynamic linker
443 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
444 endif
445
446 ifeq ($(ARCH),sparc64)
447 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
448 endif
449
450 ifeq ($(ARCH),alpha)
451 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
452 endif
453
454 ifeq ($(ARCH),ia64)
455 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
456 endif
457
458 ifeq ($(ARCH),arm)
459 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
460 endif
461
462 ifeq ($(ARCH),m68k)
463 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
464 endif
465
466 ifeq ($(ARCH),mips)
467 ifeq ($(WORDS_BIGENDIAN),yes)
468 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
469 else
470 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
471 endif
472 endif
473
474 ifeq ($(ARCH),mips64)
475 ifeq ($(WORDS_BIGENDIAN),yes)
476 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
477 else
478 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
479 endif
480 endif
481
482 OBJS= main.o bsdload.o elfload.o mmap.o path.o signal.o strace.o syscall.o
483 OBJS+= uaccess.o
484
485 OBJS+= libqemu.a
486
487 ifdef CONFIG_GDBSTUB
488 OBJS+=gdbstub.o
489 endif
490
491 # Note: this is a workaround. The real fix is to avoid compiling
492 # cpu_signal_handler() in cpu-exec.c.
493 signal.o: CFLAGS += $(HELPER_CFLAGS)
494
495 $(QEMU_PROG): $(OBJS) ../libqemu_user.a
496         $(CC) $(LDFLAGS) -o $@ $^  $(LIBS)
497
498 endif #CONFIG_BSD_USER
499
500 #########################################################
501 # System emulator target
502 ifndef CONFIG_USER_ONLY
503
504 OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o
505 # virtio has to be here due to weird dependency between PCI and virtio-net.
506 # need to fix this properly
507 OBJS+=virtio.o virtio-blk.o virtio-balloon.o virtio-net.o virtio-console.o
508 OBJS+=fw_cfg.o
509 ifdef CONFIG_KVM
510 OBJS+=kvm.o kvm-all.o
511 endif
512 ifdef CONFIG_WIN32
513 OBJS+=block-raw-win32.o
514 else
515 ifdef CONFIG_AIO
516 OBJS+=posix-aio-compat.o
517 endif
518 OBJS+=block-raw-posix.o
519 endif
520
521 LIBS+=-lz
522 ifdef CONFIG_ALSA
523 LIBS += -lasound
524 endif
525 ifdef CONFIG_ESD
526 LIBS += -lesd
527 endif
528 ifdef CONFIG_PA
529 LIBS += -lpulse-simple
530 endif
531 ifdef CONFIG_DSOUND
532 LIBS += -lole32 -ldxguid
533 endif
534 ifdef CONFIG_FMOD
535 LIBS += $(CONFIG_FMOD_LIB)
536 endif
537 ifdef CONFIG_OSS
538 LIBS += $(CONFIG_OSS_LIB)
539 endif
540
541 SOUND_HW = sb16.o es1370.o ac97.o
542 ifdef CONFIG_ADLIB
543 SOUND_HW += fmopl.o adlib.o
544 adlib.o fmopl.o: CFLAGS := ${CFLAGS} -DBUILD_Y8950=0
545 endif
546 ifdef CONFIG_GUS
547 SOUND_HW += gus.o gusemu_hal.o gusemu_mixer.o
548 endif
549 ifdef CONFIG_CS4231A
550 SOUND_HW += cs4231a.o
551 endif
552
553 ifdef CONFIG_VNC_TLS
554 CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
555 LIBS += $(CONFIG_VNC_TLS_LIBS)
556 endif
557
558 ifdef CONFIG_BLUEZ
559 LIBS += $(CONFIG_BLUEZ_LIBS)
560 endif
561
562 # SCSI layer
563 OBJS+= lsi53c895a.o esp.o
564
565 # USB layer
566 OBJS+= usb-ohci.o
567
568 # EEPROM emulation
569 OBJS += eeprom93xx.o
570
571 # PCI network cards
572 OBJS += eepro100.o
573 OBJS += ne2000.o
574 OBJS += pcnet.o
575 OBJS += rtl8139.o
576 OBJS += e1000.o
577
578 ifeq ($(TARGET_BASE_ARCH), i386)
579 # Hardware support
580 OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o
581 OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
582 OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o
583 OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
584 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
585 endif
586 ifeq ($(TARGET_BASE_ARCH), ppc)
587 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
588 # shared objects
589 OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o
590 # PREP target
591 OBJS+= pckbd.o ps2.o serial.o i8259.o i8254.o fdc.o m48t59.o mc146818rtc.o
592 OBJS+= prep_pci.o ppc_prep.o
593 # Mac shared devices
594 OBJS+= macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o escc.o
595 # OldWorld PowerMac
596 OBJS+= heathrow_pic.o grackle_pci.o ppc_oldworld.o
597 # NewWorld PowerMac
598 OBJS+= unin_pci.o ppc_chrp.o
599 # PowerPC 4xx boards
600 OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o
601 OBJS+= ppc440.o ppc440_bamboo.o
602 ifdef FDT_LIBS
603 OBJS+= device_tree.o
604 LIBS+= $(FDT_LIBS)
605 endif
606 ifdef CONFIG_KVM
607 OBJS+= kvm_ppc.o
608 endif
609 endif
610 ifeq ($(TARGET_BASE_ARCH), mips)
611 OBJS+= mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o
612 OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o rc4030.o
613 OBJS+= g364fb.o jazz_led.o
614 OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
615 OBJS+= piix_pci.o parallel.o cirrus_vga.o pcspk.o $(SOUND_HW)
616 OBJS+= mipsnet.o
617 OBJS+= pflash_cfi01.o
618 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
619 endif
620 ifeq ($(TARGET_BASE_ARCH), cris)
621 # Boards
622 OBJS+= etraxfs.o axis_dev88.o
623
624 # IO blocks
625 OBJS+= etraxfs_dma.o
626 OBJS+= etraxfs_pic.o
627 OBJS+= etraxfs_eth.o
628 OBJS+= etraxfs_timer.o
629 OBJS+= etraxfs_ser.o
630
631 OBJS+= ptimer.o
632 OBJS+= pflash_cfi02.o nand.o
633 endif
634 ifeq ($(TARGET_BASE_ARCH), sparc)
635 ifeq ($(TARGET_ARCH), sparc64)
636 OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o
637 OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o
638 OBJS+= cirrus_vga.o parallel.o ptimer.o
639 else
640 OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o
641 OBJS+= slavio_timer.o escc.o slavio_misc.o fdc.o sparc32_dma.o
642 OBJS+= cs4231.o ptimer.o eccmemctl.o sbi.o sun4c_intctl.o
643 endif
644 endif
645 ifeq ($(TARGET_BASE_ARCH), arm)
646 OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o
647 OBJS+= arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
648 OBJS+= versatile_pci.o ptimer.o
649 OBJS+= realview_gic.o realview.o arm_sysctl.o mpcore.o
650 OBJS+= armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
651 OBJS+= pl061.o
652 OBJS+= arm-semi.o
653 OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
654 OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
655 OBJS+= pflash_cfi01.o gumstix.o
656 OBJS+= zaurus.o ide.o serial.o nand.o ecc.o spitz.o tosa.o tc6393xb.o
657 OBJS+= omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o
658 OBJS+= omap2.o omap_dss.o soc_dma.o
659 OBJS+= omap_sx1.o palm.o tsc210x.o
660 OBJS+= nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o
661 OBJS+= tsc2005.o bt-hci-csr.o
662 OBJS+= mst_fpga.o mainstone.o
663 OBJS+= musicpal.o pflash_cfi02.o
664 CPPFLAGS += -DHAS_AUDIO
665 endif
666 ifeq ($(TARGET_BASE_ARCH), sh4)
667 OBJS+= shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
668 OBJS+= sh_timer.o ptimer.o sh_serial.o sh_intc.o sh_pci.o sm501.o serial.o
669 OBJS+= ide.o
670 endif
671 ifeq ($(TARGET_BASE_ARCH), m68k)
672 OBJS+= an5206.o mcf5206.o ptimer.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
673 OBJS+= m68k-semi.o dummy_m68k.o
674 endif
675 ifdef CONFIG_GDBSTUB
676 OBJS+=gdbstub.o gdbstub-xml.o
677 endif
678 ifdef CONFIG_COCOA
679 COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
680 ifdef CONFIG_COREAUDIO
681 COCOA_LIBS+=-framework CoreAudio
682 endif
683 endif
684 ifdef CONFIG_SLIRP
685 CPPFLAGS+=-I$(SRC_PATH)/slirp
686 endif
687
688 LIBS+=$(AIOLIBS)
689 # specific flags are needed for non soft mmu emulator
690 ifdef CONFIG_STATIC
691 LDFLAGS+=-static
692 endif
693 ifndef CONFIG_DARWIN
694 ifndef CONFIG_WIN32
695 ifndef CONFIG_SOLARIS
696 ifndef CONFIG_AIX
697 LIBS+=-lutil
698 endif
699 endif
700 endif
701 endif
702 ifdef TARGET_GPROF
703 vl.o: CFLAGS+=-p
704 LDFLAGS+=-p
705 endif
706
707 ifeq ($(ARCH),ia64)
708 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
709 endif
710
711 ifdef CONFIG_WIN32
712 SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
713 endif
714
715 # profiling code
716 ifdef TARGET_GPROF
717 LDFLAGS+=-p
718 main.o: CFLAGS+=-p
719 endif
720
721 $(QEMU_PROG): $(OBJS) ../libqemu_common.a libqemu.a
722         $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS)
723
724 endif # !CONFIG_USER_ONLY
725
726 gdbstub-xml.c: $(TARGET_XML_FILES) feature_to_c.sh
727         rm -f $@
728 ifeq ($(TARGET_XML_FILES),)
729         echo > $@
730 else
731         $(SHELL) $(SRC_PATH)/feature_to_c.sh $@ $(TARGET_XML_FILES)
732 endif
733
734 %.o: %.c
735         $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
736
737 %.o: %.S
738         $(CC) $(CPPFLAGS) -c -o $@ $<
739
740 clean:
741         rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o
742         rm -f *.d */*.d tcg/*.o
743
744 install: all
745 ifneq ($(PROGS),)
746         $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
747 endif
748
749 # Include automatically generated dependency files
750 -include $(wildcard *.d */*.d)