Make qemu executable depend on libkvm.a
[qemu-kvm/fedora.git] / Makefile.target
blobcd88a20283a6cd845b2f8c751e059d2e5e733c7f
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   ifneq ($(CONFIG_SOLARIS),yes)
100     HELPER_CFLAGS+=-ffixed-i0
101   endif
102 endif
104 ifeq ($(ARCH),alpha)
105 # Ensure there's only a single GP
106 CFLAGS+=-msmall-data
107 endif
109 ifeq ($(ARCH),hppa)
110 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
111 endif
113 ifeq ($(ARCH),ia64)
114 CFLAGS+=-mno-sdata
115 endif
117 CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
118 LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS)
120 CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__user=
121 LIBS+=-lm
122 ifdef CONFIG_WIN32
123 LIBS+=-lwinmm -lws2_32 -liphlpapi
124 endif
125 ifdef CONFIG_SOLARIS
126 LIBS+=-lsocket -lnsl -lresolv
127 ifdef NEEDS_LIBSUNMATH
128 LIBS+=-lsunmath
129 LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib
130 CFLAGS+=-I/opt/SUNWspro/prod/include/cc
131 endif
132 endif
134 kvm.o: CFLAGS+=$(KVM_CFLAGS)
135 kvm-all.o: CFLAGS+=$(KVM_CFLAGS)
137 CFLAGS += $(KVM_CFLAGS)
139 all: $(PROGS)
141 #########################################################
142 # cpu emulator library
143 ifeq ($(NO_CPU_EMULATION), 1)
144 LIBOBJS=exec.o fake-exec.o cpu-exec.o host-utils.o
145 else
146 LIBOBJS=exec.o translate-all.o cpu-exec.o\
147         translate.o host-utils.o
148 endif
150 ifdef CONFIG_KQEMU
151 LIBOBJS+= kqemu.o
152 endif
153 # TCG code generator
154 ifneq ($(NO_CPU_EMULATION), 1)
155 LIBOBJS+= tcg/tcg.o tcg/tcg-runtime.o
156 CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH)
157 endif
158 ifeq ($(ARCH),sparc64)
159 CPPFLAGS+=-I$(SRC_PATH)/tcg/sparc
160 endif
162 ifeq ($(USE_KVM), 1)
163 LIBOBJS+=qemu-kvm.o
164 endif
165 ifdef CONFIG_SOFTFLOAT
166 LIBOBJS+=fpu/softfloat.o
167 else
168 LIBOBJS+=fpu/softfloat-native.o
169 endif
170 CPPFLAGS+=-I$(SRC_PATH)/fpu
171 LIBOBJS+= op_helper.o helper.o
173 ifeq ($(TARGET_ARCH), i386)
174 LIBOBJS+=helper.o
175 ifeq ($(USE_KVM), 1)
176 LIBOBJS+=qemu-kvm-x86.o kvm-tpr-opt.o
177 LIBOBJS+=qemu-kvm-helper.o
178 endif
179 endif
181 ifeq ($(TARGET_ARCH), x86_64)
182 LIBOBJS+=helper.o
183 ifeq ($(USE_KVM), 1)
184 LIBOBJS+=qemu-kvm-x86.o kvm-tpr-opt.o
185 LIBOBJS+=qemu-kvm-helper.o
186 endif
187 endif
189 LIBOBJS+= op_helper.o
191 ifneq ($(TARGET_ARCH), ia64)
192 LIBOBJS+= helper.o
193 endif
195 ifeq ($(TARGET_BASE_ARCH), arm)
196 LIBOBJS+= neon_helper.o iwmmxt_helper.o
197 endif
199 ifeq ($(TARGET_BASE_ARCH), alpha)
200 LIBOBJS+= alpha_palcode.o
201 endif
203 ifeq ($(TARGET_BASE_ARCH), ia64)
204 LIBOBJS+=op_helper.o firmware.o
205 ifeq ($(USE_KVM), 1)
206 LIBOBJS+=qemu-kvm-ia64.o
207 endif
208 endif
210 ifeq ($(TARGET_BASE_ARCH), cris)
211 LIBOBJS+= cris-dis.o
213 ifndef CONFIG_USER_ONLY
214 LIBOBJS+= mmu.o
215 endif
216 endif
219 # NOTE: the disassembler code is only needed for debugging
220 LIBOBJS+=disas.o
221 ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
222 USE_I386_DIS=y
223 endif
224 ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
225 USE_I386_DIS=y
226 endif
227 ifdef USE_I386_DIS
228 LIBOBJS+=i386-dis.o
229 endif
230 ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
231 LIBOBJS+=alpha-dis.o
232 endif
233 ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
234 LIBOBJS+=ppc-dis.o
235 endif
236 ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips)
237 LIBOBJS+=mips-dis.o
238 endif
239 ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
240 LIBOBJS+=sparc-dis.o
241 endif
242 ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
243 LIBOBJS+=arm-dis.o
244 endif
245 ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
246 LIBOBJS+=m68k-dis.o
247 endif
248 ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
249 LIBOBJS+=sh4-dis.o
250 endif
251 ifeq ($(findstring hppa, $(TARGET_BASE_ARCH) $(ARCH)),hppa)
252 LIBOBJS+=hppa-dis.o
253 endif
254 ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390)
255 LIBOBJS+=s390-dis.o
256 endif
258 # libqemu
260 libqemu.a: $(LIBOBJS)
262 translate.o: translate.c cpu.h
264 translate-all.o: translate-all.c cpu.h
266 tcg/tcg.o: cpu.h
268 # HELPER_CFLAGS is used for all the code compiled with static register
269 # variables
270 op_helper.o: CFLAGS += $(HELPER_CFLAGS) $(I386_CFLAGS)
272 cpu-exec.o: CFLAGS += $(HELPER_CFLAGS)
274 qemu-kvm-helper.o: qemu-kvm-helper.c
275         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
277 #########################################################
278 # Linux user emulator target
280 ifdef CONFIG_LINUX_USER
282 ifndef TARGET_ABI_DIR
283   TARGET_ABI_DIR=$(TARGET_ARCH)
284 endif
285 VPATH+=:$(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
286 CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
288 ifdef CONFIG_STATIC
289 LDFLAGS+=-static
290 endif
292 ifeq ($(ARCH),i386)
293 ifdef TARGET_GPROF
294 USE_I386_LD=y
295 endif
296 ifdef CONFIG_STATIC
297 USE_I386_LD=y
298 endif
299 ifdef USE_I386_LD
300 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
301 else
302 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
303 # that the kernel ELF loader considers as an executable. I think this
304 # is the simplest way to make it self virtualizable!
305 LDFLAGS+=-Wl,-shared
306 endif
307 endif
309 ifeq ($(ARCH),x86_64)
310 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
311 endif
313 ifeq ($(ARCH),ppc)
314 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
315 endif
317 ifeq ($(ARCH),ppc64)
318 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
319 endif
321 ifeq ($(ARCH),s390)
322 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
323 endif
325 ifeq ($(ARCH),sparc)
326 # -static is used to avoid g1/g3 usage by the dynamic linker    
327 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
328 endif
330 ifeq ($(ARCH),sparc64)
331 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
332 endif
334 ifeq ($(ARCH),alpha)
335 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
336 endif
338 ifeq ($(ARCH),ia64)
339 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
340 endif
342 ifeq ($(ARCH),arm)
343 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
344 endif
346 ifeq ($(ARCH),m68k)
347 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
348 endif
350 ifeq ($(ARCH),mips)
351 ifeq ($(WORDS_BIGENDIAN),yes)
352 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
353 else
354 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
355 endif
356 endif
358 ifeq ($(ARCH),mips64)
359 ifeq ($(WORDS_BIGENDIAN),yes)
360 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
361 else
362 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
363 endif
364 endif
366 # profiling code
367 ifdef TARGET_GPROF
368 LDFLAGS+=-p
369 CFLAGS+=-p
370 endif
372 OBJS= main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \
373       elfload.o linuxload.o uaccess.o envlist.o gdbstub.o gdbstub-xml.o
374 LIBS+= $(PTHREADLIBS)
375 LIBS+= $(CLOCKLIBS)
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 # Note: this is a workaround. The real fix is to avoid compiling
397 # cpu_signal_handler() in cpu-exec.c.
398 signal.o: CFLAGS += $(HELPER_CFLAGS)
400 $(QEMU_PROG): ARLIBS=../libqemu_user.a libqemu.a
401 $(QEMU_PROG): $(OBJS) ../libqemu_user.a libqemu.a
402         $(call LINK,$(OBJS))
403 ifeq ($(ARCH),alpha)
404 # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
405 # the address space (31 bit so sign extending doesn't matter)
406         echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
407 endif
409 endif #CONFIG_LINUX_USER
411 #########################################################
412 # Darwin user emulator target
414 ifdef CONFIG_DARWIN_USER
416 VPATH+=:$(SRC_PATH)/darwin-user
417 CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
419 # Leave some space for the regular program loading zone
420 LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000
422 LIBS+=-lmx
424 OBJS= main.o commpage.o machload.o mmap.o signal.o syscall.o thunk.o \
425       gdbstub.o gdbstub-xml.o
427 # Note: this is a workaround. The real fix is to avoid compiling
428 # cpu_signal_handler() in cpu-exec.c.
429 signal.o: CFLAGS += $(HELPER_CFLAGS)
431 $(QEMU_PROG): ARLIBS=libqemu.a
432 $(QEMU_PROG): $(OBJS) libqemu.a
433         $(call LINK,$(OBJS))
435 endif #CONFIG_DARWIN_USER
437 #########################################################
438 # BSD user emulator target
440 ifdef CONFIG_BSD_USER
442 VPATH+=:$(SRC_PATH)/bsd-user
443 CPPFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
445 ifdef CONFIG_STATIC
446 LDFLAGS+=-static
447 endif
449 ifeq ($(ARCH),i386)
450 ifdef TARGET_GPROF
451 USE_I386_LD=y
452 endif
453 ifdef CONFIG_STATIC
454 USE_I386_LD=y
455 endif
456 ifdef USE_I386_LD
457 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
458 else
459 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
460 # that the kernel ELF loader considers as an executable. I think this
461 # is the simplest way to make it self virtualizable!
462 LDFLAGS+=-Wl,-shared
463 endif
464 endif
466 ifeq ($(ARCH),x86_64)
467 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
468 endif
470 ifeq ($(ARCH),ppc)
471 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
472 endif
474 ifeq ($(ARCH),ppc64)
475 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
476 endif
478 ifeq ($(ARCH),s390)
479 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
480 endif
482 ifeq ($(ARCH),sparc)
483 # -static is used to avoid g1/g3 usage by the dynamic linker
484 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
485 endif
487 ifeq ($(ARCH),sparc64)
488 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
489 endif
491 ifeq ($(ARCH),alpha)
492 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
493 endif
495 ifeq ($(ARCH),ia64)
496 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
497 endif
499 ifeq ($(ARCH),arm)
500 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
501 endif
503 ifeq ($(ARCH),m68k)
504 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
505 endif
507 ifeq ($(ARCH),mips)
508 ifeq ($(WORDS_BIGENDIAN),yes)
509 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
510 else
511 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
512 endif
513 endif
515 ifeq ($(ARCH),mips64)
516 ifeq ($(WORDS_BIGENDIAN),yes)
517 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
518 else
519 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
520 endif
521 endif
523 OBJS= main.o bsdload.o elfload.o mmap.o path.o signal.o strace.o syscall.o \
524       gdbstub.o gdbstub-xml.o
525 OBJS+= uaccess.o
527 # Note: this is a workaround. The real fix is to avoid compiling
528 # cpu_signal_handler() in cpu-exec.c.
529 signal.o: CFLAGS += $(HELPER_CFLAGS)
531 $(QEMU_PROG): ARLIBS=libqemu.a ../libqemu_user.a
532 $(QEMU_PROG): $(OBJS) libqemu.a ../libqemu_user.a
533         $(call LINK,$(OBJS))
535 endif #CONFIG_BSD_USER
537 #########################################################
538 # System emulator target
539 ifndef CONFIG_USER_ONLY
541 OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o \
542      gdbstub.o gdbstub-xml.o
543 # virtio has to be here due to weird dependency between PCI and virtio-net.
544 # need to fix this properly
545 OBJS+=virtio-blk.o virtio-balloon.o virtio-net.o virtio-console.o
546 ifdef CONFIG_KVM
547 OBJS+=kvm.o kvm-all.o
548 endif
550 LIBS+=-lz
551 ifdef CONFIG_ALSA
552 LIBS += -lasound
553 endif
554 ifdef CONFIG_ESD
555 LIBS += -lesd
556 endif
557 ifdef CONFIG_PA
558 LIBS += -lpulse-simple
559 endif
560 ifdef CONFIG_DSOUND
561 LIBS += -lole32 -ldxguid
562 endif
563 ifdef CONFIG_FMOD
564 LIBS += $(CONFIG_FMOD_LIB)
565 endif
566 ifdef CONFIG_OSS
567 LIBS += $(CONFIG_OSS_LIB)
568 endif
570 SOUND_HW = sb16.o es1370.o ac97.o
571 ifdef CONFIG_ADLIB
572 SOUND_HW += fmopl.o adlib.o
573 adlib.o fmopl.o: CFLAGS := ${CFLAGS} -DBUILD_Y8950=0
574 endif
575 ifdef CONFIG_GUS
576 SOUND_HW += gus.o gusemu_hal.o gusemu_mixer.o
577 endif
578 ifdef CONFIG_CS4231A
579 SOUND_HW += cs4231a.o
580 endif
582 ifdef USE_KVM
583 DEPLIBS += libkvm.a
584 endif
586 ifdef CONFIG_VNC_TLS
587 CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
588 LIBS += $(CONFIG_VNC_TLS_LIBS)
589 endif
591 ifdef CONFIG_VNC_SASL
592 CPPFLAGS += $(CONFIG_VNC_SASL_CFLAGS)
593 LIBS += $(CONFIG_VNC_SASL_LIBS)
594 endif
596 ifdef CONFIG_BLUEZ
597 LIBS += $(CONFIG_BLUEZ_LIBS)
598 endif
600 # xen backend driver support
601 XEN_OBJS := xen_machine_pv.o xen_backend.o xen_devconfig.o xen_domainbuild.o
602 XEN_OBJS += xen_console.o xenfb.o xen_disk.o xen_nic.o
603 ifeq ($(CONFIG_XEN), yes)
604   OBJS += $(XEN_OBJS)
605   LIBS += $(XEN_LIBS)
606 endif
608 # SCSI layer
609 OBJS+= lsi53c895a.o esp.o
611 # USB layer
612 OBJS+= usb-ohci.o
614 # PCI network cards
615 OBJS += eepro100.o
616 OBJS += ne2000.o
617 OBJS += pcnet.o
618 OBJS += rtl8139.o
619 OBJS += e1000.o
621 # Generic watchdog support and some watchdog devices
622 OBJS += wdt_ib700.o wdt_i6300esb.o
624 ifeq ($(USE_KVM_DEVICE_ASSIGNMENT), 1)
625 OBJS+= device-assignment.o
626 LIBS+=-lpci
627 endif
629 ifeq ($(TARGET_BASE_ARCH), i386)
630 # Hardware support
631 OBJS+= ide.o pckbd.o vga.o $(SOUND_HW) dma.o
632 OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
633 OBJS+= cirrus_vga.o apic.o ioapic.o parallel.o acpi.o piix_pci.o
634 OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
635 OBJS += device-hotplug.o pci-hotplug.o smbios.o
636 OBJS+= extboot.o
637 ifeq ($(USE_KVM_PIT), 1)
638 OBJS+= i8254-kvm.o
639 endif
640 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
641 endif
642 ifeq ($(TARGET_BASE_ARCH), ia64)
643 # Hardware support
644 OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
645 OBJS+= fdc.o mc146818rtc.o serial.o i8259.o ipf.o
646 OBJS+= cirrus_vga.o parallel.o acpi.o piix_pci.o
647 OBJS+= usb-uhci.o smbus_eeprom.o
648 # virtio support
649 OBJS+= virtio.o virtio-blk.o virtio-balloon.o
650 OBJS+= virtio-net.o
651 endif
652 ifeq ($(TARGET_BASE_ARCH), ppc)
653 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
654 # shared objects
655 OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o
656 OBJS+= cirrus_vga.o
657 # PREP target
658 OBJS+= pckbd.o serial.o i8259.o i8254.o fdc.o mc146818rtc.o
659 OBJS+= prep_pci.o ppc_prep.o
660 # Mac shared devices
661 OBJS+= macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o escc.o
662 # OldWorld PowerMac
663 OBJS+= heathrow_pic.o grackle_pci.o ppc_oldworld.o
664 # NewWorld PowerMac
665 OBJS+= unin_pci.o ppc_newworld.o
666 # PowerPC 4xx boards
667 OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o
668 OBJS+= ppc440.o ppc440_bamboo.o
669 # PowerPC E500 boards
670 OBJS+= ppce500_pci.o ppce500_mpc8544ds.o
671 ifdef FDT_LIBS
672 OBJS+= device_tree.o
673 LIBS+= $(FDT_LIBS)
674 endif
675 ifdef CONFIG_KVM
676 OBJS+= kvm_ppc.o
677 endif
678 endif
679 ifeq ($(TARGET_BASE_ARCH), mips)
680 OBJS+= mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o
681 OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o rc4030.o
682 OBJS+= g364fb.o jazz_led.o dp8393x.o
683 OBJS+= ide.o gt64xxx.o pckbd.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
684 OBJS+= piix_pci.o parallel.o cirrus_vga.o pcspk.o $(SOUND_HW)
685 OBJS+= mipsnet.o
686 OBJS+= pflash_cfi01.o
687 OBJS+= vmware_vga.o
688 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
689 endif
690 ifeq ($(TARGET_BASE_ARCH), cris)
691 # Boards
692 OBJS+= cris_pic_cpu.o etraxfs.o axis_dev88.o
694 # IO blocks
695 OBJS+= etraxfs_dma.o
696 OBJS+= etraxfs_pic.o
697 OBJS+= etraxfs_eth.o
698 OBJS+= etraxfs_timer.o
699 OBJS+= etraxfs_ser.o
701 OBJS+= pflash_cfi02.o
702 endif
703 ifeq ($(TARGET_BASE_ARCH), sparc)
704 ifeq ($(TARGET_ARCH), sparc64)
705 OBJS+= sun4u.o ide.o pckbd.o vga.o apb_pci.o
706 OBJS+= fdc.o mc146818rtc.o serial.o
707 OBJS+= cirrus_vga.o parallel.o
708 else
709 OBJS+= sun4m.o tcx.o iommu.o slavio_intctl.o
710 OBJS+= slavio_timer.o escc.o slavio_misc.o fdc.o sparc32_dma.o
711 OBJS+= cs4231.o eccmemctl.o sbi.o sun4c_intctl.o
712 endif
713 endif
714 ifeq ($(TARGET_BASE_ARCH), arm)
715 OBJS+= integratorcp.o versatilepb.o smc91c111.o arm_pic.o arm_timer.o
716 OBJS+= arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
717 OBJS+= versatile_pci.o
718 OBJS+= realview_gic.o realview.o arm_sysctl.o mpcore.o
719 OBJS+= armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
720 OBJS+= pl061.o
721 OBJS+= arm-semi.o
722 OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
723 OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
724 OBJS+= pflash_cfi01.o gumstix.o
725 OBJS+= zaurus.o ide.o serial.o spitz.o tosa.o tc6393xb.o
726 OBJS+= omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o
727 OBJS+= omap2.o omap_dss.o soc_dma.o
728 OBJS+= omap_sx1.o palm.o tsc210x.o
729 OBJS+= nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o
730 OBJS+= mst_fpga.o mainstone.o
731 OBJS+= musicpal.o pflash_cfi02.o
732 OBJS+= framebuffer.o
733 OBJS+= syborg.o syborg_fb.o syborg_interrupt.o syborg_keyboard.o
734 OBJS+= syborg_serial.o syborg_timer.o syborg_pointer.o syborg_rtc.o
735 OBJS+= syborg_virtio.o
736 CPPFLAGS += -DHAS_AUDIO
737 endif
738 ifeq ($(TARGET_BASE_ARCH), sh4)
739 OBJS+= shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
740 OBJS+= sh_timer.o sh_serial.o sh_intc.o sh_pci.o sm501.o serial.o
741 OBJS+= ide.o
742 endif
743 ifeq ($(TARGET_BASE_ARCH), m68k)
744 OBJS+= an5206.o mcf5206.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
745 OBJS+= m68k-semi.o dummy_m68k.o
746 endif
747 ifdef CONFIG_COCOA
748 COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
749 ifdef CONFIG_COREAUDIO
750 COCOA_LIBS+=-framework CoreAudio
751 endif
752 endif
753 ifdef CONFIG_SLIRP
754 CPPFLAGS+=-I$(SRC_PATH)/slirp
755 endif
757 LIBS+=$(PTHREADLIBS)
758 LIBS+=$(CLOCKLIBS)
759 # specific flags are needed for non soft mmu emulator
760 ifdef CONFIG_STATIC
761 LDFLAGS+=-static
762 endif
763 ifndef CONFIG_DARWIN
764 ifndef CONFIG_WIN32
765 ifndef CONFIG_SOLARIS
766 ifndef CONFIG_AIX
767 LIBS+=-lutil
768 endif
769 endif
770 endif
771 endif
772 ifdef TARGET_GPROF
773 vl.o: CFLAGS+=-p
774 LDFLAGS+=-p
775 endif
777 ifeq ($(ARCH),ia64)
778 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
779 endif
781 ifdef CONFIG_WIN32
782 SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
783 endif
785 # profiling code
786 ifdef TARGET_GPROF
787 LDFLAGS+=-p
788 main.o: CFLAGS+=-p
789 endif
790 ifeq ($(TARGET_ARCH), ia64)
791 firmware.o: firmware.c
792         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
793 endif
795 vl.o: qemu-options.h
797 $(QEMU_PROG): LIBS += $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS)
798 $(QEMU_PROG): ARLIBS=../libqemu_common.a libqemu.a $(HWLIB)
799 $(QEMU_PROG): $(OBJS) ../libqemu_common.a libqemu.a $(HWLIB)
800         $(call LINK,$(OBJS))
802 $(QEMU_PROG): ARLIBS += $(DEPLIBS)
803 $(QEMU_PROG): $(DEPLIBS)
805 FORCE:
807 libkvm.a: FORCE
808         $(MAKE) -C ../kvm/libkvm KVM_CFLAGS="$(KVM_CFLAGS)"
809         if ! cmp -s libkvm.a ../kvm/libkvm/libkvm.a; then \
810            cp ../kvm/libkvm/libkvm.a . ; \
811         fi
813 endif # !CONFIG_USER_ONLY
815 gdbstub-xml.c: $(TARGET_XML_FILES) feature_to_c.sh
816 ifeq ($(TARGET_XML_FILES),)
817         $(call quiet-command,rm -f $@ && echo > $@,"  GEN   $(TARGET_DIR)$@")
818 else
819         $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/feature_to_c.sh $@ $(TARGET_XML_FILES),"  GEN   $(TARGET_DIR)$@")
820 endif
822 qemu-options.h: $(SRC_PATH)/qemu-options.hx
823         $(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
825 clean:
826         rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o qemu-options.h gdbstub-xml.c
827         rm -f *.d */*.d tcg/*.o
828 ifdef USE_KVM
829         $(MAKE) -C ../kvm/libkvm clean
830 endif
832 install: all
833 ifneq ($(PROGS),)
834         $(INSTALL) -m 755 $(STRIP_OPT) $(PROGS) "$(DESTDIR)$(bindir)"
835 endif
837 # Include automatically generated dependency files
838 -include $(wildcard *.d */*.d)