mips_malta: map the CBUS UART as the third serial port
[qemu/mini2440.git] / Makefile.target
bloba97edd7b95c9bc47723d71dfaa221f7271a91795
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),sparc)
102   CFLAGS+=-ffixed-g2 -ffixed-g3
103   OP_CFLAGS+=-fno-delayed-branch -ffixed-i0
104   ifeq ($(CONFIG_SOLARIS),yes)
105     OP_CFLAGS+=-fno-omit-frame-pointer
106   else
107     CFLAGS+=-ffixed-g1 -ffixed-g6
108     HELPER_CFLAGS+=-ffixed-i0
109   endif
110 endif
112 ifeq ($(ARCH),sparc64)
113   OP_CFLAGS+=-mcpu=ultrasparc -m64 -fno-delayed-branch -ffixed-i0
114   ifneq ($(CONFIG_SOLARIS),yes)
115     CFLAGS+=-ffixed-g5 -ffixed-g6 -ffixed-g7
116     OP_CFLAGS+=-ffixed-g5 -ffixed-g6 -ffixed-g7
117   else
118     CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
119   endif
120 endif
122 ifeq ($(ARCH),alpha)
123 # -msmall-data is not used for OP_CFLAGS because we want two-instruction
124 # relocations for the constant constructions
125 # Ensure there's only a single GP
126 CFLAGS+=-msmall-data
127 endif
129 ifeq ($(ARCH),hppa)
130 OP_CFLAGS=-O1 -fno-delayed-branch
131 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
132 endif
134 ifeq ($(ARCH),ia64)
135 CFLAGS+=-mno-sdata
136 OP_CFLAGS+=-mno-sdata
137 endif
139 ifeq ($(ARCH),arm)
140 OP_CFLAGS+=-mno-sched-prolog -fno-omit-frame-pointer
141 endif
143 ifeq ($(ARCH),m68k)
144 OP_CFLAGS+=-fomit-frame-pointer
145 endif
147 ifeq ($(ARCH),mips)
148 OP_CFLAGS+=-mabi=32 -G0 -fno-PIC -mno-abicalls -fomit-frame-pointer -fno-delayed-branch -Wa,-O0
149 endif
151 ifeq ($(ARCH),mips64)
152 OP_CFLAGS+=-mabi=n32 -G0 -fno-PIC -mno-abicalls -fomit-frame-pointer -fno-delayed-branch -Wa,-O0
153 endif
155 CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
156 LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS)
157 OP_CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
159 CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
160 LIBS+=-lm
161 ifdef CONFIG_WIN32
162 LIBS+=-lwinmm -lws2_32 -liphlpapi
163 endif
164 ifdef CONFIG_SOLARIS
165 LIBS+=-lsocket -lnsl -lresolv
166 ifdef NEEDS_LIBSUNMATH
167 LIBS+=-lsunmath
168 LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib
169 OP_CFLAGS+=-I/opt/SUNWspro/prod/include/cc
170 CFLAGS+=-I/opt/SUNWspro/prod/include/cc
171 endif
172 endif
174 kvm.o: CFLAGS+=$(KVM_CFLAGS)
175 kvm-all.o: CFLAGS+=$(KVM_CFLAGS)
177 all: $(PROGS)
179 #########################################################
180 # cpu emulator library
181 LIBOBJS=exec.o kqemu.o translate-all.o cpu-exec.o\
182         translate.o host-utils.o
183 # TCG code generator
184 LIBOBJS+= tcg/tcg.o tcg/tcg-runtime.o
185 CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH)
186 ifeq ($(ARCH),sparc64)
187 CPPFLAGS+=-I$(SRC_PATH)/tcg/sparc
188 endif
189 ifdef CONFIG_SOFTFLOAT
190 LIBOBJS+=fpu/softfloat.o
191 else
192 LIBOBJS+=fpu/softfloat-native.o
193 endif
194 CPPFLAGS+=-I$(SRC_PATH)/fpu
195 LIBOBJS+= op_helper.o helper.o
197 ifeq ($(TARGET_BASE_ARCH), arm)
198 LIBOBJS+= neon_helper.o iwmmxt_helper.o
199 endif
201 ifeq ($(TARGET_BASE_ARCH), alpha)
202 LIBOBJS+= alpha_palcode.o
203 endif
205 ifeq ($(TARGET_BASE_ARCH), cris)
206 LIBOBJS+= cris-dis.o
208 ifndef CONFIG_USER_ONLY
209 LIBOBJS+= mmu.o
210 endif
211 endif
213 # NOTE: the disassembler code is only needed for debugging
214 LIBOBJS+=disas.o
215 ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
216 USE_I386_DIS=y
217 endif
218 ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
219 USE_I386_DIS=y
220 endif
221 ifdef USE_I386_DIS
222 LIBOBJS+=i386-dis.o
223 endif
224 ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
225 LIBOBJS+=alpha-dis.o
226 endif
227 ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
228 LIBOBJS+=ppc-dis.o
229 endif
230 ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips)
231 LIBOBJS+=mips-dis.o
232 endif
233 ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
234 LIBOBJS+=sparc-dis.o
235 endif
236 ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
237 LIBOBJS+=arm-dis.o
238 endif
239 ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
240 LIBOBJS+=m68k-dis.o
241 endif
242 ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
243 LIBOBJS+=sh4-dis.o
244 endif
245 ifeq ($(findstring hppa, $(TARGET_BASE_ARCH) $(ARCH)),hppa)
246 LIBOBJS+=hppa-dis.o
247 endif
248 ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390)
249 LIBOBJS+=s390-dis.o
250 endif
252 # libqemu
254 libqemu.a: $(LIBOBJS)
255         rm -f $@
256         $(AR) rcs $@ $(LIBOBJS)
258 translate.o: translate.c cpu.h
260 translate-all.o: translate-all.c cpu.h
262 tcg/tcg.o: cpu.h
264 machine.o: machine.c
265         $(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $<
267 # HELPER_CFLAGS is used for all the code compiled with static register
268 # variables
269 op_helper.o: op_helper.c
270         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) $(I386_CFLAGS) -c -o $@ $<
272 cpu-exec.o: cpu-exec.c
273         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
275 #########################################################
276 # Linux user emulator target
278 ifdef CONFIG_LINUX_USER
280 ifndef TARGET_ABI_DIR
281   TARGET_ABI_DIR=$(TARGET_ARCH)
282 endif
283 VPATH+=:$(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
284 CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
286 ifdef CONFIG_STATIC
287 LDFLAGS+=-static
288 endif
290 ifeq ($(ARCH),i386)
291 ifdef TARGET_GPROF
292 USE_I386_LD=y
293 endif
294 ifdef CONFIG_STATIC
295 USE_I386_LD=y
296 endif
297 ifdef USE_I386_LD
298 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
299 else
300 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
301 # that the kernel ELF loader considers as an executable. I think this
302 # is the simplest way to make it self virtualizable!
303 LDFLAGS+=-Wl,-shared
304 endif
305 endif
307 ifeq ($(ARCH),x86_64)
308 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
309 endif
311 ifeq ($(ARCH),ppc)
312 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
313 endif
315 ifeq ($(ARCH),ppc64)
316 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
317 endif
319 ifeq ($(ARCH),s390)
320 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
321 endif
323 ifeq ($(ARCH),sparc)
324 # -static is used to avoid g1/g3 usage by the dynamic linker    
325 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
326 endif
328 ifeq ($(ARCH),sparc64)
329 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
330 endif
332 ifeq ($(ARCH),alpha)
333 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
334 endif
336 ifeq ($(ARCH),ia64)
337 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
338 endif
340 ifeq ($(ARCH),arm)
341 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
342 endif
344 ifeq ($(ARCH),m68k)
345 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
346 endif
348 ifeq ($(ARCH),mips)
349 ifeq ($(WORDS_BIGENDIAN),yes)
350 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
351 else
352 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
353 endif
354 endif
356 ifeq ($(ARCH),mips64)
357 ifeq ($(WORDS_BIGENDIAN),yes)
358 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
359 else
360 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
361 endif
362 endif
364 # profiling code
365 ifdef TARGET_GPROF
366 LDFLAGS+=-p
367 CFLAGS+=-p
368 endif
370 OBJS= main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \
371       elfload.o linuxload.o uaccess.o
372 LIBS+= $(AIOLIBS)
373 ifdef TARGET_HAS_BFLT
374 OBJS+= flatload.o
375 endif
376 ifdef TARGET_HAS_ELFLOAD32
377 OBJS+= elfload32.o
378 elfload32.o: elfload.c
379 endif
381 ifeq ($(TARGET_ARCH), i386)
382 OBJS+= vm86.o
383 endif
384 ifeq ($(TARGET_ARCH), arm)
385 OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
386 nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
387  nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o
388 endif
389 ifeq ($(TARGET_ARCH), m68k)
390 OBJS+= m68k-sim.o m68k-semi.o
391 endif
393 ifdef CONFIG_GDBSTUB
394 OBJS+=gdbstub.o gdbstub-xml.o
395 endif
397 OBJS+= libqemu.a
399 # Note: this is a workaround. The real fix is to avoid compiling
400 # cpu_signal_handler() in cpu-exec.c.
401 signal.o: signal.c
402         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
404 $(QEMU_PROG): $(OBJS) ../libqemu_user.a
405         $(CC) $(LDFLAGS) -o $@ $^  $(LIBS)
406 ifeq ($(ARCH),alpha)
407 # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
408 # the address space (31 bit so sign extending doesn't matter)
409         echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
410 endif
412 endif #CONFIG_LINUX_USER
414 #########################################################
415 # Darwin user emulator target
417 ifdef CONFIG_DARWIN_USER
419 VPATH+=:$(SRC_PATH)/darwin-user
420 CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
422 # Leave some space for the regular program loading zone
423 LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000
425 LIBS+=-lmx
427 OBJS= main.o commpage.o machload.o mmap.o signal.o syscall.o thunk.o
429 OBJS+= libqemu.a
431 ifdef CONFIG_GDBSTUB
432 OBJS+=gdbstub.o gdbstub-xml.o
433 endif
435 # Note: this is a workaround. The real fix is to avoid compiling
436 # cpu_signal_handler() in cpu-exec.c.
437 signal.o: signal.c
438         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
440 $(QEMU_PROG): $(OBJS)
441         $(CC) $(LDFLAGS) -o $@ $^  $(LIBS)
443 endif #CONFIG_DARWIN_USER
445 #########################################################
446 # BSD user emulator target
448 ifdef CONFIG_BSD_USER
450 VPATH+=:$(SRC_PATH)/bsd-user
451 CPPFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
453 ifdef CONFIG_STATIC
454 LDFLAGS+=-static
455 endif
457 ifeq ($(ARCH),i386)
458 ifdef TARGET_GPROF
459 USE_I386_LD=y
460 endif
461 ifdef CONFIG_STATIC
462 USE_I386_LD=y
463 endif
464 ifdef USE_I386_LD
465 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
466 else
467 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
468 # that the kernel ELF loader considers as an executable. I think this
469 # is the simplest way to make it self virtualizable!
470 LDFLAGS+=-Wl,-shared
471 endif
472 endif
474 ifeq ($(ARCH),x86_64)
475 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
476 endif
478 ifeq ($(ARCH),ppc)
479 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
480 endif
482 ifeq ($(ARCH),ppc64)
483 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
484 endif
486 ifeq ($(ARCH),s390)
487 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
488 endif
490 ifeq ($(ARCH),sparc)
491 # -static is used to avoid g1/g3 usage by the dynamic linker
492 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
493 endif
495 ifeq ($(ARCH),sparc64)
496 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
497 endif
499 ifeq ($(ARCH),alpha)
500 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
501 endif
503 ifeq ($(ARCH),ia64)
504 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
505 endif
507 ifeq ($(ARCH),arm)
508 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
509 endif
511 ifeq ($(ARCH),m68k)
512 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
513 endif
515 ifeq ($(ARCH),mips)
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 ifeq ($(ARCH),mips64)
524 ifeq ($(WORDS_BIGENDIAN),yes)
525 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
526 else
527 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
528 endif
529 endif
531 OBJS= main.o bsdload.o elfload.o mmap.o path.o signal.o strace.o syscall.o
532 OBJS+= uaccess.o
534 OBJS+= libqemu.a
536 ifdef CONFIG_GDBSTUB
537 OBJS+=gdbstub.o
538 endif
540 # Note: this is a workaround. The real fix is to avoid compiling
541 # cpu_signal_handler() in cpu-exec.c.
542 signal.o: signal.c
543         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
545 $(QEMU_PROG): $(OBJS) ../libqemu_user.a
546         $(CC) $(LDFLAGS) -o $@ $^  $(LIBS)
548 endif #CONFIG_BSD_USER
550 #########################################################
551 # System emulator target
552 ifndef CONFIG_USER_ONLY
554 OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o
555 # virtio has to be here due to weird dependency between PCI and virtio-net.
556 # need to fix this properly
557 OBJS+=virtio.o virtio-blk.o virtio-balloon.o virtio-net.o virtio-console.o
558 OBJS+=fw_cfg.o
559 ifdef CONFIG_KVM
560 OBJS+=kvm.o kvm-all.o
561 endif
562 ifdef CONFIG_WIN32
563 OBJS+=block-raw-win32.o
564 else
565 ifdef CONFIG_AIO
566 OBJS+=posix-aio-compat.o
567 endif
568 OBJS+=block-raw-posix.o
569 endif
571 LIBS+=-lz
572 ifdef CONFIG_ALSA
573 LIBS += -lasound
574 endif
575 ifdef CONFIG_ESD
576 LIBS += -lesd
577 endif
578 ifdef CONFIG_PA
579 LIBS += -lpulse-simple
580 endif
581 ifdef CONFIG_DSOUND
582 LIBS += -lole32 -ldxguid
583 endif
584 ifdef CONFIG_FMOD
585 LIBS += $(CONFIG_FMOD_LIB)
586 endif
587 ifdef CONFIG_OSS
588 LIBS += $(CONFIG_OSS_LIB)
589 endif
591 SOUND_HW = sb16.o es1370.o ac97.o
592 ifdef CONFIG_ADLIB
593 SOUND_HW += fmopl.o adlib.o
594 adlib.o fmopl.o: CFLAGS := ${CFLAGS} -DBUILD_Y8950=0
595 endif
596 ifdef CONFIG_GUS
597 SOUND_HW += gus.o gusemu_hal.o gusemu_mixer.o
598 endif
599 ifdef CONFIG_CS4231A
600 SOUND_HW += cs4231a.o
601 endif
603 ifdef CONFIG_VNC_TLS
604 CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
605 LIBS += $(CONFIG_VNC_TLS_LIBS)
606 endif
608 ifdef CONFIG_BLUEZ
609 LIBS += $(CONFIG_BLUEZ_LIBS)
610 endif
612 # SCSI layer
613 OBJS+= lsi53c895a.o esp.o
615 # USB layer
616 OBJS+= usb-ohci.o
618 # EEPROM emulation
619 OBJS += eeprom93xx.o
621 # PCI network cards
622 OBJS += eepro100.o
623 OBJS += ne2000.o
624 OBJS += pcnet.o
625 OBJS += rtl8139.o
626 OBJS += e1000.o
628 ifeq ($(TARGET_BASE_ARCH), i386)
629 # Hardware support
630 OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o
631 OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
632 OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o
633 OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
634 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
635 endif
636 ifeq ($(TARGET_BASE_ARCH), ppc)
637 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
638 # shared objects
639 OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o
640 # PREP target
641 OBJS+= pckbd.o ps2.o serial.o i8259.o i8254.o fdc.o m48t59.o mc146818rtc.o
642 OBJS+= prep_pci.o ppc_prep.o
643 # Mac shared devices
644 OBJS+= macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o escc.o
645 # OldWorld PowerMac
646 OBJS+= heathrow_pic.o grackle_pci.o ppc_oldworld.o
647 # NewWorld PowerMac
648 OBJS+= unin_pci.o ppc_chrp.o
649 # PowerPC 4xx boards
650 OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o
651 OBJS+= ppc440.o ppc440_bamboo.o
652 ifdef FDT_LIBS
653 OBJS+= device_tree.o
654 LIBS+= $(FDT_LIBS)
655 endif
656 ifdef CONFIG_KVM
657 OBJS+= kvm_ppc.o
658 endif
659 endif
660 ifeq ($(TARGET_BASE_ARCH), mips)
661 OBJS+= mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o
662 OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o rc4030.o
663 OBJS+= g364fb.o jazz_led.o
664 OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
665 OBJS+= piix_pci.o parallel.o cirrus_vga.o pcspk.o $(SOUND_HW)
666 OBJS+= mipsnet.o
667 OBJS+= pflash_cfi01.o
668 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
669 endif
670 ifeq ($(TARGET_BASE_ARCH), cris)
671 # Boards
672 OBJS+= etraxfs.o axis_dev88.o
674 # IO blocks
675 OBJS+= etraxfs_dma.o
676 OBJS+= etraxfs_pic.o
677 OBJS+= etraxfs_eth.o
678 OBJS+= etraxfs_timer.o
679 OBJS+= etraxfs_ser.o
681 OBJS+= ptimer.o
682 OBJS+= pflash_cfi02.o nand.o
683 endif
684 ifeq ($(TARGET_BASE_ARCH), sparc)
685 ifeq ($(TARGET_ARCH), sparc64)
686 OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o
687 OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o
688 OBJS+= cirrus_vga.o parallel.o ptimer.o
689 else
690 OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o
691 OBJS+= slavio_timer.o escc.o slavio_misc.o fdc.o sparc32_dma.o
692 OBJS+= cs4231.o ptimer.o eccmemctl.o sbi.o sun4c_intctl.o
693 endif
694 endif
695 ifeq ($(TARGET_BASE_ARCH), arm)
696 OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o
697 OBJS+= arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
698 OBJS+= versatile_pci.o ptimer.o
699 OBJS+= realview_gic.o realview.o arm_sysctl.o mpcore.o
700 OBJS+= armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
701 OBJS+= pl061.o
702 OBJS+= arm-semi.o
703 OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
704 OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
705 OBJS+= pflash_cfi01.o gumstix.o
706 OBJS+= zaurus.o ide.o serial.o nand.o ecc.o spitz.o tosa.o tc6393xb.o
707 OBJS+= omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o
708 OBJS+= omap2.o omap_dss.o soc_dma.o
709 OBJS+= omap_sx1.o palm.o tsc210x.o
710 OBJS+= nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o
711 OBJS+= tsc2005.o bt-hci-csr.o
712 OBJS+= mst_fpga.o mainstone.o
713 OBJS+= musicpal.o pflash_cfi02.o
714 CPPFLAGS += -DHAS_AUDIO
715 endif
716 ifeq ($(TARGET_BASE_ARCH), sh4)
717 OBJS+= shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
718 OBJS+= sh_timer.o ptimer.o sh_serial.o sh_intc.o sh_pci.o sm501.o serial.o
719 OBJS+= ide.o
720 endif
721 ifeq ($(TARGET_BASE_ARCH), m68k)
722 OBJS+= an5206.o mcf5206.o ptimer.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
723 OBJS+= m68k-semi.o dummy_m68k.o
724 endif
725 ifdef CONFIG_GDBSTUB
726 OBJS+=gdbstub.o gdbstub-xml.o
727 endif
728 ifdef CONFIG_COCOA
729 COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
730 ifdef CONFIG_COREAUDIO
731 COCOA_LIBS+=-framework CoreAudio
732 endif
733 endif
734 ifdef CONFIG_SLIRP
735 CPPFLAGS+=-I$(SRC_PATH)/slirp
736 endif
738 LIBS+=$(AIOLIBS)
739 # specific flags are needed for non soft mmu emulator
740 ifdef CONFIG_STATIC
741 LDFLAGS+=-static
742 endif
743 ifndef CONFIG_DARWIN
744 ifndef CONFIG_WIN32
745 ifndef CONFIG_SOLARIS
746 ifndef CONFIG_AIX
747 LIBS+=-lutil
748 endif
749 endif
750 endif
751 endif
752 ifdef TARGET_GPROF
753 vl.o: CFLAGS+=-p
754 LDFLAGS+=-p
755 endif
757 ifeq ($(ARCH),ia64)
758 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
759 endif
761 ifdef CONFIG_WIN32
762 SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
763 endif
765 # profiling code
766 ifdef TARGET_GPROF
767 LDFLAGS+=-p
768 main.o: CFLAGS+=-p
769 endif
771 $(QEMU_PROG): $(OBJS) ../libqemu_common.a libqemu.a
772         $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS)
774 endif # !CONFIG_USER_ONLY
776 gdbstub-xml.c: $(TARGET_XML_FILES) feature_to_c.sh
777         rm -f $@
778 ifeq ($(TARGET_XML_FILES),)
779         echo > $@
780 else
781         $(SHELL) $(SRC_PATH)/feature_to_c.sh $@ $(TARGET_XML_FILES)
782 endif
784 %.o: %.c
785         $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
787 %.o: %.S
788         $(CC) $(CPPFLAGS) -c -o $@ $<
790 clean:
791         rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o
792         rm -f *.d */*.d tcg/*.o
794 install: all
795 ifneq ($(PROGS),)
796         $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
797 endif
799 # Include automatically generated dependency files
800 -include $(wildcard *.d */*.d)