Add support for tap vectored send
[qemu/qemu-JZ.git] / Makefile.target
blobe14309c05b7ba80b6b622305867939b901c3e66e
1 include config.mak
3 TARGET_BASE_ARCH:=$(TARGET_ARCH)
4 ifeq ($(TARGET_ARCH), x86_64)
5 TARGET_BASE_ARCH:=i386
6 endif
7 ifeq ($(TARGET_ARCH), mipsn32)
8 TARGET_BASE_ARCH:=mips
9 endif
10 ifeq ($(TARGET_ARCH), mips64)
11 TARGET_BASE_ARCH:=mips
12 endif
13 ifeq ($(TARGET_ARCH), ppc64)
14 TARGET_BASE_ARCH:=ppc
15 endif
16 ifeq ($(TARGET_ARCH), ppc64h)
17 TARGET_BASE_ARCH:=ppc
18 endif
19 ifeq ($(TARGET_ARCH), ppcemb)
20 TARGET_BASE_ARCH:=ppc
21 endif
22 ifeq ($(TARGET_ARCH), sparc64)
23 TARGET_BASE_ARCH:=sparc
24 endif
25 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
26 VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw
27 CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MT $@ -MP -DNEED_CPU_H
28 #CFLAGS+=-Werror
29 LIBS=
30 # user emulator name
31 ifndef TARGET_ARCH2
32 TARGET_ARCH2=$(TARGET_ARCH)
33 endif
34 ifeq ($(TARGET_ARCH),arm)
35   ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
36     TARGET_ARCH2=armeb
37   endif
38 endif
39 ifeq ($(TARGET_ARCH),sh4)
40   ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
41     TARGET_ARCH2=sh4eb
42   endif
43 endif
44 ifeq ($(TARGET_ARCH),mips)
45   ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
46     TARGET_ARCH2=mipsel
47   endif
48 endif
49 ifeq ($(TARGET_ARCH),mipsn32)
50   ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
51     TARGET_ARCH2=mipsn32el
52   endif
53 endif
54 ifeq ($(TARGET_ARCH),mips64)
55   ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
56     TARGET_ARCH2=mips64el
57   endif
58 endif
60 ifdef CONFIG_USER_ONLY
61 # user emulator name
62 QEMU_PROG=qemu-$(TARGET_ARCH2)
63 else
64 # system emulator name
65 ifeq ($(TARGET_ARCH), i386)
66 QEMU_PROG=qemu$(EXESUF)
67 else
68 QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF)
69 endif
70 endif
72 PROGS=$(QEMU_PROG)
74 # We require -O2 to avoid the stack setup prologue in EXIT_TB
75 OP_CFLAGS := -O2 -g -fno-strict-aliasing
76 OP_CFLAGS += -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls
78 # cc-option
79 # Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0)
81 cc-option = $(shell if $(CC) $(OP_CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
82               > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
84 OP_CFLAGS+=$(call cc-option, -fno-reorder-blocks, "")
85 OP_CFLAGS+=$(call cc-option, -fno-gcse, "")
86 OP_CFLAGS+=$(call cc-option, -fno-tree-ch, "")
87 OP_CFLAGS+=$(call cc-option, -fno-optimize-sibling-calls, "")
88 OP_CFLAGS+=$(call cc-option, -fno-crossjumping, "")
89 OP_CFLAGS+=$(call cc-option, -fno-align-labels, "")
90 OP_CFLAGS+=$(call cc-option, -fno-align-jumps, "")
91 OP_CFLAGS+=$(call cc-option, -fno-align-functions, $(call cc-option, -malign-functions=0, ""))
92 OP_CFLAGS+=$(call cc-option, -fno-section-anchors, "")
94 HELPER_CFLAGS=
96 ifeq ($(ARCH),i386)
97 HELPER_CFLAGS+=-fomit-frame-pointer
98 OP_CFLAGS+=-mpreferred-stack-boundary=2 -fomit-frame-pointer
99 endif
101 ifeq ($(ARCH),ppc)
102 CPPFLAGS+= -D__powerpc__
103 OP_CFLAGS+= -mlongcall
104 endif
106 ifeq ($(ARCH),sparc)
107   CFLAGS+=-ffixed-g2 -ffixed-g3
108   OP_CFLAGS+=-fno-delayed-branch -ffixed-i0
109   ifeq ($(CONFIG_SOLARIS),yes)
110     OP_CFLAGS+=-fno-omit-frame-pointer
111   else
112     CFLAGS+=-ffixed-g1 -ffixed-g6
113     HELPER_CFLAGS+=-ffixed-i0
114   endif
115 endif
117 ifeq ($(ARCH),sparc64)
118   OP_CFLAGS+=-mcpu=ultrasparc -m64 -fno-delayed-branch -ffixed-i0
119   ifneq ($(CONFIG_SOLARIS),yes)
120     CFLAGS+=-ffixed-g5 -ffixed-g6 -ffixed-g7
121     OP_CFLAGS+=-ffixed-g5 -ffixed-g6 -ffixed-g7
122   else
123     CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
124   endif
125 endif
127 ifeq ($(ARCH),alpha)
128 # -msmall-data is not used for OP_CFLAGS because we want two-instruction
129 # relocations for the constant constructions
130 # Ensure there's only a single GP
131 CFLAGS+=-msmall-data
132 endif
134 ifeq ($(ARCH),hppa)
135 OP_CFLAGS=-O1 -fno-delayed-branch
136 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
137 endif
139 ifeq ($(ARCH),ia64)
140 CFLAGS+=-mno-sdata
141 OP_CFLAGS+=-mno-sdata
142 endif
144 ifeq ($(ARCH),arm)
145 OP_CFLAGS+=-mno-sched-prolog -fno-omit-frame-pointer
146 endif
148 ifeq ($(ARCH),m68k)
149 OP_CFLAGS+=-fomit-frame-pointer
150 endif
152 ifeq ($(ARCH),mips)
153 OP_CFLAGS+=-mabi=32 -G0 -fno-PIC -mno-abicalls -fomit-frame-pointer -fno-delayed-branch -Wa,-O0
154 endif
156 ifeq ($(ARCH),mips64)
157 OP_CFLAGS+=-mabi=n32 -G0 -fno-PIC -mno-abicalls -fomit-frame-pointer -fno-delayed-branch -Wa,-O0
158 endif
160 CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
161 LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS)
162 OP_CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
164 CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
165 LIBS+=-lm
166 ifdef CONFIG_WIN32
167 LIBS+=-lwinmm -lws2_32 -liphlpapi
168 endif
169 ifdef CONFIG_SOLARIS
170 LIBS+=-lsocket -lnsl -lresolv
171 ifdef NEEDS_LIBSUNMATH
172 LIBS+=-lsunmath
173 LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib
174 OP_CFLAGS+=-I/opt/SUNWspro/prod/include/cc
175 CFLAGS+=-I/opt/SUNWspro/prod/include/cc
176 endif
177 endif
179 kvm.o: CFLAGS+=$(KVM_CFLAGS)
180 kvm-all.o: CFLAGS+=$(KVM_CFLAGS)
182 all: $(PROGS)
184 #########################################################
185 # cpu emulator library
186 LIBOBJS=exec.o kqemu.o translate-all.o cpu-exec.o\
187         translate.o host-utils.o
188 # TCG code generator
189 LIBOBJS+= tcg/tcg.o tcg/tcg-runtime.o
190 CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH)
191 ifeq ($(ARCH),sparc64)
192 CPPFLAGS+=-I$(SRC_PATH)/tcg/sparc
193 endif
194 ifdef CONFIG_SOFTFLOAT
195 LIBOBJS+=fpu/softfloat.o
196 else
197 LIBOBJS+=fpu/softfloat-native.o
198 endif
199 CPPFLAGS+=-I$(SRC_PATH)/fpu
200 LIBOBJS+= op_helper.o helper.o
202 ifeq ($(TARGET_BASE_ARCH), arm)
203 LIBOBJS+= neon_helper.o iwmmxt_helper.o
204 endif
206 ifeq ($(TARGET_BASE_ARCH), alpha)
207 LIBOBJS+= alpha_palcode.o
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
218 # NOTE: the disassembler code is only needed for debugging
219 LIBOBJS+=disas.o
220 ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
221 USE_I386_DIS=y
222 endif
223 ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
224 USE_I386_DIS=y
225 endif
226 ifdef USE_I386_DIS
227 LIBOBJS+=i386-dis.o
228 endif
229 ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
230 LIBOBJS+=alpha-dis.o
231 endif
232 ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
233 LIBOBJS+=ppc-dis.o
234 endif
235 ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips)
236 LIBOBJS+=mips-dis.o
237 endif
238 ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
239 LIBOBJS+=sparc-dis.o
240 endif
241 ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
242 LIBOBJS+=arm-dis.o
243 endif
244 ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
245 LIBOBJS+=m68k-dis.o
246 endif
247 ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
248 LIBOBJS+=sh4-dis.o
249 endif
250 ifeq ($(findstring hppa, $(TARGET_BASE_ARCH) $(ARCH)),hppa)
251 LIBOBJS+=hppa-dis.o
252 endif
253 ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390)
254 LIBOBJS+=s390-dis.o
255 endif
257 # libqemu
259 libqemu.a: $(LIBOBJS)
260         rm -f $@
261         $(AR) rcs $@ $(LIBOBJS)
263 translate.o: translate.c cpu.h
265 translate-all.o: translate-all.c cpu.h
267 tcg/tcg.o: cpu.h
269 machine.o: machine.c
270         $(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $<
272 # HELPER_CFLAGS is used for all the code compiled with static register
273 # variables
274 op_helper.o: op_helper.c
275         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) $(I386_CFLAGS) -c -o $@ $<
277 cpu-exec.o: cpu-exec.c
278         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
280 #########################################################
281 # Linux user emulator target
283 ifdef CONFIG_LINUX_USER
285 ifndef TARGET_ABI_DIR
286   TARGET_ABI_DIR=$(TARGET_ARCH)
287 endif
288 VPATH+=:$(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
289 CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
291 ifdef CONFIG_STATIC
292 LDFLAGS+=-static
293 endif
295 ifeq ($(ARCH),i386)
296 ifdef TARGET_GPROF
297 USE_I386_LD=y
298 endif
299 ifdef CONFIG_STATIC
300 USE_I386_LD=y
301 endif
302 ifdef USE_I386_LD
303 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
304 else
305 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
306 # that the kernel ELF loader considers as an executable. I think this
307 # is the simplest way to make it self virtualizable!
308 LDFLAGS+=-Wl,-shared
309 endif
310 endif
312 ifeq ($(ARCH),x86_64)
313 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
314 endif
316 ifeq ($(ARCH),ppc)
317 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
318 endif
320 ifeq ($(ARCH),ppc64)
321 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
322 endif
324 ifeq ($(ARCH),s390)
325 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
326 endif
328 ifeq ($(ARCH),sparc)
329 # -static is used to avoid g1/g3 usage by the dynamic linker    
330 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
331 endif
333 ifeq ($(ARCH),sparc64)
334 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
335 endif
337 ifeq ($(ARCH),alpha)
338 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
339 endif
341 ifeq ($(ARCH),ia64)
342 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
343 endif
345 ifeq ($(ARCH),arm)
346 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
347 endif
349 ifeq ($(ARCH),m68k)
350 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
351 endif
353 ifeq ($(ARCH),mips)
354 ifeq ($(WORDS_BIGENDIAN),yes)
355 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
356 else
357 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
358 endif
359 endif
361 ifeq ($(ARCH),mips64)
362 ifeq ($(WORDS_BIGENDIAN),yes)
363 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
364 else
365 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
366 endif
367 endif
369 # profiling code
370 ifdef TARGET_GPROF
371 LDFLAGS+=-p
372 CFLAGS+=-p
373 endif
375 OBJS= main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \
376       elfload.o linuxload.o uaccess.o
377 LIBS+= $(AIOLIBS)
378 ifdef TARGET_HAS_BFLT
379 OBJS+= flatload.o
380 endif
381 ifdef TARGET_HAS_ELFLOAD32
382 OBJS+= elfload32.o
383 elfload32.o: elfload.c
384 endif
386 ifeq ($(TARGET_ARCH), i386)
387 OBJS+= vm86.o
388 endif
389 ifeq ($(TARGET_ARCH), arm)
390 OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
391 nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
392  nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o
393 endif
394 ifeq ($(TARGET_ARCH), m68k)
395 OBJS+= m68k-sim.o m68k-semi.o
396 endif
398 ifdef CONFIG_GDBSTUB
399 OBJS+=gdbstub.o gdbstub-xml.o
400 endif
402 OBJS+= libqemu.a
404 # Note: this is a workaround. The real fix is to avoid compiling
405 # cpu_signal_handler() in cpu-exec.c.
406 signal.o: signal.c
407         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
409 $(QEMU_PROG): $(OBJS) ../libqemu_user.a
410         $(CC) $(LDFLAGS) -o $@ $^  $(LIBS)
411 ifeq ($(ARCH),alpha)
412 # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
413 # the address space (31 bit so sign extending doesn't matter)
414         echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
415 endif
417 endif #CONFIG_LINUX_USER
419 #########################################################
420 # Darwin user emulator target
422 ifdef CONFIG_DARWIN_USER
424 VPATH+=:$(SRC_PATH)/darwin-user
425 CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
427 # Leave some space for the regular program loading zone
428 LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000
430 LIBS+=-lmx
432 OBJS= main.o commpage.o machload.o mmap.o signal.o syscall.o thunk.o
434 OBJS+= libqemu.a
436 ifdef CONFIG_GDBSTUB
437 OBJS+=gdbstub.o gdbstub-xml.o
438 endif
440 # Note: this is a workaround. The real fix is to avoid compiling
441 # cpu_signal_handler() in cpu-exec.c.
442 signal.o: signal.c
443         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
445 $(QEMU_PROG): $(OBJS)
446         $(CC) $(LDFLAGS) -o $@ $^  $(LIBS)
448 endif #CONFIG_DARWIN_USER
450 #########################################################
451 # BSD user emulator target
453 ifdef CONFIG_BSD_USER
455 VPATH+=:$(SRC_PATH)/bsd-user
456 CPPFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
458 ifdef CONFIG_STATIC
459 LDFLAGS+=-static
460 endif
462 ifeq ($(ARCH),i386)
463 ifdef TARGET_GPROF
464 USE_I386_LD=y
465 endif
466 ifdef CONFIG_STATIC
467 USE_I386_LD=y
468 endif
469 ifdef USE_I386_LD
470 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
471 else
472 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
473 # that the kernel ELF loader considers as an executable. I think this
474 # is the simplest way to make it self virtualizable!
475 LDFLAGS+=-Wl,-shared
476 endif
477 endif
479 ifeq ($(ARCH),x86_64)
480 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
481 endif
483 ifeq ($(ARCH),ppc)
484 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
485 endif
487 ifeq ($(ARCH),ppc64)
488 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
489 endif
491 ifeq ($(ARCH),s390)
492 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
493 endif
495 ifeq ($(ARCH),sparc)
496 # -static is used to avoid g1/g3 usage by the dynamic linker
497 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
498 endif
500 ifeq ($(ARCH),sparc64)
501 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
502 endif
504 ifeq ($(ARCH),alpha)
505 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
506 endif
508 ifeq ($(ARCH),ia64)
509 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
510 endif
512 ifeq ($(ARCH),arm)
513 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
514 endif
516 ifeq ($(ARCH),m68k)
517 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
518 endif
520 ifeq ($(ARCH),mips)
521 ifeq ($(WORDS_BIGENDIAN),yes)
522 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
523 else
524 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
525 endif
526 endif
528 ifeq ($(ARCH),mips64)
529 ifeq ($(WORDS_BIGENDIAN),yes)
530 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
531 else
532 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
533 endif
534 endif
536 OBJS= main.o bsdload.o elfload.o mmap.o path.o signal.o strace.o syscall.o
537 OBJS+= uaccess.o
539 OBJS+= libqemu.a
541 ifdef CONFIG_GDBSTUB
542 OBJS+=gdbstub.o
543 endif
545 # Note: this is a workaround. The real fix is to avoid compiling
546 # cpu_signal_handler() in cpu-exec.c.
547 signal.o: signal.c
548         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
550 $(QEMU_PROG): $(OBJS) ../libqemu_user.a
551         $(CC) $(LDFLAGS) -o $@ $^  $(LIBS)
553 endif #CONFIG_BSD_USER
555 #########################################################
556 # System emulator target
557 ifndef CONFIG_USER_ONLY
559 OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o
560 OBJS+=fw_cfg.o
561 ifdef CONFIG_KVM
562 OBJS+=kvm.o kvm-all.o
563 endif
564 ifdef CONFIG_WIN32
565 OBJS+=block-raw-win32.o
566 else
567 ifdef CONFIG_AIO
568 OBJS+=posix-aio-compat.o
569 endif
570 OBJS+=block-raw-posix.o
571 endif
573 LIBS+=-lz
574 ifdef CONFIG_ALSA
575 LIBS += -lasound
576 endif
577 ifdef CONFIG_ESD
578 LIBS += -lesd
579 endif
580 ifdef CONFIG_PA
581 LIBS += -lpulse-simple
582 endif
583 ifdef CONFIG_DSOUND
584 LIBS += -lole32 -ldxguid
585 endif
586 ifdef CONFIG_FMOD
587 LIBS += $(CONFIG_FMOD_LIB)
588 endif
589 ifdef CONFIG_OSS
590 LIBS += $(CONFIG_OSS_LIB)
591 endif
593 SOUND_HW = sb16.o es1370.o
594 ifdef CONFIG_AC97
595 SOUND_HW += ac97.o
596 endif
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 CONFIG_VNC_TLS
609 CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
610 LIBS += $(CONFIG_VNC_TLS_LIBS)
611 endif
613 ifdef CONFIG_BLUEZ
614 LIBS += $(CONFIG_BLUEZ_LIBS)
615 endif
617 # SCSI layer
618 OBJS+= lsi53c895a.o esp.o
620 # USB layer
621 OBJS+= usb-ohci.o
623 # EEPROM emulation
624 OBJS += eeprom93xx.o
626 # PCI network cards
627 OBJS += eepro100.o
628 OBJS += ne2000.o
629 OBJS += pcnet.o
630 OBJS += rtl8139.o
631 OBJS += e1000.o
633 ifeq ($(TARGET_BASE_ARCH), i386)
634 # Hardware support
635 OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o
636 OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
637 OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o
638 OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o
639 # virtio support
640 OBJS+= virtio.o virtio-blk.o virtio-balloon.o virtio-net.o
641 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
642 endif
643 ifeq ($(TARGET_BASE_ARCH), ppc)
644 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
645 # shared objects
646 OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o
647 # PREP target
648 OBJS+= pckbd.o ps2.o serial.o i8259.o i8254.o fdc.o m48t59.o mc146818rtc.o
649 OBJS+= prep_pci.o ppc_prep.o
650 # Mac shared devices
651 OBJS+= macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o
652 # OldWorld PowerMac
653 OBJS+= heathrow_pic.o grackle_pci.o ppc_oldworld.o
654 # NewWorld PowerMac
655 OBJS+= unin_pci.o ppc_chrp.o
656 # PowerPC 4xx boards
657 OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o
658 OBJS+= ppc440.o ppc440_bamboo.o
659 ifdef FDT_LIBS
660 OBJS+= device_tree.o
661 LIBS+= $(FDT_LIBS)
662 endif
663 ifdef CONFIG_KVM
664 OBJS+= kvm_ppc.o
665 endif
666 # virtio support
667 OBJS+= virtio.o virtio-blk.o virtio-balloon.o virtio-net.o
668 endif
669 ifeq ($(TARGET_BASE_ARCH), mips)
670 OBJS+= mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o
671 OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o rc4030.o
672 OBJS+= g364fb.o jazz_led.o
673 OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
674 OBJS+= piix_pci.o parallel.o cirrus_vga.o pcspk.o $(SOUND_HW)
675 OBJS+= mipsnet.o
676 OBJS+= pflash_cfi01.o
677 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
678 endif
679 ifeq ($(TARGET_BASE_ARCH), cris)
680 OBJS+= etraxfs.o
681 OBJS+= etraxfs_dma.o
682 OBJS+= etraxfs_pic.o
683 OBJS+= etraxfs_eth.o
684 OBJS+= etraxfs_timer.o
685 OBJS+= etraxfs_ser.o
687 OBJS+= ptimer.o
688 OBJS+= pflash_cfi02.o
689 endif
690 ifeq ($(TARGET_BASE_ARCH), sparc)
691 ifeq ($(TARGET_ARCH), sparc64)
692 OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o
693 OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o
694 OBJS+= cirrus_vga.o parallel.o ptimer.o
695 else
696 OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o
697 OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o sparc32_dma.o
698 OBJS+= cs4231.o ptimer.o eccmemctl.o sbi.o sun4c_intctl.o
699 endif
700 endif
701 ifeq ($(TARGET_BASE_ARCH), arm)
702 OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o
703 OBJS+= arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
704 OBJS+= versatile_pci.o ptimer.o
705 OBJS+= realview_gic.o realview.o arm_sysctl.o mpcore.o
706 OBJS+= armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
707 OBJS+= pl061.o
708 OBJS+= arm-semi.o
709 OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
710 OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
711 OBJS+= pflash_cfi01.o gumstix.o
712 OBJS+= zaurus.o ide.o serial.o nand.o ecc.o spitz.o tosa.o tc6393xb.o
713 OBJS+= omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o
714 OBJS+= omap2.o omap_dss.o soc_dma.o
715 OBJS+= omap_sx1.o palm.o tsc210x.o
716 OBJS+= nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o
717 OBJS+= tsc2005.o bt-hci-csr.o
718 OBJS+= mst_fpga.o mainstone.o
719 OBJS+= musicpal.o pflash_cfi02.o
720 CPPFLAGS += -DHAS_AUDIO
721 endif
722 ifeq ($(TARGET_BASE_ARCH), sh4)
723 OBJS+= shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
724 OBJS+= sh_timer.o ptimer.o sh_serial.o sh_intc.o sh_pci.o sm501.o serial.o
725 OBJS+= ide.o
726 endif
727 ifeq ($(TARGET_BASE_ARCH), m68k)
728 OBJS+= an5206.o mcf5206.o ptimer.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
729 OBJS+= m68k-semi.o dummy_m68k.o
730 endif
731 ifdef CONFIG_GDBSTUB
732 OBJS+=gdbstub.o gdbstub-xml.o
733 endif
734 ifdef CONFIG_COCOA
735 COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
736 ifdef CONFIG_COREAUDIO
737 COCOA_LIBS+=-framework CoreAudio
738 endif
739 endif
740 ifdef CONFIG_SLIRP
741 CPPFLAGS+=-I$(SRC_PATH)/slirp
742 endif
744 LIBS+=$(AIOLIBS)
745 # specific flags are needed for non soft mmu emulator
746 ifdef CONFIG_STATIC
747 LDFLAGS+=-static
748 endif
749 ifndef CONFIG_DARWIN
750 ifndef CONFIG_WIN32
751 ifndef CONFIG_SOLARIS
752 ifndef CONFIG_AIX
753 LIBS+=-lutil
754 endif
755 endif
756 endif
757 endif
758 ifdef TARGET_GPROF
759 vl.o: CFLAGS+=-p
760 LDFLAGS+=-p
761 endif
763 ifeq ($(ARCH),ia64)
764 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
765 endif
767 ifdef CONFIG_WIN32
768 SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
769 endif
771 # profiling code
772 ifdef TARGET_GPROF
773 LDFLAGS+=-p
774 main.o: CFLAGS+=-p
775 endif
777 $(QEMU_PROG): $(OBJS) ../libqemu_common.a libqemu.a
778         $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS)
780 endif # !CONFIG_USER_ONLY
782 gdbstub-xml.c: $(TARGET_XML_FILES) feature_to_c.sh
783         rm -f $@
784 ifeq ($(TARGET_XML_FILES),)
785         echo > $@
786 else
787         $(SHELL) $(SRC_PATH)/feature_to_c.sh $@ $(TARGET_XML_FILES)
788 endif
790 %.o: %.c
791         $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
793 %.o: %.S
794         $(CC) $(CPPFLAGS) -c -o $@ $<
796 clean:
797         rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o
798         rm -f *.d */*.d tcg/*.o
800 install: all
801 ifneq ($(PROGS),)
802         $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
803 endif
805 # Include automatically generated dependency files
806 -include $(wildcard *.d */*.d)