blob: d80ce2cd3710f96e53a6f4ed47c166638ff77f8d [file] [log] [blame]
bellard626df762003-08-10 21:39:31 +00001include config.mak
2
bellard0b0babc2005-01-03 23:38:40 +00003TARGET_BASE_ARCH:=$(TARGET_ARCH)
4ifeq ($(TARGET_ARCH), x86_64)
5TARGET_BASE_ARCH:=i386
6endif
ths540635b2007-09-30 01:58:33 +00007ifeq ($(TARGET_ARCH), mipsn32)
8TARGET_BASE_ARCH:=mips
9endif
thsfbe4f652007-04-01 11:16:48 +000010ifeq ($(TARGET_ARCH), mips64)
11TARGET_BASE_ARCH:=mips
12endif
bellarda2458622005-07-23 22:39:53 +000013ifeq ($(TARGET_ARCH), ppc64)
14TARGET_BASE_ARCH:=ppc
15endif
j_mayer22f8a8b2007-10-14 08:38:29 +000016ifeq ($(TARGET_ARCH), ppc64h)
17TARGET_BASE_ARCH:=ppc
18endif
j_mayerd4082e92007-04-24 07:34:03 +000019ifeq ($(TARGET_ARCH), ppcemb)
20TARGET_BASE_ARCH:=ppc
21endif
bellard64b3ab22005-01-30 22:43:42 +000022ifeq ($(TARGET_ARCH), sparc64)
23TARGET_BASE_ARCH:=sparc
24endif
bellard0b0babc2005-01-03 23:38:40 +000025TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
bellard4fb240a2007-11-07 19:24:02 +000026VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw
balrog46dc3882008-06-02 02:09:09 +000027CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MT $@ -MP -DNEED_CPU_H
bellard0b0babc2005-01-03 23:38:40 +000028#CFLAGS+=-Werror
bellard626df762003-08-10 21:39:31 +000029LIBS=
bellard1e43adf2003-09-30 20:54:24 +000030# user emulator name
bellard0c64b9c2008-01-06 18:27:58 +000031ifndef TARGET_ARCH2
bellardc91fde62006-05-02 22:52:36 +000032TARGET_ARCH2=$(TARGET_ARCH)
bellard0c64b9c2008-01-06 18:27:58 +000033endif
bellard808c4952004-12-19 23:33:47 +000034ifeq ($(TARGET_ARCH),arm)
35 ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
bellardc91fde62006-05-02 22:52:36 +000036 TARGET_ARCH2=armeb
bellard808c4952004-12-19 23:33:47 +000037 endif
bellardc91fde62006-05-02 22:52:36 +000038endif
pbrook908f52b2006-06-18 19:16:53 +000039ifeq ($(TARGET_ARCH),sh4)
40 ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
41 TARGET_ARCH2=sh4eb
42 endif
43endif
bellard01f5e592005-12-06 21:42:17 +000044ifeq ($(TARGET_ARCH),mips)
bellardc91fde62006-05-02 22:52:36 +000045 ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
46 TARGET_ARCH2=mipsel
bellard01f5e592005-12-06 21:42:17 +000047 endif
bellard808c4952004-12-19 23:33:47 +000048endif
ths540635b2007-09-30 01:58:33 +000049ifeq ($(TARGET_ARCH),mipsn32)
50 ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
51 TARGET_ARCH2=mipsn32el
52 endif
53endif
thsfbe4f652007-04-01 11:16:48 +000054ifeq ($(TARGET_ARCH),mips64)
55 ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
56 TARGET_ARCH2=mips64el
57 endif
58endif
bellard1e43adf2003-09-30 20:54:24 +000059
bellard16e9b7d2003-10-27 21:09:52 +000060ifdef CONFIG_USER_ONLY
bellard40293e52008-01-31 11:32:10 +000061# user emulator name
62QEMU_PROG=qemu-$(TARGET_ARCH2)
bellard16e9b7d2003-10-27 21:09:52 +000063else
bellard40293e52008-01-31 11:32:10 +000064# system emulator name
65ifeq ($(TARGET_ARCH), i386)
66QEMU_PROG=qemu$(EXESUF)
67else
68QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF)
bellardde5eaa62003-11-16 23:18:17 +000069endif
bellard40293e52008-01-31 11:32:10 +000070endif
bellard728c9fd2004-01-05 00:08:14 +000071
bellard40293e52008-01-31 11:32:10 +000072PROGS=$(QEMU_PROG)
bellard626df762003-08-10 21:39:31 +000073
ths6f30fa82007-01-05 01:00:47 +000074# We require -O2 to avoid the stack setup prologue in EXIT_TB
blueswir1ac41a622008-09-14 06:46:31 +000075OP_CFLAGS := -O2 -g -fno-strict-aliasing
blueswir1e0e36fe2008-12-07 19:16:27 +000076OP_CFLAGS += -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls
ths6c041c52007-03-18 23:23:31 +000077
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, ""))
ths1870a742007-09-13 03:24:53 +000092OP_CFLAGS+=$(call cc-option, -fno-section-anchors, "")
ths6f30fa82007-01-05 01:00:47 +000093
bellard40293e52008-01-31 11:32:10 +000094HELPER_CFLAGS=
95
bellard626df762003-08-10 21:39:31 +000096ifeq ($(ARCH),i386)
ths6f30fa82007-01-05 01:00:47 +000097HELPER_CFLAGS+=-fomit-frame-pointer
98OP_CFLAGS+=-mpreferred-stack-boundary=2 -fomit-frame-pointer
bellardbc51c5c2004-03-17 23:46:04 +000099endif
100
bellard626df762003-08-10 21:39:31 +0000101ifeq ($(ARCH),ppc)
ths6f30fa82007-01-05 01:00:47 +0000102CPPFLAGS+= -D__powerpc__
malc176a4f22008-06-09 06:06:30 +0000103OP_CFLAGS+= -mlongcall
bellard626df762003-08-10 21:39:31 +0000104endif
105
106ifeq ($(ARCH),sparc)
bellard40293e52008-01-31 11:32:10 +0000107 CFLAGS+=-ffixed-g2 -ffixed-g3
blueswir131422552007-04-16 18:27:06 +0000108 OP_CFLAGS+=-fno-delayed-branch -ffixed-i0
109 ifeq ($(CONFIG_SOLARIS),yes)
110 OP_CFLAGS+=-fno-omit-frame-pointer
111 else
bellard40293e52008-01-31 11:32:10 +0000112 CFLAGS+=-ffixed-g1 -ffixed-g6
113 HELPER_CFLAGS+=-ffixed-i0
blueswir131422552007-04-16 18:27:06 +0000114 endif
bellardfdbb4692006-06-14 17:32:25 +0000115endif
bellard626df762003-08-10 21:39:31 +0000116
117ifeq ($(ARCH),sparc64)
blueswir131422552007-04-16 18:27:06 +0000118 OP_CFLAGS+=-mcpu=ultrasparc -m64 -fno-delayed-branch -ffixed-i0
119 ifneq ($(CONFIG_SOLARIS),yes)
blueswir1e97b6402008-07-26 17:19:35 +0000120 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
blueswir131422552007-04-16 18:27:06 +0000124 endif
bellard626df762003-08-10 21:39:31 +0000125endif
126
127ifeq ($(ARCH),alpha)
ths6f30fa82007-01-05 01:00:47 +0000128# -msmall-data is not used for OP_CFLAGS because we want two-instruction
129# relocations for the constant constructions
bellard626df762003-08-10 21:39:31 +0000130# Ensure there's only a single GP
bellard40293e52008-01-31 11:32:10 +0000131CFLAGS+=-msmall-data
bellard626df762003-08-10 21:39:31 +0000132endif
133
aurel32f54b3f92008-04-12 20:14:54 +0000134ifeq ($(ARCH),hppa)
135OP_CFLAGS=-O1 -fno-delayed-branch
136BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
137endif
138
bellard626df762003-08-10 21:39:31 +0000139ifeq ($(ARCH),ia64)
bellard40293e52008-01-31 11:32:10 +0000140CFLAGS+=-mno-sdata
ths6f30fa82007-01-05 01:00:47 +0000141OP_CFLAGS+=-mno-sdata
bellard626df762003-08-10 21:39:31 +0000142endif
143
144ifeq ($(ARCH),arm)
ths6f30fa82007-01-05 01:00:47 +0000145OP_CFLAGS+=-mno-sched-prolog -fno-omit-frame-pointer
bellard626df762003-08-10 21:39:31 +0000146endif
147
bellard38e584a2003-08-10 22:14:22 +0000148ifeq ($(ARCH),m68k)
ths6f30fa82007-01-05 01:00:47 +0000149OP_CFLAGS+=-fomit-frame-pointer
ths6f30fa82007-01-05 01:00:47 +0000150endif
151
152ifeq ($(ARCH),mips)
ths9617efe2007-05-08 21:05:55 +0000153OP_CFLAGS+=-mabi=32 -G0 -fno-PIC -mno-abicalls -fomit-frame-pointer -fno-delayed-branch -Wa,-O0
thsfbe4f652007-04-01 11:16:48 +0000154endif
155
156ifeq ($(ARCH),mips64)
ths9617efe2007-05-08 21:05:55 +0000157OP_CFLAGS+=-mabi=n32 -G0 -fno-PIC -mno-abicalls -fomit-frame-pointer -fno-delayed-branch -Wa,-O0
bellard38e584a2003-08-10 22:14:22 +0000158endif
159
bellard40293e52008-01-31 11:32:10 +0000160CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
161LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS)
blueswir131422552007-04-16 18:27:06 +0000162OP_CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
bellard626df762003-08-10 21:39:31 +0000163
ths6f30fa82007-01-05 01:00:47 +0000164CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
bellard626df762003-08-10 21:39:31 +0000165LIBS+=-lm
bellard67b915a2004-03-31 23:37:16 +0000166ifdef CONFIG_WIN32
bellard3db38e82004-07-14 17:19:55 +0000167LIBS+=-lwinmm -lws2_32 -liphlpapi
bellard67b915a2004-03-31 23:37:16 +0000168endif
bellardec530c82006-04-25 22:36:06 +0000169ifdef CONFIG_SOLARIS
170LIBS+=-lsocket -lnsl -lresolv
ths0475a5c2007-04-01 18:54:44 +0000171ifdef NEEDS_LIBSUNMATH
172LIBS+=-lsunmath
173LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib
174OP_CFLAGS+=-I/opt/SUNWspro/prod/include/cc
bellard40293e52008-01-31 11:32:10 +0000175CFLAGS+=-I/opt/SUNWspro/prod/include/cc
ths0475a5c2007-04-01 18:54:44 +0000176endif
bellardec530c82006-04-25 22:36:06 +0000177endif
bellard626df762003-08-10 21:39:31 +0000178
aliguori7ba1e612008-11-05 16:04:33 +0000179kvm.o: CFLAGS+=$(KVM_CFLAGS)
180kvm-all.o: CFLAGS+=$(KVM_CFLAGS)
181
bellard40293e52008-01-31 11:32:10 +0000182all: $(PROGS)
bellard626df762003-08-10 21:39:31 +0000183
bellard40293e52008-01-31 11:32:10 +0000184#########################################################
bellard626df762003-08-10 21:39:31 +0000185# cpu emulator library
bellard57fec1f2008-02-01 10:50:11 +0000186LIBOBJS=exec.o kqemu.o translate-all.o cpu-exec.o\
blueswir1cf2be982008-03-21 18:03:09 +0000187 translate.o host-utils.o
bellard57fec1f2008-02-01 10:50:11 +0000188# TCG code generator
aurel3249516bc2008-12-07 18:15:45 +0000189LIBOBJS+= tcg/tcg.o tcg/tcg-runtime.o
bellard57fec1f2008-02-01 10:50:11 +0000190CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH)
blueswir18289b272008-02-27 17:53:27 +0000191ifeq ($(ARCH),sparc64)
192CPPFLAGS+=-I$(SRC_PATH)/tcg/sparc
193endif
bellard158142c2005-03-13 16:54:06 +0000194ifdef CONFIG_SOFTFLOAT
195LIBOBJS+=fpu/softfloat.o
196else
197LIBOBJS+=fpu/softfloat-native.o
198endif
ths6f30fa82007-01-05 01:00:47 +0000199CPPFLAGS+=-I$(SRC_PATH)/fpu
bellard728c9fd2004-01-05 00:08:14 +0000200LIBOBJS+= op_helper.o helper.o
bellarde95c8d52004-09-30 22:22:08 +0000201
bellardb7bcbe92005-02-22 19:27:29 +0000202ifeq ($(TARGET_BASE_ARCH), arm)
bellardeaa728e2008-05-28 12:51:20 +0000203LIBOBJS+= neon_helper.o iwmmxt_helper.o
pbrooke6e59062006-10-22 00:18:54 +0000204endif
205
j_mayercf6c1b12007-04-05 20:46:02 +0000206ifeq ($(TARGET_BASE_ARCH), alpha)
bellardeaa728e2008-05-28 12:51:20 +0000207LIBOBJS+= alpha_palcode.o
j_mayercf6c1b12007-04-05 20:46:02 +0000208endif
209
thse7daa602007-10-08 13:38:27 +0000210ifeq ($(TARGET_BASE_ARCH), cris)
thse7daa602007-10-08 13:38:27 +0000211LIBOBJS+= cris-dis.o
212
213ifndef CONFIG_USER_ONLY
214LIBOBJS+= mmu.o
215endif
216endif
217
bellard626df762003-08-10 21:39:31 +0000218# NOTE: the disassembler code is only needed for debugging
ths5fafdf22007-09-16 21:08:06 +0000219LIBOBJS+=disas.o
bellard626df762003-08-10 21:39:31 +0000220ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
bellardbc51c5c2004-03-17 23:46:04 +0000221USE_I386_DIS=y
222endif
bellard0b0babc2005-01-03 23:38:40 +0000223ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
bellardbc51c5c2004-03-17 23:46:04 +0000224USE_I386_DIS=y
225endif
226ifdef USE_I386_DIS
bellard626df762003-08-10 21:39:31 +0000227LIBOBJS+=i386-dis.o
228endif
229ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
230LIBOBJS+=alpha-dis.o
231endif
bellarda2458622005-07-23 22:39:53 +0000232ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
bellard626df762003-08-10 21:39:31 +0000233LIBOBJS+=ppc-dis.o
234endif
thsfbe4f652007-04-01 11:16:48 +0000235ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips)
bellard6af0bf92005-07-02 14:58:51 +0000236LIBOBJS+=mips-dis.o
237endif
bellard64b3ab22005-01-30 22:43:42 +0000238ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
bellard626df762003-08-10 21:39:31 +0000239LIBOBJS+=sparc-dis.o
240endif
241ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
242LIBOBJS+=arm-dis.o
243endif
bellard48024e42005-11-06 16:52:11 +0000244ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
245LIBOBJS+=m68k-dis.o
246endif
bellardfdf9b3e2006-04-27 21:07:38 +0000247ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
248LIBOBJS+=sh4-dis.o
249endif
aurel32f54b3f92008-04-12 20:14:54 +0000250ifeq ($(findstring hppa, $(TARGET_BASE_ARCH) $(ARCH)),hppa)
251LIBOBJS+=hppa-dis.o
252endif
ths8f860bb2007-07-31 23:44:21 +0000253ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390)
254LIBOBJS+=s390-dis.o
255endif
bellard626df762003-08-10 21:39:31 +0000256
bellard40293e52008-01-31 11:32:10 +0000257# libqemu
258
259libqemu.a: $(LIBOBJS)
260 rm -f $@
261 $(AR) rcs $@ $(LIBOBJS)
262
aurel3286e840e2008-12-07 15:21:23 +0000263translate.o: translate.c cpu.h
bellard40293e52008-01-31 11:32:10 +0000264
aurel3286e840e2008-12-07 15:21:23 +0000265translate-all.o: translate-all.c cpu.h
bellard40293e52008-01-31 11:32:10 +0000266
aurel3286e840e2008-12-07 15:21:23 +0000267tcg/tcg.o: cpu.h
bellard40293e52008-01-31 11:32:10 +0000268
aurel328dd3dca2008-05-04 13:11:44 +0000269machine.o: machine.c
270 $(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $<
271
bellard40293e52008-01-31 11:32:10 +0000272# HELPER_CFLAGS is used for all the code compiled with static register
273# variables
bellard40293e52008-01-31 11:32:10 +0000274op_helper.o: op_helper.c
bellardeaa728e2008-05-28 12:51:20 +0000275 $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) $(I386_CFLAGS) -c -o $@ $<
bellard40293e52008-01-31 11:32:10 +0000276
aurel3286e840e2008-12-07 15:21:23 +0000277cpu-exec.o: cpu-exec.c
bellard40293e52008-01-31 11:32:10 +0000278 $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
279
280#########################################################
281# Linux user emulator target
282
283ifdef CONFIG_LINUX_USER
284
bellard40293e52008-01-31 11:32:10 +0000285ifndef TARGET_ABI_DIR
286 TARGET_ABI_DIR=$(TARGET_ARCH)
287endif
aurel323ebdd112008-04-09 06:53:01 +0000288VPATH+=:$(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
bellard40293e52008-01-31 11:32:10 +0000289CPPFLAGS+=-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
malc810260a2008-07-23 19:17:46 +0000320ifeq ($(ARCH),ppc64)
321LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
322endif
323
bellard40293e52008-01-31 11:32:10 +0000324ifeq ($(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
aurel326d946cd2008-11-06 16:15:18 +0000369# profiling code
370ifdef TARGET_GPROF
371LDFLAGS+=-p
372CFLAGS+=-p
373endif
374
pbrook17e23772008-06-09 13:47:45 +0000375OBJS= main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \
bellard40293e52008-01-31 11:32:10 +0000376 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
bellard1fddef42005-04-17 19:16:13 +0000398ifdef CONFIG_GDBSTUB
pbrook56aebc82008-10-11 17:55:29 +0000399OBJS+=gdbstub.o gdbstub-xml.o
bellard1fddef42005-04-17 19:16:13 +0000400endif
bellard626df762003-08-10 21:39:31 +0000401
bellard40293e52008-01-31 11:32:10 +0000402OBJS+= libqemu.a
bellard626df762003-08-10 21:39:31 +0000403
bellard40293e52008-01-31 11:32:10 +0000404# 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 $@ $<
408
pbrookcec7d0b2008-05-28 16:44:57 +0000409$(QEMU_PROG): $(OBJS) ../libqemu_user.a
bellard40293e52008-01-31 11:32:10 +0000410 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
bellard626df762003-08-10 21:39:31 +0000411ifeq ($(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
bellard40293e52008-01-31 11:32:10 +0000417endif #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
pbrook17e23772008-06-09 13:47:45 +0000432OBJS= main.o commpage.o machload.o mmap.o signal.o syscall.o thunk.o
bellard40293e52008-01-31 11:32:10 +0000433
434OBJS+= libqemu.a
435
436ifdef CONFIG_GDBSTUB
pbrook56aebc82008-10-11 17:55:29 +0000437OBJS+=gdbstub.o gdbstub-xml.o
ths223d4672007-12-15 17:28:36 +0000438endif
bellarda541f292004-04-12 20:39:29 +0000439
bellard40293e52008-01-31 11:32:10 +0000440# 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
450#########################################################
blueswir184778502008-10-26 20:33:16 +0000451# 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
555#########################################################
bellard40293e52008-01-31 11:32:10 +0000556# System emulator target
557ifndef CONFIG_USER_ONLY
558
aliguori559b90f2008-11-11 21:20:14 +0000559OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o
560OBJS+=fw_cfg.o
aliguori7ba1e612008-11-05 16:04:33 +0000561ifdef CONFIG_KVM
562OBJS+=kvm.o kvm-all.o
563endif
bellard40293e52008-01-31 11:32:10 +0000564ifdef CONFIG_WIN32
565OBJS+=block-raw-win32.o
566else
aliguori3c529d92008-12-12 16:41:40 +0000567ifdef CONFIG_AIO
568OBJS+=posix-aio-compat.o
569endif
aliguori559b90f2008-11-11 21:20:14 +0000570OBJS+=block-raw-posix.o
aliguoria3392f92008-09-11 18:00:19 +0000571endif
572
bellard40293e52008-01-31 11:32:10 +0000573LIBS+=-lz
bellard1d14ffa2005-10-30 18:58:22 +0000574ifdef CONFIG_ALSA
bellard1d14ffa2005-10-30 18:58:22 +0000575LIBS += -lasound
576endif
balrogca9cc282008-01-14 04:24:29 +0000577ifdef CONFIG_ESD
578LIBS += -lesd
579endif
malcb8e59f12008-07-02 21:03:08 +0000580ifdef CONFIG_PA
581LIBS += -lpulse-simple
582endif
bellard1d14ffa2005-10-30 18:58:22 +0000583ifdef CONFIG_DSOUND
bellard1d14ffa2005-10-30 18:58:22 +0000584LIBS += -lole32 -ldxguid
585endif
bellard102a52e2004-11-14 19:57:29 +0000586ifdef CONFIG_FMOD
bellard102a52e2004-11-14 19:57:29 +0000587LIBS += $(CONFIG_FMOD_LIB)
bellard85571bc2004-11-07 18:04:02 +0000588endif
blueswir12f6a1ab2008-08-21 18:00:53 +0000589ifdef CONFIG_OSS
590LIBS += $(CONFIG_OSS_LIB)
591endif
bellard4fb240a2007-11-07 19:24:02 +0000592
593SOUND_HW = sb16.o es1370.o
balrogca9cc282008-01-14 04:24:29 +0000594ifdef CONFIG_AC97
595SOUND_HW += ac97.o
596endif
bellard1d14ffa2005-10-30 18:58:22 +0000597ifdef CONFIG_ADLIB
598SOUND_HW += fmopl.o adlib.o
malcc40e8662008-12-11 00:14:25 +0000599adlib.o fmopl.o: CFLAGS := ${CFLAGS} -DBUILD_Y8950=0
bellard1d14ffa2005-10-30 18:58:22 +0000600endif
balrog423d65f2008-01-14 22:09:11 +0000601ifdef CONFIG_GUS
602SOUND_HW += gus.o gusemu_hal.o gusemu_mixer.o
603endif
malccc53d262008-06-13 10:48:22 +0000604ifdef CONFIG_CS4231A
605SOUND_HW += cs4231a.o
606endif
bellard85571bc2004-11-07 18:04:02 +0000607
ths8d5d2d42007-08-25 01:37:51 +0000608ifdef CONFIG_VNC_TLS
609CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
610LIBS += $(CONFIG_VNC_TLS_LIBS)
611endif
612
balrogfb599c92008-09-28 23:49:55 +0000613ifdef CONFIG_BLUEZ
614LIBS += $(CONFIG_BLUEZ_LIBS)
615endif
616
pbrook2e5d83b2006-05-25 23:58:51 +0000617# SCSI layer
blueswir18b17de82008-03-02 08:48:47 +0000618OBJS+= lsi53c895a.o esp.o
pbrook2e5d83b2006-05-25 23:58:51 +0000619
bellarda594cfb2005-11-06 16:13:29 +0000620# USB layer
bellard40293e52008-01-31 11:32:10 +0000621OBJS+= usb-ohci.o
bellarda594cfb2005-11-06 16:13:29 +0000622
ths663e8e52007-04-02 12:35:34 +0000623# EEPROM emulation
bellard40293e52008-01-31 11:32:10 +0000624OBJS += eeprom93xx.o
ths663e8e52007-04-02 12:35:34 +0000625
pbrooka41b2ff2006-02-05 04:14:41 +0000626# PCI network cards
bellard40293e52008-01-31 11:32:10 +0000627OBJS += eepro100.o
628OBJS += ne2000.o
629OBJS += pcnet.o
630OBJS += rtl8139.o
balrog7c23b892008-02-03 02:20:18 +0000631OBJS += e1000.o
pbrooka41b2ff2006-02-05 04:14:41 +0000632
bellard0b0babc2005-01-03 23:38:40 +0000633ifeq ($(TARGET_BASE_ARCH), i386)
bellarda541f292004-04-12 20:39:29 +0000634# Hardware support
bellard40293e52008-01-31 11:32:10 +0000635OBJS+= 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
aliguori967f97f2008-12-04 19:38:57 +0000639# virtio support
aliguoribd322082008-12-04 20:33:06 +0000640OBJS+= virtio.o virtio-blk.o virtio-balloon.o
balrogb00052e2007-04-30 02:22:06 +0000641CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
bellard67b915a2004-03-31 23:37:16 +0000642endif
bellarda2458622005-07-23 22:39:53 +0000643ifeq ($(TARGET_BASE_ARCH), ppc)
aurel3270ad3de2008-12-14 17:30:18 +0000644CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
j_mayer3cbee152007-10-28 23:42:18 +0000645# shared objects
bellard40293e52008-01-31 11:32:10 +0000646OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o
j_mayer3cbee152007-10-28 23:42:18 +0000647# PREP target
bellard40293e52008-01-31 11:32:10 +0000648OBJS+= pckbd.o ps2.o serial.o i8259.o i8254.o fdc.o m48t59.o mc146818rtc.o
649OBJS+= prep_pci.o ppc_prep.o
j_mayer3cbee152007-10-28 23:42:18 +0000650# Mac shared devices
bellard40293e52008-01-31 11:32:10 +0000651OBJS+= macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o
j_mayer3cbee152007-10-28 23:42:18 +0000652# OldWorld PowerMac
bellard40293e52008-01-31 11:32:10 +0000653OBJS+= heathrow_pic.o grackle_pci.o ppc_oldworld.o
j_mayer3cbee152007-10-28 23:42:18 +0000654# NewWorld PowerMac
bellard40293e52008-01-31 11:32:10 +0000655OBJS+= unin_pci.o ppc_chrp.o
j_mayer3cbee152007-10-28 23:42:18 +0000656# PowerPC 4xx boards
aurel32825bb582008-12-02 23:53:50 +0000657OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o
aurel32f652e6a2008-12-16 10:43:48 +0000658ifdef FDT_LIBS
659OBJS+= device_tree.o
660LIBS+= $(FDT_LIBS)
661endif
aliguori967f97f2008-12-04 19:38:57 +0000662# virtio support
aliguoribd322082008-12-04 20:33:06 +0000663OBJS+= virtio.o virtio-blk.o virtio-balloon.o
bellarda541f292004-04-12 20:39:29 +0000664endif
thsfbe4f652007-04-01 11:16:48 +0000665ifeq ($(TARGET_BASE_ARCH), mips)
aurel32c1711482008-04-08 19:51:06 +0000666OBJS+= mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o
aurel324ce7ff62008-04-07 19:47:14 +0000667OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o rc4030.o
668OBJS+= g364fb.o jazz_led.o
bellard40293e52008-01-31 11:32:10 +0000669OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
aurel324ce7ff62008-04-07 19:47:14 +0000670OBJS+= piix_pci.o parallel.o cirrus_vga.o pcspk.o $(SOUND_HW)
bellard40293e52008-01-31 11:32:10 +0000671OBJS+= mipsnet.o
672OBJS+= pflash_cfi01.o
aurel324ce7ff62008-04-07 19:47:14 +0000673CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
bellard6af0bf92005-07-02 14:58:51 +0000674endif
thse7daa602007-10-08 13:38:27 +0000675ifeq ($(TARGET_BASE_ARCH), cris)
bellard40293e52008-01-31 11:32:10 +0000676OBJS+= etraxfs.o
edgar_igl48318012008-05-11 15:07:19 +0000677OBJS+= etraxfs_dma.o
edgar_igle62b5b12008-03-14 01:04:24 +0000678OBJS+= etraxfs_pic.o
edgar_igl48318012008-05-11 15:07:19 +0000679OBJS+= etraxfs_eth.o
bellard40293e52008-01-31 11:32:10 +0000680OBJS+= etraxfs_timer.o
681OBJS+= etraxfs_ser.o
edgar_igle62b5b12008-03-14 01:04:24 +0000682
683OBJS+= ptimer.o
edgar_igl48318012008-05-11 15:07:19 +0000684OBJS+= pflash_cfi02.o
thse7daa602007-10-08 13:38:27 +0000685endif
bellard64b3ab22005-01-30 22:43:42 +0000686ifeq ($(TARGET_BASE_ARCH), sparc)
bellard34751872005-07-02 14:31:34 +0000687ifeq ($(TARGET_ARCH), sparc64)
bellard40293e52008-01-31 11:32:10 +0000688OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o
689OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o
690OBJS+= cirrus_vga.o parallel.o ptimer.o
bellard34751872005-07-02 14:31:34 +0000691else
bellard40293e52008-01-31 11:32:10 +0000692OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o
blueswir18b17de82008-03-02 08:48:47 +0000693OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o sparc32_dma.o
bellard40293e52008-01-31 11:32:10 +0000694OBJS+= cs4231.o ptimer.o eccmemctl.o sbi.o sun4c_intctl.o
bellard34751872005-07-02 14:31:34 +0000695endif
bellarde95c8d52004-09-30 22:22:08 +0000696endif
bellardb5ff1b32005-11-26 10:38:39 +0000697ifeq ($(TARGET_BASE_ARCH), arm)
bellard40293e52008-01-31 11:32:10 +0000698OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o
699OBJS+= arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
700OBJS+= versatile_pci.o ptimer.o
701OBJS+= realview_gic.o realview.o arm_sysctl.o mpcore.o
702OBJS+= armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
703OBJS+= pl061.o
704OBJS+= arm-semi.o
705OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
706OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
707OBJS+= pflash_cfi01.o gumstix.o
balrog88d2c952008-06-09 00:03:13 +0000708OBJS+= zaurus.o ide.o serial.o nand.o ecc.o spitz.o tosa.o tc6393xb.o
balrogb4e31042008-03-06 21:07:38 +0000709OBJS+= omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o
balrogafbb5192008-07-21 20:40:22 +0000710OBJS+= omap2.o omap_dss.o soc_dma.o
balrog997641a2008-12-15 02:05:00 +0000711OBJS+= omap_sx1.o palm.o tsc210x.o
balrog942ac052008-04-22 03:15:10 +0000712OBJS+= nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o
balrog58a26b42008-09-28 23:34:13 +0000713OBJS+= tsc2005.o bt-hci-csr.o
bellard40293e52008-01-31 11:32:10 +0000714OBJS+= mst_fpga.o mainstone.o
balrog24859b62008-04-24 19:21:53 +0000715OBJS+= musicpal.o pflash_cfi02.o
balrog5a1237c2007-05-02 02:11:51 +0000716CPPFLAGS += -DHAS_AUDIO
bellardb5ff1b32005-11-26 10:38:39 +0000717endif
bellardfdf9b3e2006-04-27 21:07:38 +0000718ifeq ($(TARGET_BASE_ARCH), sh4)
bellard40293e52008-01-31 11:32:10 +0000719OBJS+= shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
balrog1e5459a2008-12-07 19:08:45 +0000720OBJS+= sh_timer.o ptimer.o sh_serial.o sh_intc.o sh_pci.o sm501.o serial.o
balroga4a771c2008-12-07 18:41:42 +0000721OBJS+= ide.o
bellardfdf9b3e2006-04-27 21:07:38 +0000722endif
pbrook06338792007-05-23 19:58:11 +0000723ifeq ($(TARGET_BASE_ARCH), m68k)
bellard40293e52008-01-31 11:32:10 +0000724OBJS+= an5206.o mcf5206.o ptimer.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
725OBJS+= m68k-semi.o dummy_m68k.o
pbrook06338792007-05-23 19:58:11 +0000726endif
bellarda541f292004-04-12 20:39:29 +0000727ifdef CONFIG_GDBSTUB
pbrook56aebc82008-10-11 17:55:29 +0000728OBJS+=gdbstub.o gdbstub-xml.o
bellard728c9fd2004-01-05 00:08:14 +0000729endif
bellard5b0753e2005-03-01 21:37:28 +0000730ifdef CONFIG_COCOA
bellard1d14ffa2005-10-30 18:58:22 +0000731COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
732ifdef CONFIG_COREAUDIO
733COCOA_LIBS+=-framework CoreAudio
734endif
bellard5b0753e2005-03-01 21:37:28 +0000735endif
bellard7c1f25b2004-04-22 00:02:08 +0000736ifdef CONFIG_SLIRP
ths6f30fa82007-01-05 01:00:47 +0000737CPPFLAGS+=-I$(SRC_PATH)/slirp
bellard626df762003-08-10 21:39:31 +0000738endif
739
bellard40293e52008-01-31 11:32:10 +0000740LIBS+=$(AIOLIBS)
bellardc321f672003-10-30 01:18:42 +0000741# specific flags are needed for non soft mmu emulator
bellardc321f672003-10-30 01:18:42 +0000742ifdef CONFIG_STATIC
bellard40293e52008-01-31 11:32:10 +0000743LDFLAGS+=-static
bellardde5eaa62003-11-16 23:18:17 +0000744endif
bellard83fb7ad2004-07-05 21:25:26 +0000745ifndef CONFIG_DARWIN
bellard11d9f692004-04-02 20:55:59 +0000746ifndef CONFIG_WIN32
bellardec530c82006-04-25 22:36:06 +0000747ifndef CONFIG_SOLARIS
malcb29fe3e2008-11-18 01:42:22 +0000748ifndef CONFIG_AIX
bellard40293e52008-01-31 11:32:10 +0000749LIBS+=-lutil
bellard11d9f692004-04-02 20:55:59 +0000750endif
bellard83fb7ad2004-07-05 21:25:26 +0000751endif
bellardec530c82006-04-25 22:36:06 +0000752endif
malcb29fe3e2008-11-18 01:42:22 +0000753endif
bellarde3086fb2005-02-10 21:48:51 +0000754ifdef TARGET_GPROF
bellard40293e52008-01-31 11:32:10 +0000755vl.o: CFLAGS+=-p
756LDFLAGS+=-p
bellarde3086fb2005-02-10 21:48:51 +0000757endif
bellardc321f672003-10-30 01:18:42 +0000758
bellardb8076a72005-04-07 22:20:31 +0000759ifeq ($(ARCH),ia64)
bellard40293e52008-01-31 11:32:10 +0000760LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
ths8a0ef212007-11-18 22:34:46 +0000761endif
762
bellard1d14ffa2005-10-30 18:58:22 +0000763ifdef CONFIG_WIN32
764SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
765endif
766
bellard40293e52008-01-31 11:32:10 +0000767# profiling code
768ifdef TARGET_GPROF
769LDFLAGS+=-p
770main.o: CFLAGS+=-p
bellard6e1b3e42006-08-17 17:41:26 +0000771endif
772
bellard40293e52008-01-31 11:32:10 +0000773$(QEMU_PROG): $(OBJS) ../libqemu_common.a libqemu.a
ths8a16d272008-07-19 09:56:24 +0000774 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS)
bellard626df762003-08-10 21:39:31 +0000775
bellard40293e52008-01-31 11:32:10 +0000776endif # !CONFIG_USER_ONLY
bellard00a67ba2006-10-28 12:19:07 +0000777
pbrook56aebc82008-10-11 17:55:29 +0000778gdbstub-xml.c: $(TARGET_XML_FILES) feature_to_c.sh
779 rm -f $@
780ifeq ($(TARGET_XML_FILES),)
781 echo > $@
782else
783 $(SHELL) $(SRC_PATH)/feature_to_c.sh $@ $(TARGET_XML_FILES)
784endif
785
bellard626df762003-08-10 21:39:31 +0000786%.o: %.c
bellard40293e52008-01-31 11:32:10 +0000787 $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
bellard626df762003-08-10 21:39:31 +0000788
bellardf72b5192004-02-16 21:55:35 +0000789%.o: %.S
ths6f30fa82007-01-05 01:00:47 +0000790 $(CC) $(CPPFLAGS) -c -o $@ $<
bellardf72b5192004-02-16 21:55:35 +0000791
bellard626df762003-08-10 21:39:31 +0000792clean:
aurel3286e840e2008-12-07 15:21:23 +0000793 rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o
bellard57fec1f2008-02-01 10:50:11 +0000794 rm -f *.d */*.d tcg/*.o
bellard1e43adf2003-09-30 20:54:24 +0000795
ths5fafdf22007-09-16 21:08:06 +0000796install: all
bellard9b14bb02004-03-26 22:43:34 +0000797ifneq ($(PROGS),)
pbrook6a882642006-04-17 13:57:12 +0000798 $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
bellard9b14bb02004-03-26 22:43:34 +0000799endif
bellard626df762003-08-10 21:39:31 +0000800
j_mayer2f96c282007-10-28 13:07:12 +0000801# Include automatically generated dependency files
802-include $(wildcard *.d */*.d)