Merge branch 'master' of ../qemu
[qemu/z80.git] / Makefile.target
blob369cfb3a3ef1c7fc7643e527918e090988cd843c
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 ifeq ($(TARGET_BASE_ARCH), z80)
219 ifdef CONFIG_LIBSPECTRUM
220 LIBS+=-lspectrum
221 endif
222 endif
224 # NOTE: the disassembler code is only needed for debugging
225 LIBOBJS+=disas.o
226 ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
227 USE_I386_DIS=y
228 endif
229 ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
230 USE_I386_DIS=y
231 endif
232 ifdef USE_I386_DIS
233 LIBOBJS+=i386-dis.o
234 endif
235 ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
236 LIBOBJS+=alpha-dis.o
237 endif
238 ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
239 LIBOBJS+=ppc-dis.o
240 endif
241 ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips)
242 LIBOBJS+=mips-dis.o
243 endif
244 ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
245 LIBOBJS+=sparc-dis.o
246 endif
247 ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
248 LIBOBJS+=arm-dis.o
249 endif
250 ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
251 LIBOBJS+=m68k-dis.o
252 endif
253 ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
254 LIBOBJS+=sh4-dis.o
255 endif
256 ifeq ($(findstring hppa, $(TARGET_BASE_ARCH) $(ARCH)),hppa)
257 LIBOBJS+=hppa-dis.o
258 endif
259 ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390)
260 LIBOBJS+=s390-dis.o
261 endif
262 ifeq ($(findstring z80, $(TARGET_ARCH) $(ARCH)),z80)
263 LIBOBJS+=z80-dis.o
264 endif
266 # libqemu
268 libqemu.a: $(LIBOBJS)
269         rm -f $@
270         $(AR) rcs $@ $(LIBOBJS)
272 translate.o: translate.c cpu.h
274 translate-all.o: translate-all.c cpu.h
276 tcg/tcg.o: cpu.h
278 machine.o: machine.c
279         $(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $<
281 # HELPER_CFLAGS is used for all the code compiled with static register
282 # variables
283 op_helper.o: op_helper.c
284         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) $(I386_CFLAGS) -c -o $@ $<
286 cpu-exec.o: cpu-exec.c
287         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
289 #########################################################
290 # Linux user emulator target
292 ifdef CONFIG_LINUX_USER
294 ifndef TARGET_ABI_DIR
295   TARGET_ABI_DIR=$(TARGET_ARCH)
296 endif
297 VPATH+=:$(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
298 CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
300 ifdef CONFIG_STATIC
301 LDFLAGS+=-static
302 endif
304 ifeq ($(ARCH),i386)
305 ifdef TARGET_GPROF
306 USE_I386_LD=y
307 endif
308 ifdef CONFIG_STATIC
309 USE_I386_LD=y
310 endif
311 ifdef USE_I386_LD
312 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
313 else
314 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
315 # that the kernel ELF loader considers as an executable. I think this
316 # is the simplest way to make it self virtualizable!
317 LDFLAGS+=-Wl,-shared
318 endif
319 endif
321 ifeq ($(ARCH),x86_64)
322 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
323 endif
325 ifeq ($(ARCH),ppc)
326 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
327 endif
329 ifeq ($(ARCH),ppc64)
330 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
331 endif
333 ifeq ($(ARCH),s390)
334 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
335 endif
337 ifeq ($(ARCH),sparc)
338 # -static is used to avoid g1/g3 usage by the dynamic linker    
339 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
340 endif
342 ifeq ($(ARCH),sparc64)
343 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
344 endif
346 ifeq ($(ARCH),alpha)
347 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
348 endif
350 ifeq ($(ARCH),ia64)
351 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
352 endif
354 ifeq ($(ARCH),arm)
355 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
356 endif
358 ifeq ($(ARCH),m68k)
359 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
360 endif
362 ifeq ($(ARCH),mips)
363 ifeq ($(WORDS_BIGENDIAN),yes)
364 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
365 else
366 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
367 endif
368 endif
370 ifeq ($(ARCH),mips64)
371 ifeq ($(WORDS_BIGENDIAN),yes)
372 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
373 else
374 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
375 endif
376 endif
378 # profiling code
379 ifdef TARGET_GPROF
380 LDFLAGS+=-p
381 CFLAGS+=-p
382 endif
384 OBJS= main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \
385       elfload.o linuxload.o uaccess.o
386 LIBS+= $(AIOLIBS)
387 ifdef TARGET_HAS_BFLT
388 OBJS+= flatload.o
389 endif
390 ifdef TARGET_HAS_ELFLOAD32
391 OBJS+= elfload32.o
392 elfload32.o: elfload.c
393 endif
395 ifeq ($(TARGET_ARCH), i386)
396 OBJS+= vm86.o
397 endif
398 ifeq ($(TARGET_ARCH), arm)
399 OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
400 nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
401  nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o
402 endif
403 ifeq ($(TARGET_ARCH), m68k)
404 OBJS+= m68k-sim.o m68k-semi.o
405 endif
407 ifdef CONFIG_GDBSTUB
408 OBJS+=gdbstub.o gdbstub-xml.o
409 endif
411 OBJS+= libqemu.a
413 # Note: this is a workaround. The real fix is to avoid compiling
414 # cpu_signal_handler() in cpu-exec.c.
415 signal.o: signal.c
416         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
418 $(QEMU_PROG): $(OBJS) ../libqemu_user.a
419         $(CC) $(LDFLAGS) -o $@ $^  $(LIBS)
420 ifeq ($(ARCH),alpha)
421 # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
422 # the address space (31 bit so sign extending doesn't matter)
423         echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
424 endif
426 endif #CONFIG_LINUX_USER
428 #########################################################
429 # Darwin user emulator target
431 ifdef CONFIG_DARWIN_USER
433 VPATH+=:$(SRC_PATH)/darwin-user
434 CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
436 # Leave some space for the regular program loading zone
437 LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000
439 LIBS+=-lmx
441 OBJS= main.o commpage.o machload.o mmap.o signal.o syscall.o thunk.o
443 OBJS+= libqemu.a
445 ifdef CONFIG_GDBSTUB
446 OBJS+=gdbstub.o gdbstub-xml.o
447 endif
449 # Note: this is a workaround. The real fix is to avoid compiling
450 # cpu_signal_handler() in cpu-exec.c.
451 signal.o: signal.c
452         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
454 $(QEMU_PROG): $(OBJS)
455         $(CC) $(LDFLAGS) -o $@ $^  $(LIBS)
457 endif #CONFIG_DARWIN_USER
459 #########################################################
460 # BSD user emulator target
462 ifdef CONFIG_BSD_USER
464 VPATH+=:$(SRC_PATH)/bsd-user
465 CPPFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
467 ifdef CONFIG_STATIC
468 LDFLAGS+=-static
469 endif
471 ifeq ($(ARCH),i386)
472 ifdef TARGET_GPROF
473 USE_I386_LD=y
474 endif
475 ifdef CONFIG_STATIC
476 USE_I386_LD=y
477 endif
478 ifdef USE_I386_LD
479 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
480 else
481 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
482 # that the kernel ELF loader considers as an executable. I think this
483 # is the simplest way to make it self virtualizable!
484 LDFLAGS+=-Wl,-shared
485 endif
486 endif
488 ifeq ($(ARCH),x86_64)
489 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
490 endif
492 ifeq ($(ARCH),ppc)
493 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
494 endif
496 ifeq ($(ARCH),ppc64)
497 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
498 endif
500 ifeq ($(ARCH),s390)
501 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
502 endif
504 ifeq ($(ARCH),sparc)
505 # -static is used to avoid g1/g3 usage by the dynamic linker
506 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
507 endif
509 ifeq ($(ARCH),sparc64)
510 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
511 endif
513 ifeq ($(ARCH),alpha)
514 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
515 endif
517 ifeq ($(ARCH),ia64)
518 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
519 endif
521 ifeq ($(ARCH),arm)
522 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
523 endif
525 ifeq ($(ARCH),m68k)
526 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
527 endif
529 ifeq ($(ARCH),mips)
530 ifeq ($(WORDS_BIGENDIAN),yes)
531 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
532 else
533 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
534 endif
535 endif
537 ifeq ($(ARCH),mips64)
538 ifeq ($(WORDS_BIGENDIAN),yes)
539 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
540 else
541 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
542 endif
543 endif
545 OBJS= main.o bsdload.o elfload.o mmap.o path.o signal.o strace.o syscall.o
546 OBJS+= uaccess.o
548 OBJS+= libqemu.a
550 ifdef CONFIG_GDBSTUB
551 OBJS+=gdbstub.o
552 endif
554 # Note: this is a workaround. The real fix is to avoid compiling
555 # cpu_signal_handler() in cpu-exec.c.
556 signal.o: signal.c
557         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
559 $(QEMU_PROG): $(OBJS) ../libqemu_user.a
560         $(CC) $(LDFLAGS) -o $@ $^  $(LIBS)
562 endif #CONFIG_BSD_USER
564 #########################################################
565 # System emulator target
566 ifndef CONFIG_USER_ONLY
568 OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o
569 # virtio has to be here due to weird dependency between PCI and virtio-net.
570 # need to fix this properly
571 OBJS+=virtio.o virtio-blk.o virtio-balloon.o virtio-net.o
572 OBJS+=fw_cfg.o
573 ifdef CONFIG_KVM
574 OBJS+=kvm.o kvm-all.o
575 endif
576 ifdef CONFIG_WIN32
577 OBJS+=block-raw-win32.o
578 else
579 ifdef CONFIG_AIO
580 OBJS+=posix-aio-compat.o
581 endif
582 OBJS+=block-raw-posix.o
583 endif
585 LIBS+=-lz
586 ifdef CONFIG_ALSA
587 LIBS += -lasound
588 endif
589 ifdef CONFIG_ESD
590 LIBS += -lesd
591 endif
592 ifdef CONFIG_PA
593 LIBS += -lpulse-simple
594 endif
595 ifdef CONFIG_DSOUND
596 LIBS += -lole32 -ldxguid
597 endif
598 ifdef CONFIG_FMOD
599 LIBS += $(CONFIG_FMOD_LIB)
600 endif
601 ifdef CONFIG_OSS
602 LIBS += $(CONFIG_OSS_LIB)
603 endif
605 SOUND_HW = sb16.o es1370.o
606 ifdef CONFIG_AC97
607 SOUND_HW += ac97.o
608 endif
609 ifdef CONFIG_ADLIB
610 SOUND_HW += fmopl.o adlib.o
611 adlib.o fmopl.o: CFLAGS := ${CFLAGS} -DBUILD_Y8950=0
612 endif
613 ifdef CONFIG_GUS
614 SOUND_HW += gus.o gusemu_hal.o gusemu_mixer.o
615 endif
616 ifdef CONFIG_CS4231A
617 SOUND_HW += cs4231a.o
618 endif
620 ifdef CONFIG_VNC_TLS
621 CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
622 LIBS += $(CONFIG_VNC_TLS_LIBS)
623 endif
625 ifdef CONFIG_BLUEZ
626 LIBS += $(CONFIG_BLUEZ_LIBS)
627 endif
629 # SCSI layer
630 OBJS+= lsi53c895a.o esp.o
632 # USB layer
633 OBJS+= usb-ohci.o
635 # EEPROM emulation
636 OBJS += eeprom93xx.o
638 # PCI network cards
639 OBJS += eepro100.o
640 OBJS += ne2000.o
641 OBJS += pcnet.o
642 OBJS += rtl8139.o
643 OBJS += e1000.o
645 ifeq ($(TARGET_BASE_ARCH), i386)
646 # Hardware support
647 OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o
648 OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
649 OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o
650 OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
651 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
652 endif
653 ifeq ($(TARGET_BASE_ARCH), ppc)
654 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
655 # shared objects
656 OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o
657 # PREP target
658 OBJS+= pckbd.o ps2.o serial.o i8259.o i8254.o fdc.o m48t59.o mc146818rtc.o
659 OBJS+= prep_pci.o ppc_prep.o
660 # Mac shared devices
661 OBJS+= macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o
662 # OldWorld PowerMac
663 OBJS+= heathrow_pic.o grackle_pci.o ppc_oldworld.o
664 # NewWorld PowerMac
665 OBJS+= unin_pci.o ppc_chrp.o
666 # PowerPC 4xx boards
667 OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o
668 OBJS+= ppc440.o ppc440_bamboo.o
669 ifdef FDT_LIBS
670 OBJS+= device_tree.o
671 LIBS+= $(FDT_LIBS)
672 endif
673 ifdef CONFIG_KVM
674 OBJS+= kvm_ppc.o
675 endif
676 endif
677 ifeq ($(TARGET_BASE_ARCH), mips)
678 OBJS+= mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o
679 OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o rc4030.o
680 OBJS+= g364fb.o jazz_led.o
681 OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
682 OBJS+= piix_pci.o parallel.o cirrus_vga.o pcspk.o $(SOUND_HW)
683 OBJS+= mipsnet.o
684 OBJS+= pflash_cfi01.o
685 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
686 endif
687 ifeq ($(TARGET_BASE_ARCH), cris)
688 OBJS+= etraxfs.o
689 OBJS+= etraxfs_dma.o
690 OBJS+= etraxfs_pic.o
691 OBJS+= etraxfs_eth.o
692 OBJS+= etraxfs_timer.o
693 OBJS+= etraxfs_ser.o
695 OBJS+= ptimer.o
696 OBJS+= pflash_cfi02.o
697 endif
698 ifeq ($(TARGET_BASE_ARCH), sparc)
699 ifeq ($(TARGET_ARCH), sparc64)
700 OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o
701 OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o
702 OBJS+= cirrus_vga.o parallel.o ptimer.o
703 else
704 OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o
705 OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o sparc32_dma.o
706 OBJS+= cs4231.o ptimer.o eccmemctl.o sbi.o sun4c_intctl.o
707 endif
708 endif
709 ifeq ($(TARGET_BASE_ARCH), arm)
710 OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o
711 OBJS+= arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
712 OBJS+= versatile_pci.o ptimer.o
713 OBJS+= realview_gic.o realview.o arm_sysctl.o mpcore.o
714 OBJS+= armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
715 OBJS+= pl061.o
716 OBJS+= arm-semi.o
717 OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
718 OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
719 OBJS+= pflash_cfi01.o gumstix.o
720 OBJS+= zaurus.o ide.o serial.o nand.o ecc.o spitz.o tosa.o tc6393xb.o
721 OBJS+= omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o
722 OBJS+= omap2.o omap_dss.o soc_dma.o
723 OBJS+= omap_sx1.o palm.o tsc210x.o
724 OBJS+= nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o
725 OBJS+= tsc2005.o bt-hci-csr.o
726 OBJS+= mst_fpga.o mainstone.o
727 OBJS+= musicpal.o pflash_cfi02.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 ptimer.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 ptimer.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
737 OBJS+= m68k-semi.o dummy_m68k.o
738 endif
739 ifeq ($(TARGET_BASE_ARCH), z80)
740 OBJS+= zx_spectrum.o zx_video.o dma.o
741 OBJS+= serial.o i8259.o
742 endif
743 ifdef CONFIG_GDBSTUB
744 OBJS+=gdbstub.o gdbstub-xml.o
745 endif
746 ifdef CONFIG_COCOA
747 COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
748 ifdef CONFIG_COREAUDIO
749 COCOA_LIBS+=-framework CoreAudio
750 endif
751 endif
752 ifdef CONFIG_SLIRP
753 CPPFLAGS+=-I$(SRC_PATH)/slirp
754 endif
756 LIBS+=$(AIOLIBS)
757 # specific flags are needed for non soft mmu emulator
758 ifdef CONFIG_STATIC
759 LDFLAGS+=-static
760 endif
761 ifndef CONFIG_DARWIN
762 ifndef CONFIG_WIN32
763 ifndef CONFIG_SOLARIS
764 ifndef CONFIG_AIX
765 LIBS+=-lutil
766 endif
767 endif
768 endif
769 endif
770 ifdef TARGET_GPROF
771 vl.o: CFLAGS+=-p
772 LDFLAGS+=-p
773 endif
775 ifeq ($(ARCH),ia64)
776 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
777 endif
779 ifdef CONFIG_WIN32
780 SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
781 endif
783 # profiling code
784 ifdef TARGET_GPROF
785 LDFLAGS+=-p
786 main.o: CFLAGS+=-p
787 endif
789 $(QEMU_PROG): $(OBJS) ../libqemu_common.a libqemu.a
790         $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS)
792 endif # !CONFIG_USER_ONLY
794 gdbstub-xml.c: $(TARGET_XML_FILES) feature_to_c.sh
795         rm -f $@
796 ifeq ($(TARGET_XML_FILES),)
797         echo > $@
798 else
799         $(SHELL) $(SRC_PATH)/feature_to_c.sh $@ $(TARGET_XML_FILES)
800 endif
802 %.o: %.c
803         $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
805 %.o: %.S
806         $(CC) $(CPPFLAGS) -c -o $@ $<
808 clean:
809         rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o
810         rm -f *.d */*.d tcg/*.o
812 install: all
813 ifneq ($(PROGS),)
814         $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
815 endif
817 # Include automatically generated dependency files
818 -include $(wildcard *.d */*.d)