Statistics
| Branch: | Revision:

root / Makefile.target @ 8686c490

History | View | Annotate | Download (16.6 kB)

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