]> git.proxmox.com Git - mirror_qemu.git/blame - Makefile.target
Split CPUID from op_helper
[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 420ifdef CONFIG_GDBSTUB
56aebc89 421OBJS+=gdbstub.o gdbstub-xml.o
1fddef4b 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
56aebc89 459OBJS+=gdbstub.o gdbstub-xml.o
40293e58
FB
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
84778508
BS
472#########################################################
473# BSD user emulator target
474
475ifdef CONFIG_BSD_USER
476
477VPATH+=:$(SRC_PATH)/bsd-user
478CPPFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
479
480ifdef CONFIG_STATIC
481LDFLAGS+=-static
482endif
483
484ifeq ($(ARCH),i386)
485ifdef TARGET_GPROF
486USE_I386_LD=y
487endif
488ifdef CONFIG_STATIC
489USE_I386_LD=y
490endif
491ifdef USE_I386_LD
492LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
493else
494# WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
495# that the kernel ELF loader considers as an executable. I think this
496# is the simplest way to make it self virtualizable!
497LDFLAGS+=-Wl,-shared
498endif
499endif
500
501ifeq ($(ARCH),x86_64)
502LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
503endif
504
505ifeq ($(ARCH),ppc)
506LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
507endif
508
509ifeq ($(ARCH),ppc64)
510LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
511endif
512
513ifeq ($(ARCH),s390)
514LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
515endif
516
517ifeq ($(ARCH),sparc)
518# -static is used to avoid g1/g3 usage by the dynamic linker
519LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
520endif
521
522ifeq ($(ARCH),sparc64)
523LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
524endif
525
526ifeq ($(ARCH),alpha)
527LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
528endif
529
530ifeq ($(ARCH),ia64)
531LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
532endif
533
534ifeq ($(ARCH),arm)
535LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
536endif
537
538ifeq ($(ARCH),m68k)
539LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
540endif
541
542ifeq ($(ARCH),mips)
543ifeq ($(WORDS_BIGENDIAN),yes)
544LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
545else
546LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
547endif
548endif
549
550ifeq ($(ARCH),mips64)
551ifeq ($(WORDS_BIGENDIAN),yes)
552LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
553else
554LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
555endif
556endif
557
558OBJS= main.o bsdload.o elfload.o mmap.o path.o signal.o strace.o syscall.o
559OBJS+= uaccess.o
560
561OBJS+= libqemu.a
562
563ifdef CONFIG_GDBSTUB
564OBJS+=gdbstub.o
565endif
566
567# Note: this is a workaround. The real fix is to avoid compiling
568# cpu_signal_handler() in cpu-exec.c.
569signal.o: signal.c
570 $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
571
572$(QEMU_PROG): $(OBJS) ../libqemu_user.a
573 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
574
575endif #CONFIG_BSD_USER
576
40293e58
FB
577#########################################################
578# System emulator target
579ifndef CONFIG_USER_ONLY
580
48c64363 581OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o net-checksum.o
6f97dba0 582OBJS+=fw_cfg.o aio.o buffered_file.o migration.o migration-tcp.o qemu-char.o
63a01ef8 583OBJS+=net.o
223d4670 584ifdef CONFIG_WIN32
40293e58 585OBJS+=block-raw-win32.o
223d4670 586else
a3392f9b
AL
587OBJS+=block-raw-posix.o
588endif
589
40293e58 590LIBS+=-lz
1d14ffa9 591ifdef CONFIG_ALSA
1d14ffa9
FB
592LIBS += -lasound
593endif
ca9cc28c
AZ
594ifdef CONFIG_ESD
595LIBS += -lesd
596endif
b8e59f18 597ifdef CONFIG_PA
598LIBS += -lpulse-simple
599endif
1d14ffa9 600ifdef CONFIG_DSOUND
1d14ffa9 601LIBS += -lole32 -ldxguid
85571bc7 602endif
102a52e4 603ifdef CONFIG_FMOD
102a52e4 604LIBS += $(CONFIG_FMOD_LIB)
85571bc7 605endif
2f6a1ab0
BS
606ifdef CONFIG_OSS
607LIBS += $(CONFIG_OSS_LIB)
608endif
4fb240a4
FB
609
610SOUND_HW = sb16.o es1370.o
ca9cc28c
AZ
611ifdef CONFIG_AC97
612SOUND_HW += ac97.o
613endif
1d14ffa9
FB
614ifdef CONFIG_ADLIB
615SOUND_HW += fmopl.o adlib.o
616endif
423d65f4
AZ
617ifdef CONFIG_GUS
618SOUND_HW += gus.o gusemu_hal.o gusemu_mixer.o
619endif
cc53d26d 620ifdef CONFIG_CS4231A
621SOUND_HW += cs4231a.o
622endif
85571bc7 623
8d5d2d4c
TS
624ifdef CONFIG_VNC_TLS
625CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
626LIBS += $(CONFIG_VNC_TLS_LIBS)
627endif
628
fb599c9a
AZ
629ifdef CONFIG_BLUEZ
630LIBS += $(CONFIG_BLUEZ_LIBS)
631endif
632
2e5d83bb 633# SCSI layer
8b17de88 634OBJS+= lsi53c895a.o esp.o
2e5d83bb 635
a594cfbf 636# USB layer
40293e58 637OBJS+= usb-ohci.o
a594cfbf 638
663e8e51 639# EEPROM emulation
40293e58 640OBJS += eeprom93xx.o
663e8e51 641
a41b2ff2 642# PCI network cards
40293e58
FB
643OBJS += eepro100.o
644OBJS += ne2000.o
645OBJS += pcnet.o
646OBJS += rtl8139.o
7c23b892 647OBJS += e1000.o
a41b2ff2 648
0b0babc6 649ifeq ($(TARGET_BASE_ARCH), i386)
a541f297 650# Hardware support
40293e58
FB
651OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o
652OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
653OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o
654OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o
b00052e4 655CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
67b915a5 656endif
a2458627 657ifeq ($(TARGET_BASE_ARCH), ppc)
b00052e4 658CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
3cbee15b 659# shared objects
40293e58 660OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o
3cbee15b 661# PREP target
40293e58
FB
662OBJS+= pckbd.o ps2.o serial.o i8259.o i8254.o fdc.o m48t59.o mc146818rtc.o
663OBJS+= prep_pci.o ppc_prep.o
3cbee15b 664# Mac shared devices
40293e58 665OBJS+= macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o
3cbee15b 666# OldWorld PowerMac
40293e58 667OBJS+= heathrow_pic.o grackle_pci.o ppc_oldworld.o
3cbee15b 668# NewWorld PowerMac
40293e58 669OBJS+= unin_pci.o ppc_chrp.o
3cbee15b 670# PowerPC 4xx boards
40293e58 671OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc405_uc.o ppc405_boards.o
a541f297 672endif
fbe4f65b 673ifeq ($(TARGET_BASE_ARCH), mips)
c171148c 674OBJS+= mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o
4ce7ff6e
AJ
675OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o rc4030.o
676OBJS+= g364fb.o jazz_led.o
40293e58 677OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
4ce7ff6e 678OBJS+= piix_pci.o parallel.o cirrus_vga.o pcspk.o $(SOUND_HW)
40293e58
FB
679OBJS+= mipsnet.o
680OBJS+= pflash_cfi01.o
4ce7ff6e 681CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
6af0bf9c 682endif
e7daa605 683ifeq ($(TARGET_BASE_ARCH), cris)
40293e58 684OBJS+= etraxfs.o
48318011 685OBJS+= etraxfs_dma.o
e62b5b13 686OBJS+= etraxfs_pic.o
48318011 687OBJS+= etraxfs_eth.o
40293e58
FB
688OBJS+= etraxfs_timer.o
689OBJS+= etraxfs_ser.o
e62b5b13
EI
690
691OBJS+= ptimer.o
48318011 692OBJS+= pflash_cfi02.o
e7daa605 693endif
64b3ab24 694ifeq ($(TARGET_BASE_ARCH), sparc)
3475187d 695ifeq ($(TARGET_ARCH), sparc64)
40293e58
FB
696OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o
697OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o
698OBJS+= cirrus_vga.o parallel.o ptimer.o
3475187d 699else
40293e58 700OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o
8b17de88 701OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o sparc32_dma.o
40293e58 702OBJS+= cs4231.o ptimer.o eccmemctl.o sbi.o sun4c_intctl.o
3475187d 703endif
e95c8d51 704endif
b5ff1b31 705ifeq ($(TARGET_BASE_ARCH), arm)
40293e58
FB
706OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o
707OBJS+= arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
708OBJS+= versatile_pci.o ptimer.o
709OBJS+= realview_gic.o realview.o arm_sysctl.o mpcore.o
710OBJS+= armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
711OBJS+= pl061.o
712OBJS+= arm-semi.o
713OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
714OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
715OBJS+= pflash_cfi01.o gumstix.o
88d2c950 716OBJS+= zaurus.o ide.o serial.o nand.o ecc.o spitz.o tosa.o tc6393xb.o
b4e3104b 717OBJS+= omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o
afbb5194 718OBJS+= omap2.o omap_dss.o soc_dma.o
40293e58 719OBJS+= palm.o tsc210x.o
942ac052 720OBJS+= nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o
58a26b47 721OBJS+= tsc2005.o bt-hci-csr.o
40293e58 722OBJS+= mst_fpga.o mainstone.o
24859b68 723OBJS+= musicpal.o pflash_cfi02.o
5a1237c4 724CPPFLAGS += -DHAS_AUDIO
b5ff1b31 725endif
fdf9b3e8 726ifeq ($(TARGET_BASE_ARCH), sh4)
40293e58
FB
727OBJS+= shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
728OBJS+= sh_timer.o ptimer.o sh_serial.o sh_intc.o
fdf9b3e8 729endif
0633879f 730ifeq ($(TARGET_BASE_ARCH), m68k)
40293e58
FB
731OBJS+= an5206.o mcf5206.o ptimer.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
732OBJS+= m68k-semi.o dummy_m68k.o
0633879f 733endif
a541f297 734ifdef CONFIG_GDBSTUB
56aebc89 735OBJS+=gdbstub.o gdbstub-xml.o
728c9fd5 736endif
5b0753e0 737ifdef CONFIG_COCOA
1d14ffa9
FB
738COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
739ifdef CONFIG_COREAUDIO
740COCOA_LIBS+=-framework CoreAudio
741endif
5b0753e0 742endif
7c1f25b4 743ifdef CONFIG_SLIRP
6f30fa85 744CPPFLAGS+=-I$(SRC_PATH)/slirp
626df76a
FB
745endif
746
40293e58 747LIBS+=$(AIOLIBS)
c321f673 748# specific flags are needed for non soft mmu emulator
c321f673 749ifdef CONFIG_STATIC
40293e58 750LDFLAGS+=-static
de5eaa64 751endif
83fb7adf 752ifndef CONFIG_DARWIN
11d9f695 753ifndef CONFIG_WIN32
ec530c81 754ifndef CONFIG_SOLARIS
40293e58 755LIBS+=-lutil
11d9f695 756endif
83fb7adf 757endif
ec530c81 758endif
e3086fbf 759ifdef TARGET_GPROF
40293e58
FB
760vl.o: CFLAGS+=-p
761LDFLAGS+=-p
e3086fbf 762endif
c321f673 763
b8076a74 764ifeq ($(ARCH),ia64)
40293e58 765LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
74ccb34e
FB
766endif
767
1d14ffa9
FB
768ifdef CONFIG_WIN32
769SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
770endif
771
40293e58
FB
772# profiling code
773ifdef TARGET_GPROF
774LDFLAGS+=-p
775main.o: CFLAGS+=-p
6e1b3e4d
FB
776endif
777
40293e58 778$(QEMU_PROG): $(OBJS) ../libqemu_common.a libqemu.a
8a16d273 779 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS)
626df76a 780
40293e58 781endif # !CONFIG_USER_ONLY
00a67ba1 782
56aebc89
PB
783gdbstub-xml.c: $(TARGET_XML_FILES) feature_to_c.sh
784 rm -f $@
785ifeq ($(TARGET_XML_FILES),)
786 echo > $@
787else
788 $(SHELL) $(SRC_PATH)/feature_to_c.sh $@ $(TARGET_XML_FILES)
789endif
790
626df76a 791%.o: %.c
40293e58 792 $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
626df76a 793
f72b519c 794%.o: %.S
6f30fa85 795 $(CC) $(CPPFLAGS) -c -o $@ $<
f72b519c 796
626df76a 797clean:
57fec1fe
FB
798 rm -f *.o *.a *~ $(PROGS) gen-op.h dyngen-opc.h op.h nwfpe/*.o fpu/*.o
799 rm -f *.d */*.d tcg/*.o
1e43adfc 800
5fafdf24 801install: all
9b14bb04 802ifneq ($(PROGS),)
6a882643 803 $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
9b14bb04 804endif
626df76a 805
2f96c28d
JM
806# Include automatically generated dependency files
807-include $(wildcard *.d */*.d)