Read kvm version from KVM_VERSION file
[qemu-kvm/fedora.git] / Makefile.target
blobbe97e6b6764bedda8d8b39ebc3660c25dbcd34bc
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 qemu-kvm.o qemu-kvm-x86.o device-assignment.o ioapic.o i8259.o i8254-kvm.o \
144         kvm-tpr-opt.o apic.o:  CFLAGS+=$(KVM_CFLAGS)
146 all: $(PROGS)
148 #########################################################
149 # cpu emulator library
150 LIBOBJS=exec.o kqemu.o cpu-exec.o host-utils.o
152 ifeq ($(NO_CPU_EMULATION), 1)
153 LIBOBJS+=fake-exec.o
154 else
155 LIBOBJS+= translate-all.o translate.o
156 # TCG code generator
157 LIBOBJS+= tcg/tcg.o tcg/tcg-runtime.o
158 CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH)
159 endif
160 ifeq ($(ARCH),sparc64)
161 CPPFLAGS+=-I$(SRC_PATH)/tcg/sparc
162 endif
164 ifeq ($(USE_KVM), 1)
165 LIBOBJS+=qemu-kvm.o
166 endif
167 ifdef CONFIG_SOFTFLOAT
168 LIBOBJS+=fpu/softfloat.o
169 else
170 LIBOBJS+=fpu/softfloat-native.o
171 endif
172 CPPFLAGS+=-I$(SRC_PATH)/fpu
173 LIBOBJS+= op_helper.o helper.o
175 ifeq ($(TARGET_ARCH), i386)
176 LIBOBJS+=helper.o
177 ifeq ($(USE_KVM), 1)
178 LIBOBJS+=qemu-kvm-x86.o kvm-tpr-opt.o
179 LIBOBJS+=qemu-kvm-helper.o
180 endif
181 endif
183 ifeq ($(TARGET_ARCH), x86_64)
184 LIBOBJS+=helper.o
185 ifeq ($(USE_KVM), 1)
186 LIBOBJS+=qemu-kvm-x86.o kvm-tpr-opt.o
187 LIBOBJS+=qemu-kvm-helper.o
188 endif
189 endif
191 LIBOBJS+= op_helper.o
193 ifneq ($(TARGET_ARCH), ia64)
194 LIBOBJS+= helper.o
195 endif
197 ifeq ($(TARGET_BASE_ARCH), arm)
198 LIBOBJS+= neon_helper.o iwmmxt_helper.o
199 endif
201 ifeq ($(TARGET_BASE_ARCH), alpha)
202 LIBOBJS+= alpha_palcode.o
203 endif
205 ifeq ($(TARGET_BASE_ARCH), ia64)
206 LIBOBJS+=op_helper.o firmware.o
207 ifeq ($(USE_KVM), 1)
208 LIBOBJS+=qemu-kvm-ia64.o
209 endif
210 endif
212 ifeq ($(TARGET_BASE_ARCH), cris)
213 LIBOBJS+= cris-dis.o
215 ifndef CONFIG_USER_ONLY
216 LIBOBJS+= mmu.o
217 endif
218 endif
221 # NOTE: the disassembler code is only needed for debugging
222 LIBOBJS+=disas.o
223 ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
224 USE_I386_DIS=y
225 endif
226 ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
227 USE_I386_DIS=y
228 endif
229 ifdef USE_I386_DIS
230 LIBOBJS+=i386-dis.o
231 endif
232 ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
233 LIBOBJS+=alpha-dis.o
234 endif
235 ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
236 LIBOBJS+=ppc-dis.o
237 endif
238 ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips)
239 LIBOBJS+=mips-dis.o
240 endif
241 ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
242 LIBOBJS+=sparc-dis.o
243 endif
244 ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
245 LIBOBJS+=arm-dis.o
246 endif
247 ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
248 LIBOBJS+=m68k-dis.o
249 endif
250 ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
251 LIBOBJS+=sh4-dis.o
252 endif
253 ifeq ($(findstring hppa, $(TARGET_BASE_ARCH) $(ARCH)),hppa)
254 LIBOBJS+=hppa-dis.o
255 endif
256 ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390)
257 LIBOBJS+=s390-dis.o
258 endif
260 # libqemu
262 libqemu.a: $(LIBOBJS)
264 translate.o: translate.c cpu.h
266 translate-all.o: translate-all.c cpu.h
268 tcg/tcg.o: cpu.h
270 # HELPER_CFLAGS is used for all the code compiled with static register
271 # variables
272 op_helper.o: CFLAGS += $(HELPER_CFLAGS) $(I386_CFLAGS)
274 cpu-exec.o: CFLAGS += $(HELPER_CFLAGS)
276 qemu-kvm-helper.o: qemu-kvm-helper.c
277         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
279 #########################################################
280 # Linux user emulator target
282 ifdef CONFIG_LINUX_USER
284 ifndef TARGET_ABI_DIR
285   TARGET_ABI_DIR=$(TARGET_ARCH)
286 endif
287 VPATH+=:$(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
288 CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
290 ifdef CONFIG_STATIC
291 LDFLAGS+=-static
292 endif
294 ifeq ($(ARCH),i386)
295 ifdef TARGET_GPROF
296 USE_I386_LD=y
297 endif
298 ifdef CONFIG_STATIC
299 USE_I386_LD=y
300 endif
301 ifdef USE_I386_LD
302 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
303 else
304 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
305 # that the kernel ELF loader considers as an executable. I think this
306 # is the simplest way to make it self virtualizable!
307 LDFLAGS+=-Wl,-shared
308 endif
309 endif
311 ifeq ($(ARCH),x86_64)
312 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
313 endif
315 ifeq ($(ARCH),ppc)
316 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
317 endif
319 ifeq ($(ARCH),ppc64)
320 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
321 endif
323 ifeq ($(ARCH),s390)
324 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
325 endif
327 ifeq ($(ARCH),sparc)
328 # -static is used to avoid g1/g3 usage by the dynamic linker    
329 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
330 endif
332 ifeq ($(ARCH),sparc64)
333 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
334 endif
336 ifeq ($(ARCH),alpha)
337 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
338 endif
340 ifeq ($(ARCH),ia64)
341 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
342 endif
344 ifeq ($(ARCH),arm)
345 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
346 endif
348 ifeq ($(ARCH),m68k)
349 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
350 endif
352 ifeq ($(ARCH),mips)
353 ifeq ($(WORDS_BIGENDIAN),yes)
354 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
355 else
356 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
357 endif
358 endif
360 ifeq ($(ARCH),mips64)
361 ifeq ($(WORDS_BIGENDIAN),yes)
362 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
363 else
364 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
365 endif
366 endif
368 # profiling code
369 ifdef TARGET_GPROF
370 LDFLAGS+=-p
371 CFLAGS+=-p
372 endif
374 OBJS= main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \
375       elfload.o linuxload.o uaccess.o envlist.o
376 LIBS+= $(AIOLIBS)
377 ifdef TARGET_HAS_BFLT
378 OBJS+= flatload.o
379 endif
380 ifdef TARGET_HAS_ELFLOAD32
381 OBJS+= elfload32.o
382 elfload32.o: elfload.c
383 endif
385 ifeq ($(TARGET_ARCH), i386)
386 OBJS+= vm86.o
387 endif
388 ifeq ($(TARGET_ARCH), arm)
389 OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
390 nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
391  nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o
392 endif
393 ifeq ($(TARGET_ARCH), m68k)
394 OBJS+= m68k-sim.o m68k-semi.o
395 endif
397 ifdef CONFIG_GDBSTUB
398 OBJS+=gdbstub.o gdbstub-xml.o
399 endif
401 OBJS+= libqemu.a
403 # Note: this is a workaround. The real fix is to avoid compiling
404 # cpu_signal_handler() in cpu-exec.c.
405 signal.o: CFLAGS += $(HELPER_CFLAGS)
407 $(QEMU_PROG): $(OBJS) ../libqemu_user.a
408         $(LINK)
409 ifeq ($(ARCH),alpha)
410 # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
411 # the address space (31 bit so sign extending doesn't matter)
412         echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
413 endif
415 endif #CONFIG_LINUX_USER
417 #########################################################
418 # Darwin user emulator target
420 ifdef CONFIG_DARWIN_USER
422 VPATH+=:$(SRC_PATH)/darwin-user
423 CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
425 # Leave some space for the regular program loading zone
426 LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000
428 LIBS+=-lmx
430 OBJS= main.o commpage.o machload.o mmap.o signal.o syscall.o thunk.o
432 OBJS+= libqemu.a
434 ifdef CONFIG_GDBSTUB
435 OBJS+=gdbstub.o gdbstub-xml.o
436 endif
438 # Note: this is a workaround. The real fix is to avoid compiling
439 # cpu_signal_handler() in cpu-exec.c.
440 signal.o: CFLAGS += $(HELPER_CFLAGS)
442 $(QEMU_PROG): $(OBJS)
443         $(LINK)
445 endif #CONFIG_DARWIN_USER
447 #########################################################
448 # BSD user emulator target
450 ifdef CONFIG_BSD_USER
452 VPATH+=:$(SRC_PATH)/bsd-user
453 CPPFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
455 ifdef CONFIG_STATIC
456 LDFLAGS+=-static
457 endif
459 ifeq ($(ARCH),i386)
460 ifdef TARGET_GPROF
461 USE_I386_LD=y
462 endif
463 ifdef CONFIG_STATIC
464 USE_I386_LD=y
465 endif
466 ifdef USE_I386_LD
467 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
468 else
469 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
470 # that the kernel ELF loader considers as an executable. I think this
471 # is the simplest way to make it self virtualizable!
472 LDFLAGS+=-Wl,-shared
473 endif
474 endif
476 ifeq ($(ARCH),x86_64)
477 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
478 endif
480 ifeq ($(ARCH),ppc)
481 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
482 endif
484 ifeq ($(ARCH),ppc64)
485 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
486 endif
488 ifeq ($(ARCH),s390)
489 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
490 endif
492 ifeq ($(ARCH),sparc)
493 # -static is used to avoid g1/g3 usage by the dynamic linker
494 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
495 endif
497 ifeq ($(ARCH),sparc64)
498 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
499 endif
501 ifeq ($(ARCH),alpha)
502 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
503 endif
505 ifeq ($(ARCH),ia64)
506 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
507 endif
509 ifeq ($(ARCH),arm)
510 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
511 endif
513 ifeq ($(ARCH),m68k)
514 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
515 endif
517 ifeq ($(ARCH),mips)
518 ifeq ($(WORDS_BIGENDIAN),yes)
519 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
520 else
521 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
522 endif
523 endif
525 ifeq ($(ARCH),mips64)
526 ifeq ($(WORDS_BIGENDIAN),yes)
527 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
528 else
529 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
530 endif
531 endif
533 OBJS= main.o bsdload.o elfload.o mmap.o path.o signal.o strace.o syscall.o
534 OBJS+= uaccess.o
536 OBJS+= libqemu.a
538 ifdef CONFIG_GDBSTUB
539 OBJS+=gdbstub.o
540 endif
542 # Note: this is a workaround. The real fix is to avoid compiling
543 # cpu_signal_handler() in cpu-exec.c.
544 signal.o: CFLAGS += $(HELPER_CFLAGS)
546 $(QEMU_PROG): $(OBJS) ../libqemu_user.a
547         $(LINK)
549 endif #CONFIG_BSD_USER
551 #########################################################
552 # System emulator target
553 ifndef CONFIG_USER_ONLY
555 OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o dma-helpers.o
556 # virtio has to be here due to weird dependency between PCI and virtio-net.
557 # need to fix this properly
558 OBJS+=virtio.o virtio-blk.o virtio-balloon.o virtio-net.o virtio-console.o
559 OBJS+=fw_cfg.o
560 ifdef CONFIG_KVM
561 OBJS+=kvm.o kvm-all.o
562 endif
563 ifdef CONFIG_WIN32
564 OBJS+=block-raw-win32.o
565 else
566 ifdef CONFIG_AIO
567 OBJS+=posix-aio-compat.o
568 endif
569 OBJS+=block-raw-posix.o
570 endif
572 ifdef CONFIG_AIO
573 OBJS+=compatfd.o
574 endif
576 LIBS+=-lz
577 ifdef CONFIG_ALSA
578 LIBS += -lasound
579 endif
580 ifdef CONFIG_ESD
581 LIBS += -lesd
582 endif
583 ifdef CONFIG_PA
584 LIBS += -lpulse-simple
585 endif
586 ifdef CONFIG_DSOUND
587 LIBS += -lole32 -ldxguid
588 endif
589 ifdef CONFIG_FMOD
590 LIBS += $(CONFIG_FMOD_LIB)
591 endif
592 ifdef CONFIG_OSS
593 LIBS += $(CONFIG_OSS_LIB)
594 endif
596 SOUND_HW = sb16.o es1370.o ac97.o
597 ifdef CONFIG_ADLIB
598 SOUND_HW += fmopl.o adlib.o
599 adlib.o fmopl.o: CFLAGS := ${CFLAGS} -DBUILD_Y8950=0
600 endif
601 ifdef CONFIG_GUS
602 SOUND_HW += gus.o gusemu_hal.o gusemu_mixer.o
603 endif
604 ifdef CONFIG_CS4231A
605 SOUND_HW += cs4231a.o
606 endif
608 ifdef USE_KVM
609 DEPLIBS += libkvm.a
610 endif
612 ifdef CONFIG_VNC_TLS
613 CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
614 LIBS += $(CONFIG_VNC_TLS_LIBS)
615 endif
617 ifdef CONFIG_BLUEZ
618 LIBS += $(CONFIG_BLUEZ_LIBS)
619 endif
621 # SCSI layer
622 OBJS+= lsi53c895a.o esp.o
624 # USB layer
625 OBJS+= usb-ohci.o
627 # EEPROM emulation
628 OBJS += eeprom93xx.o
630 # PCI network cards
631 OBJS += eepro100.o
632 OBJS += ne2000.o
633 OBJS += pcnet.o
634 OBJS += rtl8139.o
635 OBJS += e1000.o
637 # Serial mouse
638 OBJS += msmouse.o
640 ifeq ($(USE_KVM_DEVICE_ASSIGNMENT), 1)
641 OBJS+= device-assignment.o
642 endif
644 ifeq ($(TARGET_BASE_ARCH), i386)
645 # Hardware support
646 OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o
647 OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
648 OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o
649 OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
650 OBJS += device-hotplug.o pci-hotplug.o
651 OBJS+= extboot.o
652 # virtio support
653 OBJS+= virtio.o virtio-blk.o virtio-balloon.o
654 OBJS += virtio-net.o
655 ifeq ($(USE_KVM_PIT), 1)
656 OBJS+= i8254-kvm.o
657 endif
658 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
659 endif
660 ifeq ($(TARGET_BASE_ARCH), ia64)
661 # Hardware support
662 OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
663 OBJS+= fdc.o mc146818rtc.o serial.o i8259.o ipf.o
664 OBJS+= cirrus_vga.o parallel.o acpi.o piix_pci.o
665 OBJS+= usb-uhci.o smbus_eeprom.o
666 # virtio support
667 OBJS+= virtio.o virtio-blk.o virtio-balloon.o
668 OBJS+= virtio-net.o
669 endif
670 ifeq ($(TARGET_BASE_ARCH), ppc)
671 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
672 # shared objects
673 OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o
674 OBJS+= cirrus_vga.o
675 # PREP target
676 OBJS+= pckbd.o ps2.o serial.o i8259.o i8254.o fdc.o m48t59.o mc146818rtc.o
677 OBJS+= prep_pci.o ppc_prep.o
678 # Mac shared devices
679 OBJS+= macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o escc.o
680 # OldWorld PowerMac
681 OBJS+= heathrow_pic.o grackle_pci.o ppc_oldworld.o
682 # NewWorld PowerMac
683 OBJS+= unin_pci.o ppc_newworld.o
684 # PowerPC 4xx boards
685 OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o
686 OBJS+= ppc440.o ppc440_bamboo.o
687 # PowerPC E500 boards
688 OBJS+= ppce500_pci.o ppce500_mpc8544ds.o
689 ifdef FDT_LIBS
690 OBJS+= device_tree.o
691 LIBS+= $(FDT_LIBS)
692 endif
693 ifdef CONFIG_KVM
694 OBJS+= kvm_ppc.o
695 endif
696 endif
697 ifeq ($(TARGET_BASE_ARCH), mips)
698 OBJS+= mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o
699 OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o rc4030.o
700 OBJS+= g364fb.o jazz_led.o
701 OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
702 OBJS+= piix_pci.o parallel.o cirrus_vga.o pcspk.o $(SOUND_HW)
703 OBJS+= mipsnet.o
704 OBJS+= pflash_cfi01.o
705 OBJS+= vmware_vga.o
706 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
707 endif
708 ifeq ($(TARGET_BASE_ARCH), cris)
709 # Boards
710 OBJS+= etraxfs.o axis_dev88.o
712 # IO blocks
713 OBJS+= etraxfs_dma.o
714 OBJS+= etraxfs_pic.o
715 OBJS+= etraxfs_eth.o
716 OBJS+= etraxfs_timer.o
717 OBJS+= etraxfs_ser.o
719 OBJS+= ptimer.o
720 OBJS+= pflash_cfi02.o nand.o
721 endif
722 ifeq ($(TARGET_BASE_ARCH), sparc)
723 ifeq ($(TARGET_ARCH), sparc64)
724 OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o
725 OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o
726 OBJS+= cirrus_vga.o parallel.o ptimer.o
727 else
728 OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o
729 OBJS+= slavio_timer.o escc.o slavio_misc.o fdc.o sparc32_dma.o
730 OBJS+= cs4231.o ptimer.o eccmemctl.o sbi.o sun4c_intctl.o
731 endif
732 endif
733 ifeq ($(TARGET_BASE_ARCH), arm)
734 OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o
735 OBJS+= arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
736 OBJS+= versatile_pci.o ptimer.o
737 OBJS+= realview_gic.o realview.o arm_sysctl.o mpcore.o
738 OBJS+= armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
739 OBJS+= pl061.o
740 OBJS+= arm-semi.o
741 OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
742 OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
743 OBJS+= pflash_cfi01.o gumstix.o
744 OBJS+= zaurus.o ide.o serial.o nand.o ecc.o spitz.o tosa.o tc6393xb.o
745 OBJS+= omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o
746 OBJS+= omap2.o omap_dss.o soc_dma.o
747 OBJS+= omap_sx1.o palm.o tsc210x.o
748 OBJS+= nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o
749 OBJS+= tsc2005.o bt-hci-csr.o
750 OBJS+= mst_fpga.o mainstone.o
751 OBJS+= musicpal.o pflash_cfi02.o
752 CPPFLAGS += -DHAS_AUDIO
753 endif
754 ifeq ($(TARGET_BASE_ARCH), sh4)
755 OBJS+= shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
756 OBJS+= sh_timer.o ptimer.o sh_serial.o sh_intc.o sh_pci.o sm501.o serial.o
757 OBJS+= ide.o
758 endif
759 ifeq ($(TARGET_BASE_ARCH), m68k)
760 OBJS+= an5206.o mcf5206.o ptimer.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
761 OBJS+= m68k-semi.o dummy_m68k.o
762 endif
763 ifdef CONFIG_GDBSTUB
764 OBJS+=gdbstub.o gdbstub-xml.o
765 endif
766 ifdef CONFIG_COCOA
767 COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
768 ifdef CONFIG_COREAUDIO
769 COCOA_LIBS+=-framework CoreAudio
770 endif
771 endif
772 ifdef CONFIG_SLIRP
773 CPPFLAGS+=-I$(SRC_PATH)/slirp
774 endif
776 LIBS+=$(AIOLIBS)
777 # specific flags are needed for non soft mmu emulator
778 ifdef CONFIG_STATIC
779 LDFLAGS+=-static
780 endif
781 ifndef CONFIG_DARWIN
782 ifndef CONFIG_WIN32
783 ifndef CONFIG_SOLARIS
784 ifndef CONFIG_AIX
785 LIBS+=-lutil
786 endif
787 endif
788 endif
789 endif
790 ifdef TARGET_GPROF
791 vl.o: CFLAGS+=-p
792 LDFLAGS+=-p
793 endif
795 ifeq ($(ARCH),ia64)
796 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
797 endif
799 ifdef CONFIG_WIN32
800 SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
801 endif
803 # profiling code
804 ifdef TARGET_GPROF
805 LDFLAGS+=-p
806 main.o: CFLAGS+=-p
807 endif
808 ifeq ($(TARGET_ARCH), ia64)
809 firmware.o: firmware.c
810         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
811 endif
813 $(QEMU_PROG): LIBS += $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS)
815 $(QEMU_PROG): $(OBJS) ../libqemu_common.a libqemu.a $(DEPLIBS)
816         $(LINK)
818 FORCE:
820 libkvm.a: FORCE
821         $(MAKE) -C ../kvm/libkvm KVM_CFLAGS="$(KVM_CFLAGS)"
822         if ! cmp -s libkvm.a ../kvm/libkvm/libkvm.a; then \
823            cp ../kvm/libkvm/libkvm.a . ; \
824         fi
826 endif # !CONFIG_USER_ONLY
828 gdbstub-xml.c: $(TARGET_XML_FILES) feature_to_c.sh
829         rm -f $@
830 ifeq ($(TARGET_XML_FILES),)
831         echo > $@
832 else
833         $(SHELL) $(SRC_PATH)/feature_to_c.sh $@ $(TARGET_XML_FILES)
834 endif
836 clean:
837         rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o
838         rm -f *.d */*.d tcg/*.o
840 install: all
841 ifneq ($(PROGS),)
842         $(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)"
843 endif
845 # Include automatically generated dependency files
846 -include $(wildcard *.d */*.d)