]> git.proxmox.com Git - mirror_qemu.git/blame - Makefile.target
machine struct - use C99 initializers (Jes Sorensen)
[mirror_qemu.git] / Makefile.target
CommitLineData
626df76a
FB
1include config.mak
2
0b0babc6
FB
3TARGET_BASE_ARCH:=$(TARGET_ARCH)
4ifeq ($(TARGET_ARCH), x86_64)
5TARGET_BASE_ARCH:=i386
6endif
540635ba
TS
7ifeq ($(TARGET_ARCH), mipsn32)
8TARGET_BASE_ARCH:=mips
9endif
fbe4f65b
TS
10ifeq ($(TARGET_ARCH), mips64)
11TARGET_BASE_ARCH:=mips
12endif
a2458627
FB
13ifeq ($(TARGET_ARCH), ppc64)
14TARGET_BASE_ARCH:=ppc
15endif
22f8a8b3
JM
16ifeq ($(TARGET_ARCH), ppc64h)
17TARGET_BASE_ARCH:=ppc
18endif
d4082e95
JM
19ifeq ($(TARGET_ARCH), ppcemb)
20TARGET_BASE_ARCH:=ppc
21endif
64b3ab24
FB
22ifeq ($(TARGET_ARCH), sparc64)
23TARGET_BASE_ARCH:=sparc
24endif
0b0babc6 25TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
4fb240a4 26VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw
46dc3881 27CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MT $@ -MP -DNEED_CPU_H
0b0babc6 28#CFLAGS+=-Werror
626df76a 29LIBS=
67b915a5 30DYNGEN=../dyngen$(EXESUF)
1e43adfc 31# user emulator name
0c64b9cd 32ifndef TARGET_ARCH2
c91fde65 33TARGET_ARCH2=$(TARGET_ARCH)
0c64b9cd 34endif
808c4954
FB
35ifeq ($(TARGET_ARCH),arm)
36 ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
c91fde65 37 TARGET_ARCH2=armeb
808c4954 38 endif
c91fde65 39endif
908f52b0
PB
40ifeq ($(TARGET_ARCH),sh4)
41 ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
42 TARGET_ARCH2=sh4eb
43 endif
44endif
01f5e596 45ifeq ($(TARGET_ARCH),mips)
c91fde65
FB
46 ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
47 TARGET_ARCH2=mipsel
01f5e596 48 endif
01f5e596 49endif
540635ba
TS
50ifeq ($(TARGET_ARCH),mipsn32)
51 ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
52 TARGET_ARCH2=mipsn32el
53 endif
54endif
fbe4f65b
TS
55ifeq ($(TARGET_ARCH),mips64)
56 ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
57 TARGET_ARCH2=mips64el
58 endif
59endif
40293e58
FB
60
61ifdef CONFIG_USER_ONLY
62# user emulator name
63QEMU_PROG=qemu-$(TARGET_ARCH2)
64else
1e43adfc 65# system emulator name
a541f297 66ifeq ($(TARGET_ARCH), i386)
40293e58 67QEMU_PROG=qemu$(EXESUF)
0db63474 68else
40293e58 69QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF)
a541f297 70endif
de5eaa64 71endif
626df76a 72
40293e58 73PROGS=$(QEMU_PROG)
626df76a 74
6f30fa85 75# We require -O2 to avoid the stack setup prologue in EXIT_TB
ac41a620
BS
76OP_CFLAGS := -O2 -g -fno-strict-aliasing
77OP_CFLAGS += -Wall -Wundef -Wendif-labels -Wwrite-strings
6c041c54
TS
78
79# cc-option
80# Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0)
81
82cc-option = $(shell if $(CC) $(OP_CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
83 > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
84
85OP_CFLAGS+=$(call cc-option, -fno-reorder-blocks, "")
86OP_CFLAGS+=$(call cc-option, -fno-gcse, "")
87OP_CFLAGS+=$(call cc-option, -fno-tree-ch, "")
88OP_CFLAGS+=$(call cc-option, -fno-optimize-sibling-calls, "")
89OP_CFLAGS+=$(call cc-option, -fno-crossjumping, "")
90OP_CFLAGS+=$(call cc-option, -fno-align-labels, "")
91OP_CFLAGS+=$(call cc-option, -fno-align-jumps, "")
92OP_CFLAGS+=$(call cc-option, -fno-align-functions, $(call cc-option, -malign-functions=0, ""))
1870a74c 93OP_CFLAGS+=$(call cc-option, -fno-section-anchors, "")
6f30fa85 94
40293e58
FB
95HELPER_CFLAGS=
96
626df76a 97ifeq ($(ARCH),i386)
6f30fa85
TS
98HELPER_CFLAGS+=-fomit-frame-pointer
99OP_CFLAGS+=-mpreferred-stack-boundary=2 -fomit-frame-pointer
f2bf094e
AJ
100# op.c and helper.c need this on 32-bit x86 system to avoid
101# a compiler spill error. This can probably go away
102# once the SSE ops have been converted to TCG
103ifeq ($(HAVE_GT_GCC_3_3), true)
104I386_CFLAGS=-march=i586 -mtune=i686
105endif
bc51c5c9
FB
106endif
107
626df76a 108ifeq ($(ARCH),ppc)
6f30fa85 109CPPFLAGS+= -D__powerpc__
176a4f29 110OP_CFLAGS+= -mlongcall
626df76a
FB
111endif
112
113ifeq ($(ARCH),sparc)
40293e58 114 CFLAGS+=-ffixed-g2 -ffixed-g3
3142255c
BS
115 OP_CFLAGS+=-fno-delayed-branch -ffixed-i0
116 ifeq ($(CONFIG_SOLARIS),yes)
117 OP_CFLAGS+=-fno-omit-frame-pointer
118 else
40293e58
FB
119 CFLAGS+=-ffixed-g1 -ffixed-g6
120 HELPER_CFLAGS+=-ffixed-i0
3142255c 121 endif
fdbb4691 122endif
626df76a
FB
123
124ifeq ($(ARCH),sparc64)
3142255c
BS
125 OP_CFLAGS+=-mcpu=ultrasparc -m64 -fno-delayed-branch -ffixed-i0
126 ifneq ($(CONFIG_SOLARIS),yes)
e97b640d
BS
127 CFLAGS+=-ffixed-g5 -ffixed-g6 -ffixed-g7
128 OP_CFLAGS+=-ffixed-g5 -ffixed-g6 -ffixed-g7
129 else
130 CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
3142255c 131 endif
626df76a
FB
132endif
133
134ifeq ($(ARCH),alpha)
6f30fa85
TS
135# -msmall-data is not used for OP_CFLAGS because we want two-instruction
136# relocations for the constant constructions
626df76a 137# Ensure there's only a single GP
40293e58 138CFLAGS+=-msmall-data
626df76a
FB
139endif
140
f54b3f92
AJ
141ifeq ($(ARCH),hppa)
142OP_CFLAGS=-O1 -fno-delayed-branch
143BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
144endif
145
626df76a 146ifeq ($(ARCH),ia64)
40293e58 147CFLAGS+=-mno-sdata
6f30fa85 148OP_CFLAGS+=-mno-sdata
626df76a
FB
149endif
150
151ifeq ($(ARCH),arm)
6f30fa85 152OP_CFLAGS+=-mno-sched-prolog -fno-omit-frame-pointer
626df76a
FB
153endif
154
38e584a0 155ifeq ($(ARCH),m68k)
6f30fa85 156OP_CFLAGS+=-fomit-frame-pointer
6f30fa85
TS
157endif
158
159ifeq ($(ARCH),mips)
9617efe8 160OP_CFLAGS+=-mabi=32 -G0 -fno-PIC -mno-abicalls -fomit-frame-pointer -fno-delayed-branch -Wa,-O0
fbe4f65b
TS
161endif
162
163ifeq ($(ARCH),mips64)
9617efe8 164OP_CFLAGS+=-mabi=n32 -G0 -fno-PIC -mno-abicalls -fomit-frame-pointer -fno-delayed-branch -Wa,-O0
83fb7adf
FB
165endif
166
40293e58
FB
167CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
168LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS)
3142255c 169OP_CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
626df76a 170
6f30fa85 171CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
626df76a 172LIBS+=-lm
67b915a5 173ifdef CONFIG_WIN32
3db38e87 174LIBS+=-lwinmm -lws2_32 -liphlpapi
67b915a5 175endif
ec530c81
FB
176ifdef CONFIG_SOLARIS
177LIBS+=-lsocket -lnsl -lresolv
0475a5ca
TS
178ifdef NEEDS_LIBSUNMATH
179LIBS+=-lsunmath
180LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib
181OP_CFLAGS+=-I/opt/SUNWspro/prod/include/cc
40293e58 182CFLAGS+=-I/opt/SUNWspro/prod/include/cc
f72b519c 183endif
831b7825
TS
184endif
185
40293e58 186all: $(PROGS)
626df76a 187
40293e58 188#########################################################
626df76a 189# cpu emulator library
57fec1fe 190LIBOBJS=exec.o kqemu.o translate-all.o cpu-exec.o\
cf2be984 191 translate.o host-utils.o
bf6247fb 192ifdef CONFIG_DYNGEN_OP
48ffabc6 193exec.o: dyngen-opc.h
cf2be984
BS
194LIBOBJS+=op.o
195endif
57fec1fe
FB
196# TCG code generator
197LIBOBJS+= tcg/tcg.o tcg/tcg-dyngen.o tcg/tcg-runtime.o
198CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH)
8289b279
BS
199ifeq ($(ARCH),sparc64)
200CPPFLAGS+=-I$(SRC_PATH)/tcg/sparc
201endif
158142c2
FB
202ifdef CONFIG_SOFTFLOAT
203LIBOBJS+=fpu/softfloat.o
204else
205LIBOBJS+=fpu/softfloat-native.o
206endif
6f30fa85 207CPPFLAGS+=-I$(SRC_PATH)/fpu
e95c8d51 208LIBOBJS+= op_helper.o helper.o
e95c8d51 209
b7bcbe95 210ifeq ($(TARGET_BASE_ARCH), arm)
eaa728ee 211LIBOBJS+= neon_helper.o iwmmxt_helper.o
e6e5906b
PB
212endif
213
cf6c1b16 214ifeq ($(TARGET_BASE_ARCH), alpha)
eaa728ee 215LIBOBJS+= alpha_palcode.o
cf6c1b16
JM
216endif
217
e7daa605 218ifeq ($(TARGET_BASE_ARCH), cris)
e7daa605
TS
219LIBOBJS+= cris-dis.o
220
221ifndef CONFIG_USER_ONLY
222LIBOBJS+= mmu.o
223endif
224endif
225
626df76a 226# NOTE: the disassembler code is only needed for debugging
5fafdf24 227LIBOBJS+=disas.o
626df76a 228ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
bc51c5c9
FB
229USE_I386_DIS=y
230endif
0b0babc6 231ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
bc51c5c9
FB
232USE_I386_DIS=y
233endif
234ifdef USE_I386_DIS
626df76a
FB
235LIBOBJS+=i386-dis.o
236endif
237ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
238LIBOBJS+=alpha-dis.o
239endif
a2458627 240ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
626df76a
FB
241LIBOBJS+=ppc-dis.o
242endif
fbe4f65b 243ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips)
6af0bf9c
FB
244LIBOBJS+=mips-dis.o
245endif
64b3ab24 246ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
626df76a
FB
247LIBOBJS+=sparc-dis.o
248endif
249ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
250LIBOBJS+=arm-dis.o
251endif
48024e4a
FB
252ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
253LIBOBJS+=m68k-dis.o
254endif
fdf9b3e8
FB
255ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
256LIBOBJS+=sh4-dis.o
257endif
f54b3f92
AJ
258ifeq ($(findstring hppa, $(TARGET_BASE_ARCH) $(ARCH)),hppa)
259LIBOBJS+=hppa-dis.o
260endif
8f860bb8
TS
261ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390)
262LIBOBJS+=s390-dis.o
263endif
626df76a 264
40293e58
FB
265# libqemu
266
bf6247fb 267ifdef CONFIG_DYNGEN_OP
dd48594e 268OPC_H = gen-op.h dyngen-opc.h op.h
cf2be984 269endif
dd48594e 270
40293e58
FB
271libqemu.a: $(LIBOBJS)
272 rm -f $@
273 $(AR) rcs $@ $(LIBOBJS)
274
dd48594e
PB
275translate.o: translate.c cpu.h $(OPC_H)
276
277translate-all.o: translate-all.c cpu.h $(OPC_H)
278
279tcg/tcg.o: cpu.h $(OPC_H)
40293e58 280
dd48594e 281tcg/tcg-dyngen.o: $(OPC_H)
40293e58 282
dd48594e 283tcg/tcg-runtime.o: $(OPC_H)
40293e58
FB
284
285op.h: op.o $(DYNGEN)
286 $(DYNGEN) -o $@ $<
287
57fec1fe 288dyngen-opc.h: op.o $(DYNGEN)
40293e58
FB
289 $(DYNGEN) -c -o $@ $<
290
291gen-op.h: op.o $(DYNGEN)
292 $(DYNGEN) -g -o $@ $<
293
294op.o: op.c
f2bf094e 295 $(CC) $(OP_CFLAGS) $(CPPFLAGS) $(I386_CFLAGS) -c -o $@ $<
40293e58 296
8dd3dca3
AJ
297machine.o: machine.c
298 $(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $<
299
40293e58
FB
300# HELPER_CFLAGS is used for all the code compiled with static register
301# variables
40293e58 302op_helper.o: op_helper.c
eaa728ee 303 $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) $(I386_CFLAGS) -c -o $@ $<
40293e58 304
c96402b1 305cpu-exec.o: cpu-exec.c $(OPC_H)
40293e58
FB
306 $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
307
308#########################################################
309# Linux user emulator target
310
311ifdef CONFIG_LINUX_USER
312
40293e58
FB
313ifndef TARGET_ABI_DIR
314 TARGET_ABI_DIR=$(TARGET_ARCH)
315endif
3ebdd119 316VPATH+=:$(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
40293e58
FB
317CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
318
319ifdef CONFIG_STATIC
320LDFLAGS+=-static
321endif
322
323ifeq ($(ARCH),i386)
324ifdef TARGET_GPROF
325USE_I386_LD=y
326endif
327ifdef CONFIG_STATIC
328USE_I386_LD=y
329endif
330ifdef USE_I386_LD
331LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
332else
333# WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
334# that the kernel ELF loader considers as an executable. I think this
335# is the simplest way to make it self virtualizable!
336LDFLAGS+=-Wl,-shared
337endif
338endif
339
340ifeq ($(ARCH),x86_64)
341LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
342endif
343
344ifeq ($(ARCH),ppc)
345LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
346endif
347
810260a8 348ifeq ($(ARCH),ppc64)
349LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
350endif
351
40293e58
FB
352ifeq ($(ARCH),s390)
353LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
354endif
355
356ifeq ($(ARCH),sparc)
357# -static is used to avoid g1/g3 usage by the dynamic linker
358LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
359endif
360
361ifeq ($(ARCH),sparc64)
362LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
363endif
364
365ifeq ($(ARCH),alpha)
366LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
367endif
368
369ifeq ($(ARCH),ia64)
370LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
371endif
372
373ifeq ($(ARCH),arm)
374LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
375endif
376
377ifeq ($(ARCH),m68k)
378LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
379endif
380
381ifeq ($(ARCH),mips)
382ifeq ($(WORDS_BIGENDIAN),yes)
383LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
384else
385LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
386endif
387endif
388
389ifeq ($(ARCH),mips64)
390ifeq ($(WORDS_BIGENDIAN),yes)
391LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
392else
393LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
394endif
395endif
396
17e2377a 397OBJS= main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \
40293e58
FB
398 elfload.o linuxload.o uaccess.o
399LIBS+= $(AIOLIBS)
400ifdef TARGET_HAS_BFLT
401OBJS+= flatload.o
402endif
403ifdef TARGET_HAS_ELFLOAD32
404OBJS+= elfload32.o
405elfload32.o: elfload.c
406endif
407
408ifeq ($(TARGET_ARCH), i386)
409OBJS+= vm86.o
410endif
411ifeq ($(TARGET_ARCH), arm)
412OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
413nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
414 nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o
415endif
416ifeq ($(TARGET_ARCH), m68k)
417OBJS+= m68k-sim.o m68k-semi.o
418endif
419
1fddef4b
FB
420ifdef CONFIG_GDBSTUB
421OBJS+=gdbstub.o
422endif
626df76a 423
40293e58
FB
424OBJS+= libqemu.a
425
426# Note: this is a workaround. The real fix is to avoid compiling
427# cpu_signal_handler() in cpu-exec.c.
428signal.o: signal.c
429 $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
626df76a 430
cec7d0b6 431$(QEMU_PROG): $(OBJS) ../libqemu_user.a
40293e58 432 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
626df76a
FB
433ifeq ($(ARCH),alpha)
434# Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
435# the address space (31 bit so sign extending doesn't matter)
436 echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
437endif
438
40293e58
FB
439endif #CONFIG_LINUX_USER
440
441#########################################################
442# Darwin user emulator target
443
444ifdef CONFIG_DARWIN_USER
445
446VPATH+=:$(SRC_PATH)/darwin-user
447CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
448
449# Leave some space for the regular program loading zone
450LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000
451
452LIBS+=-lmx
453
17e2377a 454OBJS= main.o commpage.o machload.o mmap.o signal.o syscall.o thunk.o
40293e58
FB
455
456OBJS+= libqemu.a
457
458ifdef CONFIG_GDBSTUB
459OBJS+=gdbstub.o
460endif
461
462# Note: this is a workaround. The real fix is to avoid compiling
463# cpu_signal_handler() in cpu-exec.c.
464signal.o: signal.c
465 $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
466
467$(QEMU_PROG): $(OBJS)
468 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
469
470endif #CONFIG_DARWIN_USER
471
472#########################################################
473# System emulator target
474ifndef CONFIG_USER_ONLY
475
48c64363 476OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o net-checksum.o
a76bab49 477OBJS+=fw_cfg.o aio.o
223d4670 478ifdef CONFIG_WIN32
40293e58 479OBJS+=block-raw-win32.o
223d4670 480else
a3392f9b
AL
481OBJS+=block-raw-posix.o
482endif
483
484ifdef CONFIG_AIO
485OBJS+=compatfd.o
223d4670 486endif
a541f297 487
40293e58 488LIBS+=-lz
1d14ffa9 489ifdef CONFIG_ALSA
1d14ffa9
FB
490LIBS += -lasound
491endif
ca9cc28c
AZ
492ifdef CONFIG_ESD
493LIBS += -lesd
494endif
b8e59f18 495ifdef CONFIG_PA
496LIBS += -lpulse-simple
497endif
1d14ffa9 498ifdef CONFIG_DSOUND
1d14ffa9 499LIBS += -lole32 -ldxguid
85571bc7 500endif
102a52e4 501ifdef CONFIG_FMOD
102a52e4 502LIBS += $(CONFIG_FMOD_LIB)
85571bc7 503endif
2f6a1ab0
BS
504ifdef CONFIG_OSS
505LIBS += $(CONFIG_OSS_LIB)
506endif
4fb240a4
FB
507
508SOUND_HW = sb16.o es1370.o
ca9cc28c
AZ
509ifdef CONFIG_AC97
510SOUND_HW += ac97.o
511endif
1d14ffa9
FB
512ifdef CONFIG_ADLIB
513SOUND_HW += fmopl.o adlib.o
514endif
423d65f4
AZ
515ifdef CONFIG_GUS
516SOUND_HW += gus.o gusemu_hal.o gusemu_mixer.o
517endif
cc53d26d 518ifdef CONFIG_CS4231A
519SOUND_HW += cs4231a.o
520endif
85571bc7 521
8d5d2d4c
TS
522ifdef CONFIG_VNC_TLS
523CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
524LIBS += $(CONFIG_VNC_TLS_LIBS)
525endif
526
fb599c9a
AZ
527ifdef CONFIG_BLUEZ
528LIBS += $(CONFIG_BLUEZ_LIBS)
529endif
530
2e5d83bb 531# SCSI layer
8b17de88 532OBJS+= lsi53c895a.o esp.o
2e5d83bb 533
a594cfbf 534# USB layer
40293e58 535OBJS+= usb-ohci.o
a594cfbf 536
663e8e51 537# EEPROM emulation
40293e58 538OBJS += eeprom93xx.o
663e8e51 539
a41b2ff2 540# PCI network cards
40293e58
FB
541OBJS += eepro100.o
542OBJS += ne2000.o
543OBJS += pcnet.o
544OBJS += rtl8139.o
7c23b892 545OBJS += e1000.o
a41b2ff2 546
0b0babc6 547ifeq ($(TARGET_BASE_ARCH), i386)
a541f297 548# Hardware support
40293e58
FB
549OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o
550OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
551OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o
552OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o
b00052e4 553CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
67b915a5 554endif
a2458627 555ifeq ($(TARGET_BASE_ARCH), ppc)
b00052e4 556CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
3cbee15b 557# shared objects
40293e58 558OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o
3cbee15b 559# PREP target
40293e58
FB
560OBJS+= pckbd.o ps2.o serial.o i8259.o i8254.o fdc.o m48t59.o mc146818rtc.o
561OBJS+= prep_pci.o ppc_prep.o
3cbee15b 562# Mac shared devices
40293e58 563OBJS+= macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o
3cbee15b 564# OldWorld PowerMac
40293e58 565OBJS+= heathrow_pic.o grackle_pci.o ppc_oldworld.o
3cbee15b 566# NewWorld PowerMac
40293e58 567OBJS+= unin_pci.o ppc_chrp.o
3cbee15b 568# PowerPC 4xx boards
40293e58 569OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc405_uc.o ppc405_boards.o
a541f297 570endif
fbe4f65b 571ifeq ($(TARGET_BASE_ARCH), mips)
c171148c 572OBJS+= mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o
4ce7ff6e
AJ
573OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o rc4030.o
574OBJS+= g364fb.o jazz_led.o
40293e58 575OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
4ce7ff6e 576OBJS+= piix_pci.o parallel.o cirrus_vga.o pcspk.o $(SOUND_HW)
40293e58
FB
577OBJS+= mipsnet.o
578OBJS+= pflash_cfi01.o
4ce7ff6e 579CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
6af0bf9c 580endif
e7daa605 581ifeq ($(TARGET_BASE_ARCH), cris)
40293e58 582OBJS+= etraxfs.o
48318011 583OBJS+= etraxfs_dma.o
e62b5b13 584OBJS+= etraxfs_pic.o
48318011 585OBJS+= etraxfs_eth.o
40293e58
FB
586OBJS+= etraxfs_timer.o
587OBJS+= etraxfs_ser.o
e62b5b13
EI
588
589OBJS+= ptimer.o
48318011 590OBJS+= pflash_cfi02.o
e7daa605 591endif
64b3ab24 592ifeq ($(TARGET_BASE_ARCH), sparc)
3475187d 593ifeq ($(TARGET_ARCH), sparc64)
40293e58
FB
594OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o
595OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o
596OBJS+= cirrus_vga.o parallel.o ptimer.o
3475187d 597else
40293e58 598OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o
8b17de88 599OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o sparc32_dma.o
40293e58 600OBJS+= cs4231.o ptimer.o eccmemctl.o sbi.o sun4c_intctl.o
3475187d 601endif
e95c8d51 602endif
b5ff1b31 603ifeq ($(TARGET_BASE_ARCH), arm)
40293e58
FB
604OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o
605OBJS+= arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
606OBJS+= versatile_pci.o ptimer.o
607OBJS+= realview_gic.o realview.o arm_sysctl.o mpcore.o
608OBJS+= armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
609OBJS+= pl061.o
610OBJS+= arm-semi.o
611OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
612OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
613OBJS+= pflash_cfi01.o gumstix.o
88d2c950 614OBJS+= zaurus.o ide.o serial.o nand.o ecc.o spitz.o tosa.o tc6393xb.o
b4e3104b 615OBJS+= omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o
afbb5194 616OBJS+= omap2.o omap_dss.o soc_dma.o
40293e58 617OBJS+= palm.o tsc210x.o
942ac052 618OBJS+= nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o
58a26b47 619OBJS+= tsc2005.o bt-hci-csr.o
40293e58 620OBJS+= mst_fpga.o mainstone.o
24859b68 621OBJS+= musicpal.o pflash_cfi02.o
5a1237c4 622CPPFLAGS += -DHAS_AUDIO
b5ff1b31 623endif
fdf9b3e8 624ifeq ($(TARGET_BASE_ARCH), sh4)
40293e58
FB
625OBJS+= shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
626OBJS+= sh_timer.o ptimer.o sh_serial.o sh_intc.o
fdf9b3e8 627endif
0633879f 628ifeq ($(TARGET_BASE_ARCH), m68k)
40293e58
FB
629OBJS+= an5206.o mcf5206.o ptimer.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
630OBJS+= m68k-semi.o dummy_m68k.o
0633879f 631endif
a541f297 632ifdef CONFIG_GDBSTUB
40293e58 633OBJS+=gdbstub.o
728c9fd5 634endif
5b0753e0 635ifdef CONFIG_COCOA
1d14ffa9
FB
636COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
637ifdef CONFIG_COREAUDIO
638COCOA_LIBS+=-framework CoreAudio
639endif
5b0753e0 640endif
7c1f25b4 641ifdef CONFIG_SLIRP
6f30fa85 642CPPFLAGS+=-I$(SRC_PATH)/slirp
626df76a
FB
643endif
644
40293e58 645LIBS+=$(AIOLIBS)
c321f673 646# specific flags are needed for non soft mmu emulator
c321f673 647ifdef CONFIG_STATIC
40293e58 648LDFLAGS+=-static
de5eaa64 649endif
83fb7adf 650ifndef CONFIG_DARWIN
11d9f695 651ifndef CONFIG_WIN32
ec530c81 652ifndef CONFIG_SOLARIS
40293e58 653LIBS+=-lutil
11d9f695 654endif
83fb7adf 655endif
ec530c81 656endif
e3086fbf 657ifdef TARGET_GPROF
40293e58
FB
658vl.o: CFLAGS+=-p
659LDFLAGS+=-p
e3086fbf 660endif
c321f673 661
b8076a74 662ifeq ($(ARCH),ia64)
40293e58 663LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
74ccb34e
FB
664endif
665
1d14ffa9
FB
666ifdef CONFIG_WIN32
667SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
668endif
669
40293e58
FB
670# profiling code
671ifdef TARGET_GPROF
672LDFLAGS+=-p
673main.o: CFLAGS+=-p
6e1b3e4d
FB
674endif
675
40293e58 676$(QEMU_PROG): $(OBJS) ../libqemu_common.a libqemu.a
8a16d273 677 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS)
626df76a 678
40293e58 679endif # !CONFIG_USER_ONLY
00a67ba1 680
626df76a 681%.o: %.c
40293e58 682 $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
626df76a 683
f72b519c 684%.o: %.S
6f30fa85 685 $(CC) $(CPPFLAGS) -c -o $@ $<
f72b519c 686
626df76a 687clean:
57fec1fe
FB
688 rm -f *.o *.a *~ $(PROGS) gen-op.h dyngen-opc.h op.h nwfpe/*.o fpu/*.o
689 rm -f *.d */*.d tcg/*.o
1e43adfc 690
5fafdf24 691install: all
9b14bb04 692ifneq ($(PROGS),)
6a882643 693 $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
9b14bb04 694endif
626df76a 695
2f96c28d
JM
696# Include automatically generated dependency files
697-include $(wildcard *.d */*.d)