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