Merge commit 'a62acdc0cc5308706e2503557a09828979b59a12' into upstream-merge
[qemu-kvm/fedora.git] / Makefile.target
blobfc715ae414a639f2e48ba623459a36d872928751
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 libobj-y = exec.o cpu-exec.o host-utils.o
148 ifeq ($(NO_CPU_EMULATION), 1)
149 libobj-y += fack-exec.o
150 else
151 libobj-y += translate-all.o translate.o 
152 endif
153 libobj-$(CONFIG_KQEMU) += kqemu.o
154 # TCG code generator
155 ifneq ($(NO_CPU_EMULATION), 1)
156 libobj-y += tcg/tcg.o tcg/tcg-runtime.o
157 CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH)
158 endif
159 ifeq ($(ARCH),sparc64)
160 CPPFLAGS+=-I$(SRC_PATH)/tcg/sparc
161 endif
163 ifeq ($(USE_KVM), 1)
164 libobj-y += qemu-kvm.o
165 endif
166 ifdef CONFIG_SOFTFLOAT
167 libobj-y += fpu/softfloat.o
168 else
169 libobj-y += fpu/softfloat-native.o
170 endif
171 CPPFLAGS+=-I$(SRC_PATH)/fpu
172 libobj-y += op_helper.o helper.o
174 ifeq ($(TARGET_ARCH), i386)
175 libobj-y += helper.o
176 ifeq ($(USE_KVM), 1)
177 libobj-y += qemu-kvm-x86.o kvm-tpr-opt.o
178 libobj-y += qemu-kvm-helper.o
179 endif
180 endif
182 ifeq ($(TARGET_ARCH), x86_64)
183 libobj-y += helper.o
184 ifeq ($(USE_KVM), 1)
185 libobj-y += qemu-kvm-x86.o kvm-tpr-opt.o
186 libobj-y += qemu-kvm-helper.o
187 endif
188 endif
190 libobj-y += op_helper.o
192 ifneq ($(TARGET_ARCH), ia64)
193 libobj-y += helper.o
194 endif
196 ifeq ($(TARGET_BASE_ARCH), arm)
197 libobj-y += neon_helper.o iwmmxt_helper.o
198 endif
200 ifeq ($(TARGET_BASE_ARCH), alpha)
201 libobj-y += alpha_palcode.o
202 endif
204 ifeq ($(TARGET_BASE_ARCH), ia64)
205 libobj-y += op_helper.o firmware.o
206 ifeq ($(USE_KVM), 1)
207 libobj-y += qemu-kvm-ia64.o
208 endif
209 endif
211 ifeq ($(TARGET_BASE_ARCH), cris)
212 libobj-y += cris-dis.o
214 ifndef CONFIG_USER_ONLY
215 libobj-y += mmu.o
216 endif
217 endif
220 # NOTE: the disassembler code is only needed for debugging
221 libobj-y += disas.o
222 ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
223 USE_I386_DIS=y
224 endif
225 ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
226 USE_I386_DIS=y
227 endif
228 libobj-$(USE_I386_DIS) += i386-dis.o
229 ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
230 libobj-y += alpha-dis.o
231 endif
232 ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
233 libobj-y += ppc-dis.o
234 endif
235 ifeq ($(findstring microblaze, $(TARGET_BASE_ARCH) $(ARCH)),microblaze)
236 libobj-y += microblaze-dis.o
237 ifndef CONFIG_USER_ONLY
238 libobj-y += mmu.o
239 endif
240 endif
241 ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips)
242 libobj-y += mips-dis.o
243 endif
244 ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
245 libobj-y += sparc-dis.o
246 endif
247 ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
248 libobj-y += arm-dis.o
249 endif
250 ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
251 libobj-y += m68k-dis.o
252 endif
253 ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
254 libobj-y += sh4-dis.o
255 endif
256 ifeq ($(findstring hppa, $(TARGET_BASE_ARCH) $(ARCH)),hppa)
257 libobj-y += hppa-dis.o
258 endif
259 ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390)
260 libobj-y += s390-dis.o
261 endif
263 # libqemu
265 libqemu.a: $(libobj-y)
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 obj-y = main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \
378       elfload.o linuxload.o uaccess.o envlist.o gdbstub.o gdbstub-xml.o
379 LIBS+= $(PTHREADLIBS)
380 LIBS+= $(CLOCKLIBS)
381 obj-$(TARGET_HAS_BFLT) += flatload.o
383 ifdef TARGET_HAS_ELFLOAD32
384 elfload32.o: elfload.c
385 endif
386 obj-$(TARGET_HAS_ELFLOAD32) += elfload32.o
388 ifeq ($(TARGET_ARCH), i386)
389 obj-y += vm86.o
390 endif
391 ifeq ($(TARGET_ARCH), arm)
392 obj-y += 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 obj-y += m68k-sim.o m68k-semi.o
398 endif
400 # Note: this is a workaround. The real fix is to avoid compiling
401 # cpu_signal_handler() in cpu-exec.c.
402 signal.o: CFLAGS += $(HELPER_CFLAGS)
404 $(QEMU_PROG): ARLIBS=../libqemu_user.a libqemu.a
405 $(QEMU_PROG): $(obj-y) ../libqemu_user.a libqemu.a
406         $(call LINK,$(obj-y))
407 ifeq ($(ARCH),alpha)
408 # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
409 # the address space (31 bit so sign extending doesn't matter)
410         echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
411 endif
413 endif #CONFIG_LINUX_USER
415 #########################################################
416 # Darwin user emulator target
418 ifdef CONFIG_DARWIN_USER
420 VPATH+=:$(SRC_PATH)/darwin-user
421 CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
423 # Leave some space for the regular program loading zone
424 LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000
426 LIBS+=-lmx
428 obj-y = main.o commpage.o machload.o mmap.o signal.o syscall.o thunk.o \
429         gdbstub.o gdbstub-xml.o
431 # Note: this is a workaround. The real fix is to avoid compiling
432 # cpu_signal_handler() in cpu-exec.c.
433 signal.o: CFLAGS += $(HELPER_CFLAGS)
435 $(QEMU_PROG): ARLIBS=libqemu.a
436 $(QEMU_PROG): $(obj-y) libqemu.a
437         $(call LINK,$(obj-y))
439 endif #CONFIG_DARWIN_USER
441 #########################################################
442 # BSD user emulator target
444 ifdef CONFIG_BSD_USER
446 VPATH+=:$(SRC_PATH)/bsd-user
447 CPPFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
449 ifdef CONFIG_STATIC
450 LDFLAGS+=-static
451 endif
453 ifeq ($(ARCH),i386)
454 ifdef TARGET_GPROF
455 USE_I386_LD=y
456 endif
457 ifdef CONFIG_STATIC
458 USE_I386_LD=y
459 endif
460 ifdef USE_I386_LD
461 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
462 else
463 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
464 # that the kernel ELF loader considers as an executable. I think this
465 # is the simplest way to make it self virtualizable!
466 LDFLAGS+=-Wl,-shared
467 endif
468 endif
470 ifeq ($(ARCH),x86_64)
471 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
472 endif
474 ifeq ($(ARCH),ppc)
475 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
476 endif
478 ifeq ($(ARCH),ppc64)
479 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
480 endif
482 ifeq ($(ARCH),s390)
483 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
484 endif
486 ifeq ($(ARCH),sparc)
487 # -static is used to avoid g1/g3 usage by the dynamic linker
488 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
489 endif
491 ifeq ($(ARCH),sparc64)
492 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
493 endif
495 ifeq ($(ARCH),alpha)
496 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
497 endif
499 ifeq ($(ARCH),ia64)
500 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
501 endif
503 ifeq ($(ARCH),arm)
504 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
505 endif
507 ifeq ($(ARCH),m68k)
508 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
509 endif
511 ifeq ($(ARCH),mips)
512 ifeq ($(WORDS_BIGENDIAN),yes)
513 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
514 else
515 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
516 endif
517 endif
519 ifeq ($(ARCH),mips64)
520 ifeq ($(WORDS_BIGENDIAN),yes)
521 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
522 else
523 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
524 endif
525 endif
527 obj-y = main.o bsdload.o elfload.o mmap.o path.o signal.o strace.o syscall.o \
528         gdbstub.o gdbstub-xml.o
529 obj-y += uaccess.o
531 # Note: this is a workaround. The real fix is to avoid compiling
532 # cpu_signal_handler() in cpu-exec.c.
533 signal.o: CFLAGS += $(HELPER_CFLAGS)
535 $(QEMU_PROG): ARLIBS=libqemu.a ../libqemu_user.a
536 $(QEMU_PROG): $(obj-y) libqemu.a ../libqemu_user.a
537         $(call LINK,$(obj-y))
539 endif #CONFIG_BSD_USER
541 #########################################################
542 # System emulator target
543 ifndef CONFIG_USER_ONLY
545 obj-y = vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o \
546         gdbstub.o gdbstub-xml.o msix.o
547 # virtio has to be here due to weird dependency between PCI and virtio-net.
548 # need to fix this properly
549 obj-y += virtio-blk.o virtio-balloon.o virtio-net.o virtio-console.o
550 obj-$(CONFIG_KVM) += kvm.o kvm-all.o
552 LIBS+=-lz
553 ifdef CONFIG_ALSA
554 LIBS += -lasound
555 endif
556 ifdef CONFIG_ESD
557 LIBS += -lesd
558 endif
559 ifdef CONFIG_PA
560 LIBS += -lpulse-simple
561 endif
562 ifdef CONFIG_DSOUND
563 LIBS += -lole32 -ldxguid
564 endif
565 ifdef CONFIG_FMOD
566 LIBS += $(CONFIG_FMOD_LIB)
567 endif
568 ifdef CONFIG_OSS
569 LIBS += $(CONFIG_OSS_LIB)
570 endif
572 sound-obj-y =
573 sound-obj-$(CONFIG_SB16) += sb16.o
574 sound-obj-$(CONFIG_ES1370) += es1370.o
575 sound-obj-$(CONFIG_AC97) += ac97.o
576 sound-obj-$(CONFIG_ADLIB) += fmopl.o adlib.o
577 sound-obj-$(CONFIG_GUS) += gus.o gusemu_hal.o gusemu_mixer.o
578 sound-obj-$(CONFIG_CS4321A) += cs4231a.o
580 ifdef CONFIG_ADLIB
581 adlib.o fmopl.o: CFLAGS := ${CFLAGS} -DBUILD_Y8950=0
582 endif
584 ifdef CONFIG_VNC_TLS
585 CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
586 LIBS += $(CONFIG_VNC_TLS_LIBS)
587 endif
589 ifdef CONFIG_VNC_SASL
590 CPPFLAGS += $(CONFIG_VNC_SASL_CFLAGS)
591 LIBS += $(CONFIG_VNC_SASL_LIBS)
592 endif
594 ifdef CONFIG_BLUEZ
595 LIBS += $(CONFIG_BLUEZ_LIBS)
596 endif
598 # xen backend driver support
599 obj-$(CONFIG_XEN) += xen_machine_pv.o xen_domainbuild.o
600 ifeq ($(CONFIG_XEN), yes)
601   LIBS += $(XEN_LIBS)
602 endif
604 # USB layer
605 obj-y += usb-ohci.o
607 # PCI network cards
608 obj-y += eepro100.o
609 obj-y += ne2000.o
610 obj-y += pcnet.o
611 obj-y += rtl8139.o
612 obj-y += e1000.o
614 # Generic watchdog support and some watchdog devices
615 obj-y += wdt_ib700.o wdt_i6300esb.o
617 ifeq ($(USE_KVM_DEVICE_ASSIGNMENT), 1)
618 obj-y += device-assignment.o
619 LIBS+=-lpci
620 endif
622 ifeq ($(TARGET_BASE_ARCH), i386)
623 # Hardware support
624 obj-y += ide.o pckbd.o vga.o $(sound-obj-y) dma.o
625 obj-y += fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
626 obj-y += cirrus_vga.o apic.o ioapic.o parallel.o acpi.o piix_pci.o
627 obj-y += usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
628 obj-y += device-hotplug.o pci-hotplug.o smbios.o
629 obj-y += extboot.o
630 ifeq ($(USE_KVM_PIT), 1)
631 obj-y += i8254-kvm.o
632 endif
633 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
634 endif
635 ifeq ($(TARGET_BASE_ARCH), ia64)
636 # Hardware support
637 obj-y += ide.o pckbd.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
638 obj-y += fdc.o mc146818rtc.o serial.o i8259.o ipf.o
639 obj-y += cirrus_vga.o parallel.o acpi.o piix_pci.o
640 obj-y += usb-uhci.o
641 endif
642 ifeq ($(TARGET_BASE_ARCH), ppc)
643 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
644 # shared objects
645 obj-y += ppc.o ide.o vga.o $(sound-obj-y) dma.o openpic.o
646 obj-y += cirrus_vga.o
647 # PREP target
648 obj-y += pckbd.o serial.o i8259.o i8254.o fdc.o mc146818rtc.o
649 obj-y += prep_pci.o ppc_prep.o
650 # Mac shared devices
651 obj-y += macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o
652 # OldWorld PowerMac
653 obj-y += heathrow_pic.o grackle_pci.o ppc_oldworld.o
654 # NewWorld PowerMac
655 obj-y += unin_pci.o ppc_newworld.o
656 # PowerPC 4xx boards
657 obj-y += pflash_cfi02.o ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o
658 obj-y += ppc440.o ppc440_bamboo.o
659 # PowerPC E500 boards
660 obj-y += ppce500_pci.o ppce500_mpc8544ds.o
661 ifdef FDT_LIBS
662 obj-y += device_tree.o
663 LIBS+= $(FDT_LIBS)
664 endif
665 obj-$(CONFIG_KVM) += kvm_ppc.o
666 endif
667 ifeq ($(TARGET_BASE_ARCH), mips)
668 obj-y += mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o
669 obj-y += mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o rc4030.o
670 obj-y += g364fb.o jazz_led.o dp8393x.o
671 obj-y += ide.o gt64xxx.o pckbd.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
672 obj-y += piix_pci.o parallel.o cirrus_vga.o pcspk.o $(sound-obj-y)
673 obj-y += mipsnet.o
674 obj-y += pflash_cfi01.o
675 obj-y += vmware_vga.o
676 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
677 endif
678 ifeq ($(TARGET_BASE_ARCH), microblaze)
679 obj-y += petalogix_s3adsp1800_mmu.o
681 obj-y += microblaze_pic_cpu.o
682 obj-y += xilinx_intc.o
683 obj-y += xilinx_timer.o
684 obj-y += xilinx_uartlite.o
685 obj-y += xilinx_ethlite.o
687 obj-y += pflash_cfi02.o
688 ifdef FDT_LIBS
689 obj-y += device_tree.o
690 LIBS+= $(FDT_LIBS)
691 endif
692 endif
693 ifeq ($(TARGET_BASE_ARCH), cris)
694 # Boards
695 obj-y += cris_pic_cpu.o etraxfs.o axis_dev88.o
697 # IO blocks
698 obj-y += etraxfs_dma.o
699 obj-y += etraxfs_pic.o
700 obj-y += etraxfs_eth.o
701 obj-y += etraxfs_timer.o
702 obj-y += etraxfs_ser.o
704 obj-y += pflash_cfi02.o
705 endif
706 ifeq ($(TARGET_BASE_ARCH), sparc)
707 ifeq ($(TARGET_ARCH), sparc64)
708 obj-y += sun4u.o ide.o pckbd.o vga.o apb_pci.o
709 obj-y += fdc.o mc146818rtc.o serial.o
710 obj-y += cirrus_vga.o parallel.o
711 else
712 obj-y += sun4m.o tcx.o iommu.o slavio_intctl.o
713 obj-y += slavio_timer.o slavio_misc.o fdc.o sparc32_dma.o
714 obj-y += cs4231.o eccmemctl.o sbi.o sun4c_intctl.o
715 endif
716 endif
717 ifeq ($(TARGET_BASE_ARCH), arm)
718 obj-y += integratorcp.o versatilepb.o smc91c111.o arm_pic.o arm_timer.o
719 obj-y += arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
720 obj-y += versatile_pci.o
721 obj-y += realview_gic.o realview.o arm_sysctl.o mpcore.o
722 obj-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
723 obj-y += pl061.o
724 obj-y += arm-semi.o
725 obj-y += pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
726 obj-y += pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
727 obj-y += pflash_cfi01.o gumstix.o
728 obj-y += zaurus.o ide.o serial.o spitz.o tosa.o tc6393xb.o
729 obj-y += omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o
730 obj-y += omap2.o omap_dss.o soc_dma.o
731 obj-y += omap_sx1.o palm.o tsc210x.o
732 obj-y += nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o
733 obj-y += mst_fpga.o mainstone.o
734 obj-y += musicpal.o pflash_cfi02.o
735 obj-y += framebuffer.o
736 obj-y += syborg.o syborg_fb.o syborg_interrupt.o syborg_keyboard.o
737 obj-y += syborg_serial.o syborg_timer.o syborg_pointer.o syborg_rtc.o
738 obj-y += syborg_virtio.o
739 CPPFLAGS += -DHAS_AUDIO
740 endif
741 ifeq ($(TARGET_BASE_ARCH), sh4)
742 obj-y += shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
743 obj-y += sh_timer.o sh_serial.o sh_intc.o sh_pci.o sm501.o serial.o
744 obj-y += ide.o
745 endif
746 ifeq ($(TARGET_BASE_ARCH), m68k)
747 obj-y += an5206.o mcf5206.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
748 obj-y += m68k-semi.o dummy_m68k.o
749 endif
750 ifdef CONFIG_COCOA
751 COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
752 ifdef CONFIG_COREAUDIO
753 COCOA_LIBS+=-framework CoreAudio
754 endif
755 endif
756 ifdef CONFIG_SLIRP
757 CPPFLAGS+=-I$(SRC_PATH)/slirp
758 endif
760 LIBS+=$(PTHREADLIBS)
761 LIBS+=$(CLOCKLIBS)
762 # specific flags are needed for non soft mmu emulator
763 ifdef CONFIG_STATIC
764 LDFLAGS+=-static
765 endif
766 ifndef CONFIG_DARWIN
767 ifndef CONFIG_WIN32
768 ifndef CONFIG_SOLARIS
769 ifndef CONFIG_AIX
770 LIBS+=-lutil
771 endif
772 endif
773 endif
774 endif
775 ifdef TARGET_GPROF
776 vl.o: CFLAGS+=-p
777 LDFLAGS+=-p
778 endif
780 ifeq ($(ARCH),ia64)
781 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
782 endif
784 ifdef CONFIG_WIN32
785 SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
786 endif
788 # profiling code
789 ifdef TARGET_GPROF
790 LDFLAGS+=-p
791 main.o: CFLAGS+=-p
792 endif
793 ifeq ($(TARGET_ARCH), ia64)
794 firmware.o: firmware.c
795         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
796 endif
798 vl.o: CFLAGS+=$(SDL_CFLAGS)
800 vl.o: qemu-options.h
802 monitor.o: qemu-monitor.h
804 $(QEMU_PROG): LIBS += $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS) $(CURL_LIBS)
805 $(QEMU_PROG): ARLIBS=../libqemu_common.a libqemu.a $(HWLIB)
806 $(QEMU_PROG): $(obj-y) ../libqemu_common.a libqemu.a $(HWLIB)
807         $(call LINK,$(obj-y))
809 $(QEMU_PROG): ARLIBS += $(DEPLIBS)
810 $(QEMU_PROG): $(DEPLIBS)
812 endif # !CONFIG_USER_ONLY
814 gdbstub-xml.c: $(TARGET_XML_FILES) feature_to_c.sh
815 ifeq ($(TARGET_XML_FILES),)
816         $(call quiet-command,rm -f $@ && echo > $@,"  GEN   $(TARGET_DIR)$@")
817 else
818         $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/feature_to_c.sh $@ $(TARGET_XML_FILES),"  GEN   $(TARGET_DIR)$@")
819 endif
821 qemu-options.h: $(SRC_PATH)/qemu-options.hx
822         $(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
824 qemu-monitor.h: $(SRC_PATH)/qemu-monitor.hx
825         $(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
827 clean:
828         rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o
829         rm -f *.d */*.d tcg/*.o
830         rm -f qemu-options.h qemu-monitor.h gdbstub-xml.c
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)