Statistics
| Branch: | Revision:

root / Makefile.target @ f54b3f92

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