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