Merge commit 'd918f23efaf486293b96418fe5deaff8a5583304' into upstream-merge
[qemu-kvm/fedora.git] / Makefile.target
blob82fcd54b2b0752bdea0fc0d4850d5c2d1838be6f
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
121 CPPFLAGS+=-U_FORTIFY_SOURCE
122 CPPFLAGS+=-D__user=
123 LIBS+=-lm
124 ifdef CONFIG_WIN32
125 LIBS+=-lwinmm -lws2_32 -liphlpapi
126 endif
127 ifdef CONFIG_SOLARIS
128 LIBS+=-lsocket -lnsl -lresolv
129 ifdef NEEDS_LIBSUNMATH
130 LIBS+=-lsunmath
131 LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib
132 CFLAGS+=-I/opt/SUNWspro/prod/include/cc
133 endif
134 endif
136 kvm.o: CFLAGS+=$(KVM_CFLAGS)
137 kvm-all.o: CFLAGS+=$(KVM_CFLAGS)
139 CFLAGS += $(KVM_CFLAGS)
141 all: $(PROGS)
142 # Dummy command so that make thinks it has done something
143         @true
145 #########################################################
146 # cpu emulator library
147 ifeq ($(NO_CPU_EMULATION), 1)
148 LIBOBJS=exec.o fake-exec.o cpu-exec.o host-utils.o
149 else
150 LIBOBJS=exec.o translate-all.o cpu-exec.o\
151         translate.o host-utils.o
152 endif
154 ifdef CONFIG_KQEMU
155 LIBOBJS+= kqemu.o
156 endif
157 # TCG code generator
158 ifneq ($(NO_CPU_EMULATION), 1)
159 LIBOBJS+= tcg/tcg.o tcg/tcg-runtime.o
160 CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH)
161 endif
162 ifeq ($(ARCH),sparc64)
163 CPPFLAGS+=-I$(SRC_PATH)/tcg/sparc
164 endif
166 ifeq ($(USE_KVM), 1)
167 LIBOBJS+=qemu-kvm.o
168 endif
169 ifdef CONFIG_SOFTFLOAT
170 LIBOBJS+=fpu/softfloat.o
171 else
172 LIBOBJS+=fpu/softfloat-native.o
173 endif
174 CPPFLAGS+=-I$(SRC_PATH)/fpu
175 LIBOBJS+= op_helper.o helper.o
177 ifeq ($(TARGET_ARCH), i386)
178 LIBOBJS+=helper.o
179 ifeq ($(USE_KVM), 1)
180 LIBOBJS+=qemu-kvm-x86.o kvm-tpr-opt.o
181 LIBOBJS+=qemu-kvm-helper.o
182 endif
183 endif
185 ifeq ($(TARGET_ARCH), x86_64)
186 LIBOBJS+=helper.o
187 ifeq ($(USE_KVM), 1)
188 LIBOBJS+=qemu-kvm-x86.o kvm-tpr-opt.o
189 LIBOBJS+=qemu-kvm-helper.o
190 endif
191 endif
193 LIBOBJS+= op_helper.o
195 ifneq ($(TARGET_ARCH), ia64)
196 LIBOBJS+= helper.o
197 endif
199 ifeq ($(TARGET_BASE_ARCH), arm)
200 LIBOBJS+= neon_helper.o iwmmxt_helper.o
201 endif
203 ifeq ($(TARGET_BASE_ARCH), alpha)
204 LIBOBJS+= alpha_palcode.o
205 endif
207 ifeq ($(TARGET_BASE_ARCH), ia64)
208 LIBOBJS+=op_helper.o firmware.o
209 ifeq ($(USE_KVM), 1)
210 LIBOBJS+=qemu-kvm-ia64.o
211 endif
212 endif
214 ifeq ($(TARGET_BASE_ARCH), cris)
215 LIBOBJS+= cris-dis.o
217 ifndef CONFIG_USER_ONLY
218 LIBOBJS+= mmu.o
219 endif
220 endif
223 # NOTE: the disassembler code is only needed for debugging
224 LIBOBJS+=disas.o
225 ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
226 USE_I386_DIS=y
227 endif
228 ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
229 USE_I386_DIS=y
230 endif
231 ifdef USE_I386_DIS
232 LIBOBJS+=i386-dis.o
233 endif
234 ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
235 LIBOBJS+=alpha-dis.o
236 endif
237 ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
238 LIBOBJS+=ppc-dis.o
239 endif
240 ifeq ($(findstring microblaze, $(TARGET_BASE_ARCH) $(ARCH)),microblaze)
241 LIBOBJS+=microblaze-dis.o
242 ifndef CONFIG_USER_ONLY
243 LIBOBJS+= mmu.o
244 endif
245 endif
246 ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips)
247 LIBOBJS+=mips-dis.o
248 endif
249 ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
250 LIBOBJS+=sparc-dis.o
251 endif
252 ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
253 LIBOBJS+=arm-dis.o
254 endif
255 ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
256 LIBOBJS+=m68k-dis.o
257 endif
258 ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
259 LIBOBJS+=sh4-dis.o
260 endif
261 ifeq ($(findstring hppa, $(TARGET_BASE_ARCH) $(ARCH)),hppa)
262 LIBOBJS+=hppa-dis.o
263 endif
264 ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390)
265 LIBOBJS+=s390-dis.o
266 endif
268 # libqemu
270 libqemu.a: $(LIBOBJS)
272 translate.o: translate.c cpu.h
274 translate-all.o: translate-all.c cpu.h
276 tcg/tcg.o: cpu.h
278 # HELPER_CFLAGS is used for all the code compiled with static register
279 # variables
280 op_helper.o: CFLAGS += $(HELPER_CFLAGS) $(I386_CFLAGS)
282 cpu-exec.o: CFLAGS += $(HELPER_CFLAGS)
284 qemu-kvm-helper.o: qemu-kvm-helper.c
285         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
287 #########################################################
288 # Linux user emulator target
290 ifdef CONFIG_LINUX_USER
292 ifndef TARGET_ABI_DIR
293   TARGET_ABI_DIR=$(TARGET_ARCH)
294 endif
295 VPATH+=:$(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
296 CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
298 ifdef CONFIG_STATIC
299 LDFLAGS+=-static
300 endif
302 ifeq ($(ARCH),i386)
303 ifdef TARGET_GPROF
304 USE_I386_LD=y
305 endif
306 ifdef CONFIG_STATIC
307 USE_I386_LD=y
308 endif
309 ifdef USE_I386_LD
310 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
311 else
312 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
313 # that the kernel ELF loader considers as an executable. I think this
314 # is the simplest way to make it self virtualizable!
315 LDFLAGS+=-Wl,-shared
316 endif
317 endif
319 ifeq ($(ARCH),x86_64)
320 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
321 endif
323 ifeq ($(ARCH),ppc)
324 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
325 endif
327 ifeq ($(ARCH),ppc64)
328 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
329 endif
331 ifeq ($(ARCH),s390)
332 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
333 endif
335 ifeq ($(ARCH),sparc)
336 # -static is used to avoid g1/g3 usage by the dynamic linker    
337 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
338 endif
340 ifeq ($(ARCH),sparc64)
341 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
342 endif
344 ifeq ($(ARCH),alpha)
345 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
346 endif
348 ifeq ($(ARCH),ia64)
349 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
350 endif
352 ifeq ($(ARCH),arm)
353 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
354 endif
356 ifeq ($(ARCH),m68k)
357 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
358 endif
360 ifeq ($(ARCH),mips)
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 ifeq ($(ARCH),mips64)
369 ifeq ($(WORDS_BIGENDIAN),yes)
370 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
371 else
372 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
373 endif
374 endif
376 # profiling code
377 ifdef TARGET_GPROF
378 LDFLAGS+=-p
379 CFLAGS+=-p
380 endif
382 OBJS= main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \
383       elfload.o linuxload.o uaccess.o envlist.o gdbstub.o gdbstub-xml.o
384 LIBS+= $(PTHREADLIBS)
385 LIBS+= $(CLOCKLIBS)
386 ifdef TARGET_HAS_BFLT
387 OBJS+= flatload.o
388 endif
389 ifdef TARGET_HAS_ELFLOAD32
390 OBJS+= elfload32.o
391 elfload32.o: elfload.c
392 endif
394 ifeq ($(TARGET_ARCH), i386)
395 OBJS+= vm86.o
396 endif
397 ifeq ($(TARGET_ARCH), arm)
398 OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
399 nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
400  nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o
401 endif
402 ifeq ($(TARGET_ARCH), m68k)
403 OBJS+= m68k-sim.o m68k-semi.o
404 endif
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): ARLIBS=../libqemu_user.a libqemu.a
411 $(QEMU_PROG): $(OBJS) ../libqemu_user.a libqemu.a
412         $(call LINK,$(OBJS))
413 ifeq ($(ARCH),alpha)
414 # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
415 # the address space (31 bit so sign extending doesn't matter)
416         echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
417 endif
419 endif #CONFIG_LINUX_USER
421 #########################################################
422 # Darwin user emulator target
424 ifdef CONFIG_DARWIN_USER
426 VPATH+=:$(SRC_PATH)/darwin-user
427 CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
429 # Leave some space for the regular program loading zone
430 LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000
432 LIBS+=-lmx
434 OBJS= main.o commpage.o machload.o mmap.o signal.o syscall.o thunk.o \
435       gdbstub.o gdbstub-xml.o
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): ARLIBS=libqemu.a
442 $(QEMU_PROG): $(OBJS) libqemu.a
443         $(call LINK,$(OBJS))
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       gdbstub.o gdbstub-xml.o
535 OBJS+= uaccess.o
537 # Note: this is a workaround. The real fix is to avoid compiling
538 # cpu_signal_handler() in cpu-exec.c.
539 signal.o: CFLAGS += $(HELPER_CFLAGS)
541 $(QEMU_PROG): ARLIBS=libqemu.a ../libqemu_user.a
542 $(QEMU_PROG): $(OBJS) libqemu.a ../libqemu_user.a
543         $(call LINK,$(OBJS))
545 endif #CONFIG_BSD_USER
547 #########################################################
548 # System emulator target
549 ifndef CONFIG_USER_ONLY
551 OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o \
552      gdbstub.o gdbstub-xml.o msix.o
553 # virtio has to be here due to weird dependency between PCI and virtio-net.
554 # need to fix this properly
555 OBJS+=virtio-blk.o virtio-balloon.o virtio-net.o virtio-console.o
556 ifdef CONFIG_KVM
557 OBJS+=kvm.o kvm-all.o
558 endif
560 LIBS+=-lz
561 ifdef CONFIG_ALSA
562 LIBS += -lasound
563 endif
564 ifdef CONFIG_ESD
565 LIBS += -lesd
566 endif
567 ifdef CONFIG_PA
568 LIBS += -lpulse-simple
569 endif
570 ifdef CONFIG_DSOUND
571 LIBS += -lole32 -ldxguid
572 endif
573 ifdef CONFIG_FMOD
574 LIBS += $(CONFIG_FMOD_LIB)
575 endif
576 ifdef CONFIG_OSS
577 LIBS += $(CONFIG_OSS_LIB)
578 endif
580 SOUND_HW = sb16.o es1370.o ac97.o
581 ifdef CONFIG_ADLIB
582 SOUND_HW += fmopl.o adlib.o
583 adlib.o fmopl.o: CFLAGS := ${CFLAGS} -DBUILD_Y8950=0
584 endif
585 ifdef CONFIG_GUS
586 SOUND_HW += gus.o gusemu_hal.o gusemu_mixer.o
587 endif
588 ifdef CONFIG_CS4231A
589 SOUND_HW += cs4231a.o
590 endif
592 ifdef CONFIG_VNC_TLS
593 CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
594 LIBS += $(CONFIG_VNC_TLS_LIBS)
595 endif
597 ifdef CONFIG_VNC_SASL
598 CPPFLAGS += $(CONFIG_VNC_SASL_CFLAGS)
599 LIBS += $(CONFIG_VNC_SASL_LIBS)
600 endif
602 ifdef CONFIG_BLUEZ
603 LIBS += $(CONFIG_BLUEZ_LIBS)
604 endif
606 # xen backend driver support
607 XEN_OBJS := xen_machine_pv.o xen_domainbuild.o
608 ifeq ($(CONFIG_XEN), yes)
609   OBJS += $(XEN_OBJS)
610   LIBS += $(XEN_LIBS)
611 endif
613 # USB layer
614 OBJS+= usb-ohci.o
616 # PCI network cards
617 OBJS += eepro100.o
618 OBJS += ne2000.o
619 OBJS += pcnet.o
620 OBJS += rtl8139.o
621 OBJS += e1000.o
623 # Generic watchdog support and some watchdog devices
624 OBJS += wdt_ib700.o wdt_i6300esb.o
626 ifeq ($(USE_KVM_DEVICE_ASSIGNMENT), 1)
627 OBJS+= device-assignment.o
628 LIBS+=-lpci
629 endif
631 ifeq ($(TARGET_BASE_ARCH), i386)
632 # Hardware support
633 OBJS+= ide.o pckbd.o vga.o $(SOUND_HW) dma.o
634 OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
635 OBJS+= cirrus_vga.o apic.o ioapic.o parallel.o acpi.o piix_pci.o
636 OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
637 OBJS += device-hotplug.o pci-hotplug.o smbios.o
638 OBJS+= extboot.o
639 ifeq ($(USE_KVM_PIT), 1)
640 OBJS+= i8254-kvm.o
641 endif
642 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
643 endif
644 ifeq ($(TARGET_BASE_ARCH), ia64)
645 # Hardware support
646 OBJS+= ide.o pckbd.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
647 OBJS+= fdc.o mc146818rtc.o serial.o i8259.o ipf.o
648 OBJS+= cirrus_vga.o parallel.o acpi.o piix_pci.o
649 OBJS+= usb-uhci.o
650 endif
651 ifeq ($(TARGET_BASE_ARCH), ppc)
652 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
653 # shared objects
654 OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o
655 OBJS+= cirrus_vga.o
656 # PREP target
657 OBJS+= pckbd.o serial.o i8259.o i8254.o fdc.o mc146818rtc.o
658 OBJS+= prep_pci.o ppc_prep.o
659 # Mac shared devices
660 OBJS+= macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o
661 # OldWorld PowerMac
662 OBJS+= heathrow_pic.o grackle_pci.o ppc_oldworld.o
663 # NewWorld PowerMac
664 OBJS+= unin_pci.o ppc_newworld.o
665 # PowerPC 4xx boards
666 OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o
667 OBJS+= ppc440.o ppc440_bamboo.o
668 # PowerPC E500 boards
669 OBJS+= ppce500_pci.o ppce500_mpc8544ds.o
670 ifdef FDT_LIBS
671 OBJS+= device_tree.o
672 LIBS+= $(FDT_LIBS)
673 endif
674 ifdef CONFIG_KVM
675 OBJS+= kvm_ppc.o
676 endif
677 endif
678 ifeq ($(TARGET_BASE_ARCH), mips)
679 OBJS+= mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o
680 OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o rc4030.o
681 OBJS+= g364fb.o jazz_led.o dp8393x.o
682 OBJS+= ide.o gt64xxx.o pckbd.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
683 OBJS+= piix_pci.o parallel.o cirrus_vga.o pcspk.o $(SOUND_HW)
684 OBJS+= mipsnet.o
685 OBJS+= pflash_cfi01.o
686 OBJS+= vmware_vga.o
687 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
688 endif
689 ifeq ($(TARGET_BASE_ARCH), microblaze)
690 OBJS+= petalogix_s3adsp1800_mmu.o
692 OBJS+= microblaze_pic_cpu.o
693 OBJS+= xilinx_intc.o
694 OBJS+= xilinx_timer.o
695 OBJS+= xilinx_uartlite.o
696 OBJS+= xilinx_ethlite.o
698 OBJS+= pflash_cfi02.o
699 ifdef FDT_LIBS
700 OBJS+= device_tree.o
701 LIBS+= $(FDT_LIBS)
702 endif
703 endif
704 ifeq ($(TARGET_BASE_ARCH), cris)
705 # Boards
706 OBJS+= cris_pic_cpu.o etraxfs.o axis_dev88.o
708 # IO blocks
709 OBJS+= etraxfs_dma.o
710 OBJS+= etraxfs_pic.o
711 OBJS+= etraxfs_eth.o
712 OBJS+= etraxfs_timer.o
713 OBJS+= etraxfs_ser.o
715 OBJS+= pflash_cfi02.o
716 endif
717 ifeq ($(TARGET_BASE_ARCH), sparc)
718 ifeq ($(TARGET_ARCH), sparc64)
719 OBJS+= sun4u.o ide.o pckbd.o vga.o apb_pci.o
720 OBJS+= fdc.o mc146818rtc.o serial.o
721 OBJS+= cirrus_vga.o parallel.o
722 else
723 OBJS+= sun4m.o tcx.o iommu.o slavio_intctl.o
724 OBJS+= slavio_timer.o slavio_misc.o fdc.o sparc32_dma.o
725 OBJS+= cs4231.o eccmemctl.o sbi.o sun4c_intctl.o
726 endif
727 endif
728 ifeq ($(TARGET_BASE_ARCH), arm)
729 OBJS+= integratorcp.o versatilepb.o smc91c111.o arm_pic.o arm_timer.o
730 OBJS+= arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
731 OBJS+= versatile_pci.o
732 OBJS+= realview_gic.o realview.o arm_sysctl.o mpcore.o
733 OBJS+= armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
734 OBJS+= pl061.o
735 OBJS+= arm-semi.o
736 OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
737 OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
738 OBJS+= pflash_cfi01.o gumstix.o
739 OBJS+= zaurus.o ide.o serial.o spitz.o tosa.o tc6393xb.o
740 OBJS+= omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o
741 OBJS+= omap2.o omap_dss.o soc_dma.o
742 OBJS+= omap_sx1.o palm.o tsc210x.o
743 OBJS+= nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o
744 OBJS+= mst_fpga.o mainstone.o
745 OBJS+= musicpal.o pflash_cfi02.o
746 OBJS+= framebuffer.o
747 OBJS+= syborg.o syborg_fb.o syborg_interrupt.o syborg_keyboard.o
748 OBJS+= syborg_serial.o syborg_timer.o syborg_pointer.o syborg_rtc.o
749 OBJS+= syborg_virtio.o
750 CPPFLAGS += -DHAS_AUDIO
751 endif
752 ifeq ($(TARGET_BASE_ARCH), sh4)
753 OBJS+= shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
754 OBJS+= sh_timer.o sh_serial.o sh_intc.o sh_pci.o sm501.o serial.o
755 OBJS+= ide.o
756 endif
757 ifeq ($(TARGET_BASE_ARCH), m68k)
758 OBJS+= an5206.o mcf5206.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
759 OBJS+= m68k-semi.o dummy_m68k.o
760 endif
761 ifdef CONFIG_COCOA
762 COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
763 ifdef CONFIG_COREAUDIO
764 COCOA_LIBS+=-framework CoreAudio
765 endif
766 endif
767 ifdef CONFIG_SLIRP
768 CPPFLAGS+=-I$(SRC_PATH)/slirp
769 endif
771 LIBS+=$(PTHREADLIBS)
772 LIBS+=$(CLOCKLIBS)
773 # specific flags are needed for non soft mmu emulator
774 ifdef CONFIG_STATIC
775 LDFLAGS+=-static
776 endif
777 ifndef CONFIG_DARWIN
778 ifndef CONFIG_WIN32
779 ifndef CONFIG_SOLARIS
780 ifndef CONFIG_AIX
781 LIBS+=-lutil
782 endif
783 endif
784 endif
785 endif
786 ifdef TARGET_GPROF
787 vl.o: CFLAGS+=-p
788 LDFLAGS+=-p
789 endif
791 ifeq ($(ARCH),ia64)
792 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
793 endif
795 ifdef CONFIG_WIN32
796 SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
797 endif
799 # profiling code
800 ifdef TARGET_GPROF
801 LDFLAGS+=-p
802 main.o: CFLAGS+=-p
803 endif
804 ifeq ($(TARGET_ARCH), ia64)
805 firmware.o: firmware.c
806         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
807 endif
809 vl.o: CFLAGS+=$(SDL_CFLAGS)
811 vl.o: qemu-options.h
813 monitor.o: qemu-monitor.h
815 $(QEMU_PROG): LIBS += $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS) $(CURL_LIBS)
816 $(QEMU_PROG): ARLIBS=../libqemu_common.a libqemu.a $(HWLIB)
817 $(QEMU_PROG): $(OBJS) ../libqemu_common.a libqemu.a $(HWLIB)
818         $(call LINK,$(OBJS))
820 $(QEMU_PROG): ARLIBS += $(DEPLIBS)
821 $(QEMU_PROG): $(DEPLIBS)
823 endif # !CONFIG_USER_ONLY
825 gdbstub-xml.c: $(TARGET_XML_FILES) feature_to_c.sh
826 ifeq ($(TARGET_XML_FILES),)
827         $(call quiet-command,rm -f $@ && echo > $@,"  GEN   $(TARGET_DIR)$@")
828 else
829         $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/feature_to_c.sh $@ $(TARGET_XML_FILES),"  GEN   $(TARGET_DIR)$@")
830 endif
832 qemu-options.h: $(SRC_PATH)/qemu-options.hx
833         $(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
835 qemu-monitor.h: $(SRC_PATH)/qemu-monitor.hx
836         $(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
838 clean:
839         rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o
840         rm -f *.d */*.d tcg/*.o
841         rm -f qemu-options.h qemu-monitor.h gdbstub-xml.c
843 install: all
844 ifneq ($(PROGS),)
845         $(INSTALL) -m 755 $(STRIP_OPT) $(PROGS) "$(DESTDIR)$(bindir)"
846 endif
848 # Include automatically generated dependency files
849 -include $(wildcard *.d */*.d)