Make binary stripping conditional (Riku Voipio)
[qemu-kvm/fedora.git] / Makefile.target
blobe2e23bf2be42c8cf4eee0b40203905e3f552fdab
1 CFLAGS=
2 LDFLAGS=
4 include config.mak
5 include $(SRC_PATH)/rules.mak
7 LDFLAGS_BASE:=$(LDFLAGS)
8 TARGET_BASE_ARCH:=$(TARGET_ARCH)
9 ifeq ($(TARGET_ARCH), x86_64)
10 TARGET_BASE_ARCH:=i386
11 endif
12 ifeq ($(TARGET_ARCH), mipsn32)
13 TARGET_BASE_ARCH:=mips
14 endif
15 ifeq ($(TARGET_ARCH), mips64)
16 TARGET_BASE_ARCH:=mips
17 endif
18 ifeq ($(TARGET_ARCH), ppc64)
19 TARGET_BASE_ARCH:=ppc
20 endif
21 ifeq ($(TARGET_ARCH), ppc64h)
22 TARGET_BASE_ARCH:=ppc
23 endif
24 ifeq ($(TARGET_ARCH), ppcemb)
25 TARGET_BASE_ARCH:=ppc
26 endif
27 ifeq ($(TARGET_ARCH), sparc64)
28 TARGET_BASE_ARCH:=sparc
29 endif
30 ifeq ($(TARGET_ARCH), ia64)
31 TARGET_BASE_ARCH:=ia64
32 endif
33 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
34 VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw
35 CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MT $@ -MP -DNEED_CPU_H
36 #CFLAGS+=-Werror
37 LIBS=
38 # user emulator name
39 ifndef TARGET_ARCH2
40 TARGET_ARCH2=$(TARGET_ARCH)
41 endif
42 ifeq ($(TARGET_ARCH),arm)
43   ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
44     TARGET_ARCH2=armeb
45   endif
46 endif
47 ifeq ($(TARGET_ARCH),sh4)
48   ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
49     TARGET_ARCH2=sh4eb
50   endif
51 endif
52 ifeq ($(TARGET_ARCH),mips)
53   ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
54     TARGET_ARCH2=mipsel
55   endif
56 endif
57 ifeq ($(TARGET_ARCH),mipsn32)
58   ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
59     TARGET_ARCH2=mipsn32el
60   endif
61 endif
62 ifeq ($(TARGET_ARCH),mips64)
63   ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
64     TARGET_ARCH2=mips64el
65   endif
66 endif
68 ifdef CONFIG_USER_ONLY
69 # user emulator name
70 QEMU_PROG=qemu-$(TARGET_ARCH2)
71 else
72 # system emulator name
73 ifeq ($(TARGET_ARCH), i386)
74 QEMU_PROG=qemu$(EXESUF)
75 else
76 QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF)
77 endif
78 endif
80 PROGS=$(QEMU_PROG)
82 # cc-option
83 # Usage: CFLAGS+=$(call cc-option, $(CFLAGS), -falign-functions=0, -malign-functions=0)
85 cc-option = $(shell if $(CC) $(1) $(2) -S -o /dev/null -xc /dev/null \
86               > /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi ;)
88 HELPER_CFLAGS=
90 ifeq ($(ARCH),i386)
91 HELPER_CFLAGS+=-fomit-frame-pointer
92 endif
94 ifeq ($(ARCH),sparc)
95   CFLAGS+=-ffixed-g2 -ffixed-g3
96   ifneq ($(CONFIG_SOLARIS),yes)
97     CFLAGS+=-ffixed-g1 -ffixed-g6
98     HELPER_CFLAGS+=-ffixed-i0
99   endif
100 endif
102 ifeq ($(ARCH),sparc64)
103   ifneq ($(CONFIG_SOLARIS),yes)
104     CFLAGS+=-ffixed-g5 -ffixed-g6 -ffixed-g7
105   else
106     CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
107   endif
108 endif
110 ifeq ($(ARCH),alpha)
111 # Ensure there's only a single GP
112 CFLAGS+=-msmall-data
113 endif
115 ifeq ($(ARCH),hppa)
116 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
117 endif
119 ifeq ($(ARCH),ia64)
120 CFLAGS+=-mno-sdata
121 endif
123 CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
124 LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS)
126 CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__user=
127 LIBS+=-lm
128 ifdef CONFIG_WIN32
129 LIBS+=-lwinmm -lws2_32 -liphlpapi
130 endif
131 ifdef CONFIG_SOLARIS
132 LIBS+=-lsocket -lnsl -lresolv
133 ifdef NEEDS_LIBSUNMATH
134 LIBS+=-lsunmath
135 LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib
136 CFLAGS+=-I/opt/SUNWspro/prod/include/cc
137 endif
138 endif
140 kvm.o: CFLAGS+=$(KVM_CFLAGS)
141 kvm-all.o: CFLAGS+=$(KVM_CFLAGS)
143 CFLAGS += $(KVM_CFLAGS)
145 all: $(PROGS)
147 #########################################################
148 # cpu emulator library
149 LIBOBJS=exec.o kqemu.o cpu-exec.o host-utils.o
151 ifeq ($(NO_CPU_EMULATION), 1)
152 LIBOBJS+=fake-exec.o
153 else
154 LIBOBJS+= translate-all.o translate.o
155 # TCG code generator
156 LIBOBJS+= tcg/tcg.o tcg/tcg-runtime.o
157 CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH)
158 endif
159 ifeq ($(ARCH),sparc64)
160 CPPFLAGS+=-I$(SRC_PATH)/tcg/sparc
161 endif
163 ifeq ($(USE_KVM), 1)
164 LIBOBJS+=qemu-kvm.o
165 endif
166 ifdef CONFIG_SOFTFLOAT
167 LIBOBJS+=fpu/softfloat.o
168 else
169 LIBOBJS+=fpu/softfloat-native.o
170 endif
171 CPPFLAGS+=-I$(SRC_PATH)/fpu
172 LIBOBJS+= op_helper.o helper.o
174 ifeq ($(TARGET_ARCH), i386)
175 LIBOBJS+=helper.o
176 ifeq ($(USE_KVM), 1)
177 LIBOBJS+=qemu-kvm-x86.o kvm-tpr-opt.o
178 LIBOBJS+=qemu-kvm-helper.o
179 endif
180 endif
182 ifeq ($(TARGET_ARCH), x86_64)
183 LIBOBJS+=helper.o
184 ifeq ($(USE_KVM), 1)
185 LIBOBJS+=qemu-kvm-x86.o kvm-tpr-opt.o
186 LIBOBJS+=qemu-kvm-helper.o
187 endif
188 endif
190 LIBOBJS+= op_helper.o
192 ifneq ($(TARGET_ARCH), ia64)
193 LIBOBJS+= helper.o
194 endif
196 ifeq ($(TARGET_BASE_ARCH), arm)
197 LIBOBJS+= neon_helper.o iwmmxt_helper.o
198 endif
200 ifeq ($(TARGET_BASE_ARCH), alpha)
201 LIBOBJS+= alpha_palcode.o
202 endif
204 ifeq ($(TARGET_BASE_ARCH), ia64)
205 LIBOBJS+=op_helper.o firmware.o
206 ifeq ($(USE_KVM), 1)
207 LIBOBJS+=qemu-kvm-ia64.o
208 endif
209 endif
211 ifeq ($(TARGET_BASE_ARCH), cris)
212 LIBOBJS+= cris-dis.o
214 ifndef CONFIG_USER_ONLY
215 LIBOBJS+= mmu.o
216 endif
217 endif
220 # NOTE: the disassembler code is only needed for debugging
221 LIBOBJS+=disas.o
222 ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
223 USE_I386_DIS=y
224 endif
225 ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
226 USE_I386_DIS=y
227 endif
228 ifdef USE_I386_DIS
229 LIBOBJS+=i386-dis.o
230 endif
231 ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
232 LIBOBJS+=alpha-dis.o
233 endif
234 ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
235 LIBOBJS+=ppc-dis.o
236 endif
237 ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips)
238 LIBOBJS+=mips-dis.o
239 endif
240 ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
241 LIBOBJS+=sparc-dis.o
242 endif
243 ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
244 LIBOBJS+=arm-dis.o
245 endif
246 ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
247 LIBOBJS+=m68k-dis.o
248 endif
249 ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
250 LIBOBJS+=sh4-dis.o
251 endif
252 ifeq ($(findstring hppa, $(TARGET_BASE_ARCH) $(ARCH)),hppa)
253 LIBOBJS+=hppa-dis.o
254 endif
255 ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390)
256 LIBOBJS+=s390-dis.o
257 endif
259 # libqemu
261 libqemu.a: $(LIBOBJS)
263 translate.o: translate.c cpu.h
265 translate-all.o: translate-all.c cpu.h
267 tcg/tcg.o: cpu.h
269 # HELPER_CFLAGS is used for all the code compiled with static register
270 # variables
271 op_helper.o: CFLAGS += $(HELPER_CFLAGS) $(I386_CFLAGS)
273 cpu-exec.o: CFLAGS += $(HELPER_CFLAGS)
275 qemu-kvm-helper.o: qemu-kvm-helper.c
276         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
278 #########################################################
279 # Linux user emulator target
281 ifdef CONFIG_LINUX_USER
283 ifndef TARGET_ABI_DIR
284   TARGET_ABI_DIR=$(TARGET_ARCH)
285 endif
286 VPATH+=:$(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
287 CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
289 ifdef CONFIG_STATIC
290 LDFLAGS+=-static
291 endif
293 ifeq ($(ARCH),i386)
294 ifdef TARGET_GPROF
295 USE_I386_LD=y
296 endif
297 ifdef CONFIG_STATIC
298 USE_I386_LD=y
299 endif
300 ifdef USE_I386_LD
301 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
302 else
303 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
304 # that the kernel ELF loader considers as an executable. I think this
305 # is the simplest way to make it self virtualizable!
306 LDFLAGS+=-Wl,-shared
307 endif
308 endif
310 ifeq ($(ARCH),x86_64)
311 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
312 endif
314 ifeq ($(ARCH),ppc)
315 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
316 endif
318 ifeq ($(ARCH),ppc64)
319 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
320 endif
322 ifeq ($(ARCH),s390)
323 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
324 endif
326 ifeq ($(ARCH),sparc)
327 # -static is used to avoid g1/g3 usage by the dynamic linker    
328 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
329 endif
331 ifeq ($(ARCH),sparc64)
332 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
333 endif
335 ifeq ($(ARCH),alpha)
336 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
337 endif
339 ifeq ($(ARCH),ia64)
340 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
341 endif
343 ifeq ($(ARCH),arm)
344 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
345 endif
347 ifeq ($(ARCH),m68k)
348 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
349 endif
351 ifeq ($(ARCH),mips)
352 ifeq ($(WORDS_BIGENDIAN),yes)
353 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
354 else
355 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
356 endif
357 endif
359 ifeq ($(ARCH),mips64)
360 ifeq ($(WORDS_BIGENDIAN),yes)
361 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
362 else
363 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
364 endif
365 endif
367 # profiling code
368 ifdef TARGET_GPROF
369 LDFLAGS+=-p
370 CFLAGS+=-p
371 endif
373 OBJS= main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \
374       elfload.o linuxload.o uaccess.o envlist.o
375 LIBS+= $(AIOLIBS)
376 ifdef TARGET_HAS_BFLT
377 OBJS+= flatload.o
378 endif
379 ifdef TARGET_HAS_ELFLOAD32
380 OBJS+= elfload32.o
381 elfload32.o: elfload.c
382 endif
384 ifeq ($(TARGET_ARCH), i386)
385 OBJS+= vm86.o
386 endif
387 ifeq ($(TARGET_ARCH), arm)
388 OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
389 nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
390  nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o
391 endif
392 ifeq ($(TARGET_ARCH), m68k)
393 OBJS+= m68k-sim.o m68k-semi.o
394 endif
396 ifdef CONFIG_GDBSTUB
397 OBJS+=gdbstub.o gdbstub-xml.o
398 endif
400 OBJS+= libqemu.a
402 # Note: this is a workaround. The real fix is to avoid compiling
403 # cpu_signal_handler() in cpu-exec.c.
404 signal.o: CFLAGS += $(HELPER_CFLAGS)
406 $(QEMU_PROG): $(OBJS) ../libqemu_user.a
407         $(LINK)
408 ifeq ($(ARCH),alpha)
409 # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
410 # the address space (31 bit so sign extending doesn't matter)
411         echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
412 endif
414 endif #CONFIG_LINUX_USER
416 #########################################################
417 # Darwin user emulator target
419 ifdef CONFIG_DARWIN_USER
421 VPATH+=:$(SRC_PATH)/darwin-user
422 CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
424 # Leave some space for the regular program loading zone
425 LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000
427 LIBS+=-lmx
429 OBJS= main.o commpage.o machload.o mmap.o signal.o syscall.o thunk.o
431 OBJS+= libqemu.a
433 ifdef CONFIG_GDBSTUB
434 OBJS+=gdbstub.o gdbstub-xml.o
435 endif
437 # Note: this is a workaround. The real fix is to avoid compiling
438 # cpu_signal_handler() in cpu-exec.c.
439 signal.o: CFLAGS += $(HELPER_CFLAGS)
441 $(QEMU_PROG): $(OBJS)
442         $(LINK)
444 endif #CONFIG_DARWIN_USER
446 #########################################################
447 # BSD user emulator target
449 ifdef CONFIG_BSD_USER
451 VPATH+=:$(SRC_PATH)/bsd-user
452 CPPFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
454 ifdef CONFIG_STATIC
455 LDFLAGS+=-static
456 endif
458 ifeq ($(ARCH),i386)
459 ifdef TARGET_GPROF
460 USE_I386_LD=y
461 endif
462 ifdef CONFIG_STATIC
463 USE_I386_LD=y
464 endif
465 ifdef USE_I386_LD
466 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
467 else
468 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
469 # that the kernel ELF loader considers as an executable. I think this
470 # is the simplest way to make it self virtualizable!
471 LDFLAGS+=-Wl,-shared
472 endif
473 endif
475 ifeq ($(ARCH),x86_64)
476 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
477 endif
479 ifeq ($(ARCH),ppc)
480 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
481 endif
483 ifeq ($(ARCH),ppc64)
484 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
485 endif
487 ifeq ($(ARCH),s390)
488 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
489 endif
491 ifeq ($(ARCH),sparc)
492 # -static is used to avoid g1/g3 usage by the dynamic linker
493 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
494 endif
496 ifeq ($(ARCH),sparc64)
497 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
498 endif
500 ifeq ($(ARCH),alpha)
501 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
502 endif
504 ifeq ($(ARCH),ia64)
505 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
506 endif
508 ifeq ($(ARCH),arm)
509 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
510 endif
512 ifeq ($(ARCH),m68k)
513 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
514 endif
516 ifeq ($(ARCH),mips)
517 ifeq ($(WORDS_BIGENDIAN),yes)
518 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
519 else
520 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
521 endif
522 endif
524 ifeq ($(ARCH),mips64)
525 ifeq ($(WORDS_BIGENDIAN),yes)
526 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
527 else
528 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
529 endif
530 endif
532 OBJS= main.o bsdload.o elfload.o mmap.o path.o signal.o strace.o syscall.o
533 OBJS+= uaccess.o
535 OBJS+= libqemu.a
537 ifdef CONFIG_GDBSTUB
538 OBJS+=gdbstub.o
539 endif
541 # Note: this is a workaround. The real fix is to avoid compiling
542 # cpu_signal_handler() in cpu-exec.c.
543 signal.o: CFLAGS += $(HELPER_CFLAGS)
545 $(QEMU_PROG): $(OBJS) ../libqemu_user.a
546         $(LINK)
548 endif #CONFIG_BSD_USER
550 #########################################################
551 # System emulator target
552 ifndef CONFIG_USER_ONLY
554 OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o dma-helpers.o
555 # virtio has to be here due to weird dependency between PCI and virtio-net.
556 # need to fix this properly
557 OBJS+=virtio.o virtio-blk.o virtio-balloon.o virtio-net.o virtio-console.o
558 OBJS+=fw_cfg.o
559 ifdef CONFIG_KVM
560 OBJS+=kvm.o kvm-all.o
561 endif
562 ifdef CONFIG_WIN32
563 OBJS+=block-raw-win32.o
564 else
565 ifdef CONFIG_AIO
566 OBJS+=posix-aio-compat.o
567 endif
568 OBJS+=block-raw-posix.o
569 endif
571 ifdef CONFIG_AIO
572 OBJS+=compatfd.o
573 endif
575 LIBS+=-lz
576 ifdef CONFIG_ALSA
577 LIBS += -lasound
578 endif
579 ifdef CONFIG_ESD
580 LIBS += -lesd
581 endif
582 ifdef CONFIG_PA
583 LIBS += -lpulse-simple
584 endif
585 ifdef CONFIG_DSOUND
586 LIBS += -lole32 -ldxguid
587 endif
588 ifdef CONFIG_FMOD
589 LIBS += $(CONFIG_FMOD_LIB)
590 endif
591 ifdef CONFIG_OSS
592 LIBS += $(CONFIG_OSS_LIB)
593 endif
595 SOUND_HW = sb16.o es1370.o ac97.o
596 ifdef CONFIG_ADLIB
597 SOUND_HW += fmopl.o adlib.o
598 adlib.o fmopl.o: CFLAGS := ${CFLAGS} -DBUILD_Y8950=0
599 endif
600 ifdef CONFIG_GUS
601 SOUND_HW += gus.o gusemu_hal.o gusemu_mixer.o
602 endif
603 ifdef CONFIG_CS4231A
604 SOUND_HW += cs4231a.o
605 endif
607 ifdef USE_KVM
608 DEPLIBS += libkvm.a
609 endif
611 ifdef CONFIG_VNC_TLS
612 CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
613 LIBS += $(CONFIG_VNC_TLS_LIBS)
614 endif
616 ifdef CONFIG_VNC_SASL
617 CPPFLAGS += $(CONFIG_VNC_SASL_CFLAGS)
618 LIBS += $(CONFIG_VNC_SASL_LIBS)
619 endif
621 ifdef CONFIG_BLUEZ
622 LIBS += $(CONFIG_BLUEZ_LIBS)
623 endif
625 # SCSI layer
626 OBJS+= lsi53c895a.o esp.o
628 # USB layer
629 OBJS+= usb-ohci.o
631 # EEPROM emulation
632 OBJS += eeprom93xx.o
634 # PCI network cards
635 OBJS += eepro100.o
636 OBJS += ne2000.o
637 OBJS += pcnet.o
638 OBJS += rtl8139.o
639 OBJS += e1000.o
641 # Serial mouse
642 OBJS += msmouse.o
644 ifeq ($(USE_KVM_DEVICE_ASSIGNMENT), 1)
645 OBJS+= device-assignment.o
646 endif
648 ifeq ($(TARGET_BASE_ARCH), i386)
649 # Hardware support
650 OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o
651 OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
652 OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o
653 OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
654 OBJS += device-hotplug.o pci-hotplug.o
655 OBJS+= extboot.o
656 # virtio support
657 OBJS+= virtio.o virtio-blk.o virtio-balloon.o
658 OBJS += virtio-net.o
659 ifeq ($(USE_KVM_PIT), 1)
660 OBJS+= i8254-kvm.o
661 endif
662 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
663 endif
664 ifeq ($(TARGET_BASE_ARCH), ia64)
665 # Hardware support
666 OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
667 OBJS+= fdc.o mc146818rtc.o serial.o i8259.o ipf.o
668 OBJS+= cirrus_vga.o parallel.o acpi.o piix_pci.o
669 OBJS+= usb-uhci.o smbus_eeprom.o
670 # virtio support
671 OBJS+= virtio.o virtio-blk.o virtio-balloon.o
672 OBJS+= virtio-net.o
673 endif
674 ifeq ($(TARGET_BASE_ARCH), ppc)
675 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
676 # shared objects
677 OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o
678 OBJS+= cirrus_vga.o
679 # PREP target
680 OBJS+= pckbd.o ps2.o serial.o i8259.o i8254.o fdc.o m48t59.o mc146818rtc.o
681 OBJS+= prep_pci.o ppc_prep.o
682 # Mac shared devices
683 OBJS+= macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o escc.o
684 # OldWorld PowerMac
685 OBJS+= heathrow_pic.o grackle_pci.o ppc_oldworld.o
686 # NewWorld PowerMac
687 OBJS+= unin_pci.o ppc_newworld.o
688 # PowerPC 4xx boards
689 OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o
690 OBJS+= ppc440.o ppc440_bamboo.o
691 # PowerPC E500 boards
692 OBJS+= ppce500_pci.o ppce500_mpc8544ds.o
693 ifdef FDT_LIBS
694 OBJS+= device_tree.o
695 LIBS+= $(FDT_LIBS)
696 endif
697 ifdef CONFIG_KVM
698 OBJS+= kvm_ppc.o
699 endif
700 endif
701 ifeq ($(TARGET_BASE_ARCH), mips)
702 OBJS+= mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o
703 OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o rc4030.o
704 OBJS+= g364fb.o jazz_led.o
705 OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
706 OBJS+= piix_pci.o parallel.o cirrus_vga.o pcspk.o $(SOUND_HW)
707 OBJS+= mipsnet.o
708 OBJS+= pflash_cfi01.o
709 OBJS+= vmware_vga.o
710 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
711 endif
712 ifeq ($(TARGET_BASE_ARCH), cris)
713 # Boards
714 OBJS+= etraxfs.o axis_dev88.o
716 # IO blocks
717 OBJS+= etraxfs_dma.o
718 OBJS+= etraxfs_pic.o
719 OBJS+= etraxfs_eth.o
720 OBJS+= etraxfs_timer.o
721 OBJS+= etraxfs_ser.o
723 OBJS+= ptimer.o
724 OBJS+= pflash_cfi02.o nand.o
725 endif
726 ifeq ($(TARGET_BASE_ARCH), sparc)
727 ifeq ($(TARGET_ARCH), sparc64)
728 OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o
729 OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o
730 OBJS+= cirrus_vga.o parallel.o ptimer.o
731 else
732 OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o
733 OBJS+= slavio_timer.o escc.o slavio_misc.o fdc.o sparc32_dma.o
734 OBJS+= cs4231.o ptimer.o eccmemctl.o sbi.o sun4c_intctl.o
735 endif
736 endif
737 ifeq ($(TARGET_BASE_ARCH), arm)
738 OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o
739 OBJS+= arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
740 OBJS+= versatile_pci.o ptimer.o
741 OBJS+= realview_gic.o realview.o arm_sysctl.o mpcore.o
742 OBJS+= armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
743 OBJS+= pl061.o
744 OBJS+= arm-semi.o
745 OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
746 OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
747 OBJS+= pflash_cfi01.o gumstix.o
748 OBJS+= zaurus.o ide.o serial.o nand.o ecc.o spitz.o tosa.o tc6393xb.o
749 OBJS+= omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o
750 OBJS+= omap2.o omap_dss.o soc_dma.o
751 OBJS+= omap_sx1.o palm.o tsc210x.o
752 OBJS+= nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o
753 OBJS+= tsc2005.o bt-hci-csr.o
754 OBJS+= mst_fpga.o mainstone.o
755 OBJS+= musicpal.o pflash_cfi02.o
756 CPPFLAGS += -DHAS_AUDIO
757 endif
758 ifeq ($(TARGET_BASE_ARCH), sh4)
759 OBJS+= shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
760 OBJS+= sh_timer.o ptimer.o sh_serial.o sh_intc.o sh_pci.o sm501.o serial.o
761 OBJS+= ide.o
762 endif
763 ifeq ($(TARGET_BASE_ARCH), m68k)
764 OBJS+= an5206.o mcf5206.o ptimer.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
765 OBJS+= m68k-semi.o dummy_m68k.o
766 endif
767 ifdef CONFIG_GDBSTUB
768 OBJS+=gdbstub.o gdbstub-xml.o
769 endif
770 ifdef CONFIG_COCOA
771 COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
772 ifdef CONFIG_COREAUDIO
773 COCOA_LIBS+=-framework CoreAudio
774 endif
775 endif
776 ifdef CONFIG_SLIRP
777 CPPFLAGS+=-I$(SRC_PATH)/slirp
778 endif
780 LIBS+=$(AIOLIBS)
781 # specific flags are needed for non soft mmu emulator
782 ifdef CONFIG_STATIC
783 LDFLAGS+=-static
784 endif
785 ifndef CONFIG_DARWIN
786 ifndef CONFIG_WIN32
787 ifndef CONFIG_SOLARIS
788 ifndef CONFIG_AIX
789 LIBS+=-lutil
790 endif
791 endif
792 endif
793 endif
794 ifdef TARGET_GPROF
795 vl.o: CFLAGS+=-p
796 LDFLAGS+=-p
797 endif
799 ifeq ($(ARCH),ia64)
800 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
801 endif
803 ifdef CONFIG_WIN32
804 SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
805 endif
807 # profiling code
808 ifdef TARGET_GPROF
809 LDFLAGS+=-p
810 main.o: CFLAGS+=-p
811 endif
812 ifeq ($(TARGET_ARCH), ia64)
813 firmware.o: firmware.c
814         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
815 endif
817 $(QEMU_PROG): LIBS += $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS)
819 $(QEMU_PROG): $(OBJS) ../libqemu_common.a libqemu.a $(DEPLIBS)
820         $(LINK)
822 FORCE:
824 libkvm.a: FORCE
825         $(MAKE) -C ../kvm/libkvm KVM_CFLAGS="$(KVM_CFLAGS)"
826         if ! cmp -s libkvm.a ../kvm/libkvm/libkvm.a; then \
827            cp ../kvm/libkvm/libkvm.a . ; \
828         fi
830 endif # !CONFIG_USER_ONLY
832 gdbstub-xml.c: $(TARGET_XML_FILES) feature_to_c.sh
833         rm -f $@
834 ifeq ($(TARGET_XML_FILES),)
835         echo > $@
836 else
837         $(SHELL) $(SRC_PATH)/feature_to_c.sh $@ $(TARGET_XML_FILES)
838 endif
840 clean:
841         rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o
842         rm -f *.d */*.d tcg/*.o
844 install: all
845 ifneq ($(PROGS),)
846         $(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)"
847 endif
849 # Include automatically generated dependency files
850 -include $(wildcard *.d */*.d)