Refactor persistent CPU state
[qemu-kvm/fedora.git] / Makefile.target
blob0097aa89dbfa3403bc7a54a0da03c67c99d7c4d4
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 libkvm.o libkvm-all.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 CONFIG_VNC_TLS
583 CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
584 LIBS += $(CONFIG_VNC_TLS_LIBS)
585 endif
587 ifdef CONFIG_VNC_SASL
588 CPPFLAGS += $(CONFIG_VNC_SASL_CFLAGS)
589 LIBS += $(CONFIG_VNC_SASL_LIBS)
590 endif
592 ifdef CONFIG_BLUEZ
593 LIBS += $(CONFIG_BLUEZ_LIBS)
594 endif
596 # xen backend driver support
597 XEN_OBJS := xen_machine_pv.o xen_domainbuild.o
598 ifeq ($(CONFIG_XEN), yes)
599   OBJS += $(XEN_OBJS)
600   LIBS += $(XEN_LIBS)
601 endif
603 # USB layer
604 OBJS+= usb-ohci.o
606 # PCI network cards
607 OBJS += eepro100.o
608 OBJS += ne2000.o
609 OBJS += pcnet.o
610 OBJS += rtl8139.o
611 OBJS += e1000.o
613 # Generic watchdog support and some watchdog devices
614 OBJS += wdt_ib700.o wdt_i6300esb.o
616 ifeq ($(USE_KVM_DEVICE_ASSIGNMENT), 1)
617 OBJS+= device-assignment.o
618 LIBS+=-lpci
619 endif
621 ifeq ($(TARGET_BASE_ARCH), i386)
622 # Hardware support
623 OBJS+= ide.o pckbd.o vga.o $(SOUND_HW) dma.o
624 OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
625 OBJS+= cirrus_vga.o apic.o ioapic.o parallel.o acpi.o piix_pci.o
626 OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
627 OBJS += device-hotplug.o pci-hotplug.o smbios.o
628 OBJS+= extboot.o
629 ifeq ($(USE_KVM_PIT), 1)
630 OBJS+= i8254-kvm.o
631 endif
632 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
633 endif
634 ifeq ($(TARGET_BASE_ARCH), ia64)
635 # Hardware support
636 OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
637 OBJS+= fdc.o mc146818rtc.o serial.o i8259.o ipf.o
638 OBJS+= cirrus_vga.o parallel.o acpi.o piix_pci.o
639 OBJS+= usb-uhci.o smbus_eeprom.o
640 # virtio support
641 OBJS+= virtio.o virtio-blk.o virtio-balloon.o
642 OBJS+= virtio-net.o
643 endif
644 ifeq ($(TARGET_BASE_ARCH), ppc)
645 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
646 # shared objects
647 OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o
648 OBJS+= cirrus_vga.o
649 # PREP target
650 OBJS+= pckbd.o serial.o i8259.o i8254.o fdc.o mc146818rtc.o
651 OBJS+= prep_pci.o ppc_prep.o
652 # Mac shared devices
653 OBJS+= macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o
654 # OldWorld PowerMac
655 OBJS+= heathrow_pic.o grackle_pci.o ppc_oldworld.o
656 # NewWorld PowerMac
657 OBJS+= unin_pci.o ppc_newworld.o
658 # PowerPC 4xx boards
659 OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o
660 OBJS+= ppc440.o ppc440_bamboo.o
661 # PowerPC E500 boards
662 OBJS+= ppce500_pci.o ppce500_mpc8544ds.o
663 ifdef FDT_LIBS
664 OBJS+= device_tree.o
665 LIBS+= $(FDT_LIBS)
666 endif
667 ifdef CONFIG_KVM
668 OBJS+= kvm_ppc.o
669 endif
670 endif
671 ifeq ($(TARGET_BASE_ARCH), mips)
672 OBJS+= mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o
673 OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o rc4030.o
674 OBJS+= g364fb.o jazz_led.o dp8393x.o
675 OBJS+= ide.o gt64xxx.o pckbd.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
676 OBJS+= piix_pci.o parallel.o cirrus_vga.o pcspk.o $(SOUND_HW)
677 OBJS+= mipsnet.o
678 OBJS+= pflash_cfi01.o
679 OBJS+= vmware_vga.o
680 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
681 endif
682 ifeq ($(TARGET_BASE_ARCH), cris)
683 # Boards
684 OBJS+= cris_pic_cpu.o etraxfs.o axis_dev88.o
686 # IO blocks
687 OBJS+= etraxfs_dma.o
688 OBJS+= etraxfs_pic.o
689 OBJS+= etraxfs_eth.o
690 OBJS+= etraxfs_timer.o
691 OBJS+= etraxfs_ser.o
693 OBJS+= pflash_cfi02.o
694 endif
695 ifeq ($(TARGET_BASE_ARCH), sparc)
696 ifeq ($(TARGET_ARCH), sparc64)
697 OBJS+= sun4u.o ide.o pckbd.o vga.o apb_pci.o
698 OBJS+= fdc.o mc146818rtc.o serial.o
699 OBJS+= cirrus_vga.o parallel.o
700 else
701 OBJS+= sun4m.o tcx.o iommu.o slavio_intctl.o
702 OBJS+= slavio_timer.o slavio_misc.o fdc.o sparc32_dma.o
703 OBJS+= cs4231.o eccmemctl.o sbi.o sun4c_intctl.o
704 endif
705 endif
706 ifeq ($(TARGET_BASE_ARCH), arm)
707 OBJS+= integratorcp.o versatilepb.o smc91c111.o arm_pic.o arm_timer.o
708 OBJS+= arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
709 OBJS+= versatile_pci.o
710 OBJS+= realview_gic.o realview.o arm_sysctl.o mpcore.o
711 OBJS+= armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
712 OBJS+= pl061.o
713 OBJS+= arm-semi.o
714 OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
715 OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
716 OBJS+= pflash_cfi01.o gumstix.o
717 OBJS+= zaurus.o ide.o serial.o spitz.o tosa.o tc6393xb.o
718 OBJS+= omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o
719 OBJS+= omap2.o omap_dss.o soc_dma.o
720 OBJS+= omap_sx1.o palm.o tsc210x.o
721 OBJS+= nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o
722 OBJS+= mst_fpga.o mainstone.o
723 OBJS+= musicpal.o pflash_cfi02.o
724 OBJS+= framebuffer.o
725 OBJS+= syborg.o syborg_fb.o syborg_interrupt.o syborg_keyboard.o
726 OBJS+= syborg_serial.o syborg_timer.o syborg_pointer.o syborg_rtc.o
727 OBJS+= syborg_virtio.o
728 CPPFLAGS += -DHAS_AUDIO
729 endif
730 ifeq ($(TARGET_BASE_ARCH), sh4)
731 OBJS+= shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
732 OBJS+= sh_timer.o sh_serial.o sh_intc.o sh_pci.o sm501.o serial.o
733 OBJS+= ide.o
734 endif
735 ifeq ($(TARGET_BASE_ARCH), m68k)
736 OBJS+= an5206.o mcf5206.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
737 OBJS+= m68k-semi.o dummy_m68k.o
738 endif
739 ifdef CONFIG_COCOA
740 COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
741 ifdef CONFIG_COREAUDIO
742 COCOA_LIBS+=-framework CoreAudio
743 endif
744 endif
745 ifdef CONFIG_SLIRP
746 CPPFLAGS+=-I$(SRC_PATH)/slirp
747 endif
749 LIBS+=$(PTHREADLIBS)
750 LIBS+=$(CLOCKLIBS)
751 # specific flags are needed for non soft mmu emulator
752 ifdef CONFIG_STATIC
753 LDFLAGS+=-static
754 endif
755 ifndef CONFIG_DARWIN
756 ifndef CONFIG_WIN32
757 ifndef CONFIG_SOLARIS
758 ifndef CONFIG_AIX
759 LIBS+=-lutil
760 endif
761 endif
762 endif
763 endif
764 ifdef TARGET_GPROF
765 vl.o: CFLAGS+=-p
766 LDFLAGS+=-p
767 endif
769 ifeq ($(ARCH),ia64)
770 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
771 endif
773 ifdef CONFIG_WIN32
774 SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
775 endif
777 # profiling code
778 ifdef TARGET_GPROF
779 LDFLAGS+=-p
780 main.o: CFLAGS+=-p
781 endif
782 ifeq ($(TARGET_ARCH), ia64)
783 firmware.o: firmware.c
784         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
785 endif
787 vl.o: qemu-options.h
789 $(QEMU_PROG): LIBS += $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS) $(CURL_LIBS)
790 $(QEMU_PROG): ARLIBS=../libqemu_common.a libqemu.a $(HWLIB)
791 $(QEMU_PROG): $(OBJS) ../libqemu_common.a libqemu.a $(HWLIB)
792         $(call LINK,$(OBJS))
794 $(QEMU_PROG): ARLIBS += $(DEPLIBS)
795 $(QEMU_PROG): $(DEPLIBS)
797 endif # !CONFIG_USER_ONLY
799 gdbstub-xml.c: $(TARGET_XML_FILES) feature_to_c.sh
800 ifeq ($(TARGET_XML_FILES),)
801         $(call quiet-command,rm -f $@ && echo > $@,"  GEN   $(TARGET_DIR)$@")
802 else
803         $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/feature_to_c.sh $@ $(TARGET_XML_FILES),"  GEN   $(TARGET_DIR)$@")
804 endif
806 qemu-options.h: $(SRC_PATH)/qemu-options.hx
807         $(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
809 clean:
810         rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o qemu-options.h gdbstub-xml.c
811         rm -f *.d */*.d tcg/*.o
813 install: all
814 ifneq ($(PROGS),)
815         $(INSTALL) -m 755 $(STRIP_OPT) $(PROGS) "$(DESTDIR)$(bindir)"
816 endif
818 # Include automatically generated dependency files
819 -include $(wildcard *.d */*.d)