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