Statistics
| Branch: | Revision:

root / Makefile.target @ ec6338ba

History | View | Annotate | Download (15.8 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 2f96c28d j_mayer
CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MP
28 831b7825 ths
ifdef CONFIG_DARWIN_USER
29 831b7825 ths
VPATH+=:$(SRC_PATH)/darwin-user
30 831b7825 ths
CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
31 831b7825 ths
endif
32 831b7825 ths
ifdef CONFIG_LINUX_USER
33 3035f7ff bellard
VPATH+=:$(SRC_PATH)/linux-user
34 992f48a0 blueswir1
ifndef TARGET_ABI_DIR
35 992f48a0 blueswir1
  TARGET_ABI_DIR=$(TARGET_ARCH)
36 992f48a0 blueswir1
endif
37 992f48a0 blueswir1
CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
38 3035f7ff bellard
endif
39 6f30fa85 ths
BASE_CFLAGS=
40 6f30fa85 ths
BASE_LDFLAGS=
41 0b0babc6 bellard
#CFLAGS+=-Werror
42 626df76a bellard
LIBS=
43 626df76a bellard
HELPER_CFLAGS=$(CFLAGS)
44 67b915a5 bellard
DYNGEN=../dyngen$(EXESUF)
45 1e43adfc bellard
# user emulator name
46 c91fde65 bellard
TARGET_ARCH2=$(TARGET_ARCH)
47 808c4954 bellard
ifeq ($(TARGET_ARCH),arm)
48 808c4954 bellard
  ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
49 c91fde65 bellard
    TARGET_ARCH2=armeb
50 808c4954 bellard
  endif
51 c91fde65 bellard
endif
52 908f52b0 pbrook
ifeq ($(TARGET_ARCH),sh4)
53 908f52b0 pbrook
  ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
54 908f52b0 pbrook
    TARGET_ARCH2=sh4eb
55 908f52b0 pbrook
  endif
56 908f52b0 pbrook
endif
57 01f5e596 bellard
ifeq ($(TARGET_ARCH),mips)
58 c91fde65 bellard
  ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
59 c91fde65 bellard
    TARGET_ARCH2=mipsel
60 01f5e596 bellard
  endif
61 01f5e596 bellard
endif
62 540635ba ths
ifeq ($(TARGET_ARCH),mipsn32)
63 540635ba ths
  ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
64 540635ba ths
    TARGET_ARCH2=mipsn32el
65 540635ba ths
  endif
66 540635ba ths
endif
67 fbe4f65b ths
ifeq ($(TARGET_ARCH),mips64)
68 fbe4f65b ths
  ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
69 fbe4f65b ths
    TARGET_ARCH2=mips64el
70 fbe4f65b ths
  endif
71 fbe4f65b ths
endif
72 992f48a0 blueswir1
ifeq ($(TARGET_ARCH),sparc64)
73 992f48a0 blueswir1
  ifeq ($(TARGET_ABI_DIR),sparc)
74 992f48a0 blueswir1
    TARGET_ARCH2=sparc32plus
75 992f48a0 blueswir1
  endif
76 992f48a0 blueswir1
endif
77 c91fde65 bellard
QEMU_USER=qemu-$(TARGET_ARCH2)
78 1e43adfc bellard
# system emulator name
79 1e43adfc bellard
ifdef CONFIG_SOFTMMU
80 a541f297 bellard
ifeq ($(TARGET_ARCH), i386)
81 67b915a5 bellard
QEMU_SYSTEM=qemu$(EXESUF)
82 0db63474 bellard
else
83 c91fde65 bellard
QEMU_SYSTEM=qemu-system-$(TARGET_ARCH2)$(EXESUF)
84 a541f297 bellard
endif
85 a541f297 bellard
else
86 0db63474 bellard
QEMU_SYSTEM=qemu-fast
87 1e43adfc bellard
endif
88 1e43adfc bellard
89 16e9b7de bellard
ifdef CONFIG_USER_ONLY
90 1e43adfc bellard
PROGS=$(QEMU_USER)
91 16e9b7de bellard
else
92 c321f673 bellard
PROGS+=$(QEMU_SYSTEM)
93 de5eaa64 bellard
ifndef CONFIG_SOFTMMU
94 de5eaa64 bellard
CONFIG_STATIC=y
95 de5eaa64 bellard
endif
96 728c9fd5 bellard
endif # !CONFIG_USER_ONLY
97 626df76a bellard
98 626df76a bellard
ifdef CONFIG_STATIC
99 6f30fa85 ths
BASE_LDFLAGS+=-static
100 626df76a bellard
endif
101 626df76a bellard
102 6f30fa85 ths
# We require -O2 to avoid the stack setup prologue in EXIT_TB
103 6c041c54 ths
OP_CFLAGS := -Wall -O2 -g -fno-strict-aliasing
104 6c041c54 ths
105 6c041c54 ths
# cc-option
106 6c041c54 ths
# Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0)
107 6c041c54 ths
108 6c041c54 ths
cc-option = $(shell if $(CC) $(OP_CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
109 6c041c54 ths
              > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
110 6c041c54 ths
111 6c041c54 ths
OP_CFLAGS+=$(call cc-option, -fno-reorder-blocks, "")
112 6c041c54 ths
OP_CFLAGS+=$(call cc-option, -fno-gcse, "")
113 6c041c54 ths
OP_CFLAGS+=$(call cc-option, -fno-tree-ch, "")
114 6c041c54 ths
OP_CFLAGS+=$(call cc-option, -fno-optimize-sibling-calls, "")
115 6c041c54 ths
OP_CFLAGS+=$(call cc-option, -fno-crossjumping, "")
116 6c041c54 ths
OP_CFLAGS+=$(call cc-option, -fno-align-labels, "")
117 6c041c54 ths
OP_CFLAGS+=$(call cc-option, -fno-align-jumps, "")
118 6c041c54 ths
OP_CFLAGS+=$(call cc-option, -fno-align-functions, $(call cc-option, -malign-functions=0, ""))
119 1870a74c ths
OP_CFLAGS+=$(call cc-option, -fno-section-anchors, "")
120 6f30fa85 ths
121 626df76a bellard
ifeq ($(ARCH),i386)
122 6f30fa85 ths
HELPER_CFLAGS+=-fomit-frame-pointer
123 6f30fa85 ths
OP_CFLAGS+=-mpreferred-stack-boundary=2 -fomit-frame-pointer
124 626df76a bellard
ifdef TARGET_GPROF
125 3a4739d6 bellard
USE_I386_LD=y
126 3a4739d6 bellard
endif
127 3a4739d6 bellard
ifdef CONFIG_STATIC
128 3a4739d6 bellard
USE_I386_LD=y
129 3a4739d6 bellard
endif
130 3a4739d6 bellard
ifdef USE_I386_LD
131 6f30fa85 ths
BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
132 626df76a bellard
else
133 831b7825 ths
ifdef CONFIG_LINUX_USER
134 626df76a bellard
# WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
135 626df76a bellard
# that the kernel ELF loader considers as an executable. I think this
136 626df76a bellard
# is the simplest way to make it self virtualizable!
137 6f30fa85 ths
BASE_LDFLAGS+=-Wl,-shared
138 626df76a bellard
endif
139 626df76a bellard
endif
140 831b7825 ths
endif
141 626df76a bellard
142 0b0babc6 bellard
ifeq ($(ARCH),x86_64)
143 6f30fa85 ths
BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
144 bc51c5c9 bellard
endif
145 bc51c5c9 bellard
146 626df76a bellard
ifeq ($(ARCH),ppc)
147 6f30fa85 ths
CPPFLAGS+= -D__powerpc__
148 831b7825 ths
ifdef CONFIG_LINUX_USER
149 6f30fa85 ths
BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
150 626df76a bellard
endif
151 831b7825 ths
endif
152 626df76a bellard
153 626df76a bellard
ifeq ($(ARCH),s390)
154 6f30fa85 ths
BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
155 626df76a bellard
endif
156 626df76a bellard
157 626df76a bellard
ifeq ($(ARCH),sparc)
158 3142255c blueswir1
  BASE_CFLAGS+=-ffixed-g2 -ffixed-g3
159 3142255c blueswir1
  OP_CFLAGS+=-fno-delayed-branch -ffixed-i0
160 3142255c blueswir1
  ifeq ($(CONFIG_SOLARIS),yes)
161 3142255c blueswir1
    OP_CFLAGS+=-fno-omit-frame-pointer
162 3142255c blueswir1
  else
163 3142255c blueswir1
    BASE_CFLAGS+=-ffixed-g1 -ffixed-g6
164 3142255c blueswir1
    HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat
165 3142255c blueswir1
    # -static is used to avoid g1/g3 usage by the dynamic linker
166 3142255c blueswir1
    BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
167 3142255c blueswir1
  endif
168 fdbb4691 bellard
endif
169 626df76a bellard
170 626df76a bellard
ifeq ($(ARCH),sparc64)
171 3142255c blueswir1
  BASE_CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
172 3142255c blueswir1
  OP_CFLAGS+=-mcpu=ultrasparc -m64 -fno-delayed-branch -ffixed-i0
173 3142255c blueswir1
  ifneq ($(CONFIG_SOLARIS),yes)
174 3142255c blueswir1
    BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
175 3142255c blueswir1
    OP_CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
176 3142255c blueswir1
  endif
177 626df76a bellard
endif
178 626df76a bellard
179 626df76a bellard
ifeq ($(ARCH),alpha)
180 6f30fa85 ths
# -msmall-data is not used for OP_CFLAGS because we want two-instruction
181 6f30fa85 ths
# relocations for the constant constructions
182 626df76a bellard
# Ensure there's only a single GP
183 6f30fa85 ths
BASE_CFLAGS+=-msmall-data
184 6f30fa85 ths
BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
185 626df76a bellard
endif
186 626df76a bellard
187 626df76a bellard
ifeq ($(ARCH),ia64)
188 6f30fa85 ths
BASE_CFLAGS+=-mno-sdata
189 6f30fa85 ths
OP_CFLAGS+=-mno-sdata
190 6f30fa85 ths
BASE_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
191 626df76a bellard
endif
192 626df76a bellard
193 626df76a bellard
ifeq ($(ARCH),arm)
194 6f30fa85 ths
OP_CFLAGS+=-mno-sched-prolog -fno-omit-frame-pointer
195 6f30fa85 ths
BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
196 626df76a bellard
endif
197 626df76a bellard
198 38e584a0 bellard
ifeq ($(ARCH),m68k)
199 6f30fa85 ths
OP_CFLAGS+=-fomit-frame-pointer
200 6f30fa85 ths
BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
201 6f30fa85 ths
endif
202 6f30fa85 ths
203 6f30fa85 ths
ifeq ($(ARCH),mips)
204 9617efe8 ths
OP_CFLAGS+=-mabi=32 -G0 -fno-PIC -mno-abicalls -fomit-frame-pointer -fno-delayed-branch -Wa,-O0
205 fbe4f65b ths
ifeq ($(WORDS_BIGENDIAN),yes)
206 fbe4f65b ths
BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
207 fbe4f65b ths
else
208 fbe4f65b ths
BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
209 fbe4f65b ths
endif
210 fbe4f65b ths
endif
211 fbe4f65b ths
212 fbe4f65b ths
ifeq ($(ARCH),mips64)
213 9617efe8 ths
OP_CFLAGS+=-mabi=n32 -G0 -fno-PIC -mno-abicalls -fomit-frame-pointer -fno-delayed-branch -Wa,-O0
214 fbe4f65b ths
ifeq ($(WORDS_BIGENDIAN),yes)
215 6f30fa85 ths
BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
216 fbe4f65b ths
else
217 fbe4f65b ths
BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
218 fbe4f65b ths
endif
219 38e584a0 bellard
endif
220 38e584a0 bellard
221 83fb7adf bellard
ifeq ($(CONFIG_DARWIN),yes)
222 e80cfcfc bellard
LIBS+=-lmx
223 83fb7adf bellard
endif
224 83fb7adf bellard
225 01feaa05 ths
ifdef CONFIG_DARWIN_USER
226 01feaa05 ths
# Leave some space for the regular program loading zone
227 01feaa05 ths
BASE_LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000
228 01feaa05 ths
endif
229 01feaa05 ths
230 3142255c blueswir1
BASE_CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
231 3142255c blueswir1
BASE_LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS)
232 3142255c blueswir1
OP_CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
233 3142255c blueswir1
OP_LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS)
234 6f30fa85 ths
235 626df76a bellard
#########################################################
236 626df76a bellard
237 6f30fa85 ths
CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
238 626df76a bellard
LIBS+=-lm
239 b932caba bellard
ifndef CONFIG_USER_ONLY
240 b932caba bellard
LIBS+=-lz
241 b932caba bellard
endif
242 67b915a5 bellard
ifdef CONFIG_WIN32
243 3db38e87 bellard
LIBS+=-lwinmm -lws2_32 -liphlpapi
244 67b915a5 bellard
endif
245 ec530c81 bellard
ifdef CONFIG_SOLARIS
246 ec530c81 bellard
LIBS+=-lsocket -lnsl -lresolv
247 0475a5ca ths
ifdef NEEDS_LIBSUNMATH
248 0475a5ca ths
LIBS+=-lsunmath
249 0475a5ca ths
LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib
250 0475a5ca ths
OP_CFLAGS+=-I/opt/SUNWspro/prod/include/cc
251 0475a5ca ths
BASE_CFLAGS+=-I/opt/SUNWspro/prod/include/cc
252 0475a5ca ths
endif
253 ec530c81 bellard
endif
254 626df76a bellard
255 626df76a bellard
# profiling code
256 626df76a bellard
ifdef TARGET_GPROF
257 6f30fa85 ths
BASE_LDFLAGS+=-p
258 6f30fa85 ths
main.o: BASE_CFLAGS+=-p
259 626df76a bellard
endif
260 626df76a bellard
261 831b7825 ths
ifdef CONFIG_LINUX_USER
262 b92c47c1 ths
OBJS= main.o syscall.o strace.o mmap.o signal.o path.o osdep.o thunk.o \
263 e5fe0c52 pbrook
      elfload.o linuxload.o
264 b5906f95 ths
LIBS+= $(AIOLIBS)
265 e5fe0c52 pbrook
ifdef TARGET_HAS_BFLT
266 e5fe0c52 pbrook
OBJS+= flatload.o
267 e5fe0c52 pbrook
endif
268 cb33da57 blueswir1
ifdef TARGET_HAS_ELFLOAD32
269 cb33da57 blueswir1
OBJS+= elfload32.o
270 cb33da57 blueswir1
elfload32.o: elfload.c
271 cb33da57 blueswir1
endif
272 e5fe0c52 pbrook
273 626df76a bellard
ifeq ($(TARGET_ARCH), i386)
274 626df76a bellard
OBJS+= vm86.o
275 626df76a bellard
endif
276 f72b519c bellard
ifeq ($(TARGET_ARCH), arm)
277 158142c2 bellard
OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
278 f72b519c bellard
nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
279 a4f81979 bellard
 nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o
280 f72b519c bellard
endif
281 e6e5906b pbrook
ifeq ($(TARGET_ARCH), m68k)
282 e6e5906b pbrook
OBJS+= m68k-sim.o m68k-semi.o
283 e6e5906b pbrook
endif
284 831b7825 ths
endif #CONFIG_LINUX_USER
285 831b7825 ths
286 831b7825 ths
ifdef CONFIG_DARWIN_USER
287 831b7825 ths
OBJS= main.o commpage.o machload.o mmap.o osdep.o signal.o syscall.o thunk.o
288 831b7825 ths
endif
289 831b7825 ths
290 626df76a bellard
SRCS:= $(OBJS:.o=.c)
291 626df76a bellard
OBJS+= libqemu.a
292 626df76a bellard
293 626df76a bellard
# cpu emulator library
294 158142c2 bellard
LIBOBJS=exec.o kqemu.o translate-op.o translate-all.o cpu-exec.o\
295 f1548daa j_mayer
        translate.o op.o host-utils.o
296 158142c2 bellard
ifdef CONFIG_SOFTFLOAT
297 158142c2 bellard
LIBOBJS+=fpu/softfloat.o
298 158142c2 bellard
else
299 158142c2 bellard
LIBOBJS+=fpu/softfloat-native.o
300 158142c2 bellard
endif
301 6f30fa85 ths
CPPFLAGS+=-I$(SRC_PATH)/fpu
302 626df76a bellard
303 626df76a bellard
ifeq ($(TARGET_ARCH), i386)
304 1e43adfc bellard
LIBOBJS+=helper.o helper2.o
305 626df76a bellard
endif
306 626df76a bellard
307 0b0babc6 bellard
ifeq ($(TARGET_ARCH), x86_64)
308 0b0babc6 bellard
LIBOBJS+=helper.o helper2.o
309 0b0babc6 bellard
endif
310 0b0babc6 bellard
311 a2458627 bellard
ifeq ($(TARGET_BASE_ARCH), ppc)
312 728c9fd5 bellard
LIBOBJS+= op_helper.o helper.o
313 67867308 bellard
endif
314 67867308 bellard
315 fbe4f65b ths
ifeq ($(TARGET_BASE_ARCH), mips)
316 6af0bf9c bellard
LIBOBJS+= op_helper.o helper.o
317 6af0bf9c bellard
endif
318 6af0bf9c bellard
319 64b3ab24 bellard
ifeq ($(TARGET_BASE_ARCH), sparc)
320 e95c8d51 bellard
LIBOBJS+= op_helper.o helper.o
321 e95c8d51 bellard
endif
322 e95c8d51 bellard
323 b7bcbe95 bellard
ifeq ($(TARGET_BASE_ARCH), arm)
324 b5ff1b31 bellard
LIBOBJS+= op_helper.o helper.o
325 b7bcbe95 bellard
endif
326 b7bcbe95 bellard
327 fdf9b3e8 bellard
ifeq ($(TARGET_BASE_ARCH), sh4)
328 fdf9b3e8 bellard
LIBOBJS+= op_helper.o helper.o
329 fdf9b3e8 bellard
endif
330 fdf9b3e8 bellard
331 e6e5906b pbrook
ifeq ($(TARGET_BASE_ARCH), m68k)
332 0633879f pbrook
LIBOBJS+= op_helper.o helper.o
333 e6e5906b pbrook
endif
334 e6e5906b pbrook
335 cf6c1b16 j_mayer
ifeq ($(TARGET_BASE_ARCH), alpha)
336 cf6c1b16 j_mayer
LIBOBJS+= op_helper.o helper.o alpha_palcode.o
337 cf6c1b16 j_mayer
endif
338 cf6c1b16 j_mayer
339 e7daa605 ths
ifeq ($(TARGET_BASE_ARCH), cris)
340 e7daa605 ths
LIBOBJS+= op_helper.o helper.o
341 e7daa605 ths
LIBOBJS+= cris-dis.o
342 e7daa605 ths
343 e7daa605 ths
ifndef CONFIG_USER_ONLY
344 e7daa605 ths
LIBOBJS+= mmu.o
345 e7daa605 ths
endif
346 e7daa605 ths
endif
347 e7daa605 ths
348 626df76a bellard
# NOTE: the disassembler code is only needed for debugging
349 5fafdf24 ths
LIBOBJS+=disas.o
350 626df76a bellard
ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
351 bc51c5c9 bellard
USE_I386_DIS=y
352 bc51c5c9 bellard
endif
353 0b0babc6 bellard
ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
354 bc51c5c9 bellard
USE_I386_DIS=y
355 bc51c5c9 bellard
endif
356 bc51c5c9 bellard
ifdef USE_I386_DIS
357 626df76a bellard
LIBOBJS+=i386-dis.o
358 626df76a bellard
endif
359 626df76a bellard
ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
360 626df76a bellard
LIBOBJS+=alpha-dis.o
361 626df76a bellard
endif
362 a2458627 bellard
ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
363 626df76a bellard
LIBOBJS+=ppc-dis.o
364 626df76a bellard
endif
365 fbe4f65b ths
ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips)
366 6af0bf9c bellard
LIBOBJS+=mips-dis.o
367 6af0bf9c bellard
endif
368 64b3ab24 bellard
ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
369 626df76a bellard
LIBOBJS+=sparc-dis.o
370 626df76a bellard
endif
371 626df76a bellard
ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
372 626df76a bellard
LIBOBJS+=arm-dis.o
373 626df76a bellard
endif
374 48024e4a bellard
ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
375 48024e4a bellard
LIBOBJS+=m68k-dis.o
376 48024e4a bellard
endif
377 fdf9b3e8 bellard
ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
378 fdf9b3e8 bellard
LIBOBJS+=sh4-dis.o
379 fdf9b3e8 bellard
endif
380 8f860bb8 ths
ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390)
381 8f860bb8 ths
LIBOBJS+=s390-dis.o
382 8f860bb8 ths
endif
383 626df76a bellard
384 1fddef4b bellard
ifdef CONFIG_GDBSTUB
385 1fddef4b bellard
OBJS+=gdbstub.o
386 1fddef4b bellard
endif
387 626df76a bellard
388 1e43adfc bellard
all: $(PROGS)
389 626df76a bellard
390 1e43adfc bellard
$(QEMU_USER): $(OBJS)
391 6f30fa85 ths
	$(CC) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^  $(LIBS)
392 626df76a bellard
ifeq ($(ARCH),alpha)
393 626df76a bellard
# Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
394 626df76a bellard
# the address space (31 bit so sign extending doesn't matter)
395 626df76a bellard
	echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
396 626df76a bellard
endif
397 626df76a bellard
398 626df76a bellard
# must use static linking to avoid leaving stuff in virtual address space
399 4fb240a4 bellard
VL_OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o
400 4fb240a4 bellard
# XXX: suppress QEMU_TOOL tests
401 83f64091 bellard
VL_OBJS+=block.o block-raw.o
402 d537cf6c pbrook
VL_OBJS+=irq.o
403 a541f297 bellard
404 1d14ffa9 bellard
ifdef CONFIG_ALSA
405 1d14ffa9 bellard
LIBS += -lasound
406 1d14ffa9 bellard
endif
407 1d14ffa9 bellard
ifdef CONFIG_DSOUND
408 1d14ffa9 bellard
LIBS += -lole32 -ldxguid
409 85571bc7 bellard
endif
410 102a52e4 bellard
ifdef CONFIG_FMOD
411 102a52e4 bellard
LIBS += $(CONFIG_FMOD_LIB)
412 85571bc7 bellard
endif
413 4fb240a4 bellard
414 4fb240a4 bellard
SOUND_HW = sb16.o es1370.o
415 1d14ffa9 bellard
ifdef CONFIG_ADLIB
416 1d14ffa9 bellard
SOUND_HW += fmopl.o adlib.o
417 1d14ffa9 bellard
endif
418 85571bc7 bellard
419 8d5d2d4c ths
ifdef CONFIG_VNC_TLS
420 8d5d2d4c ths
CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
421 8d5d2d4c ths
LIBS += $(CONFIG_VNC_TLS_LIBS)
422 8d5d2d4c ths
endif
423 8d5d2d4c ths
424 0ff596d0 pbrook
VL_OBJS += i2c.o smbus.o
425 0ff596d0 pbrook
426 2e5d83bb pbrook
# SCSI layer
427 7d8406be pbrook
VL_OBJS+= scsi-disk.o cdrom.o lsi53c895a.o
428 2e5d83bb pbrook
429 a594cfbf bellard
# USB layer
430 2e5d83bb pbrook
VL_OBJS+= usb.o usb-hub.o usb-linux.o usb-hid.o usb-ohci.o usb-msd.o
431 f6d2a316 balrog
VL_OBJS+= usb-wacom.o
432 a594cfbf bellard
433 663e8e51 ths
# EEPROM emulation
434 663e8e51 ths
VL_OBJS += eeprom93xx.o
435 663e8e51 ths
436 a41b2ff2 pbrook
# PCI network cards
437 663e8e51 ths
VL_OBJS += eepro100.o
438 663e8e51 ths
VL_OBJS += ne2000.o
439 663e8e51 ths
VL_OBJS += pcnet.o
440 663e8e51 ths
VL_OBJS += rtl8139.o
441 a41b2ff2 pbrook
442 0b0babc6 bellard
ifeq ($(TARGET_BASE_ARCH), i386)
443 a541f297 bellard
# Hardware support
444 4fb240a4 bellard
VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o
445 fd06c375 bellard
VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
446 b00052e4 balrog
VL_OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o
447 591a6d62 ths
VL_OBJS+= usb-uhci.o smbus_eeprom.o vmmouse.o vmport.o vmware_vga.o
448 b00052e4 balrog
CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
449 67b915a5 bellard
endif
450 a2458627 bellard
ifeq ($(TARGET_BASE_ARCH), ppc)
451 b00052e4 balrog
CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
452 3cbee15b j_mayer
# shared objects
453 4fb240a4 bellard
VL_OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o
454 3cbee15b j_mayer
# PREP target
455 3cbee15b j_mayer
VL_OBJS+= pckbd.o ps2.o serial.o i8259.o i8254.o fdc.o m48t59.o mc146818rtc.o
456 3cbee15b j_mayer
VL_OBJS+= prep_pci.o ppc_prep.o
457 3cbee15b j_mayer
# Mac shared devices
458 3cbee15b j_mayer
VL_OBJS+= macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o
459 3cbee15b j_mayer
# OldWorld PowerMac
460 3cbee15b j_mayer
VL_OBJS+= heathrow_pic.o grackle_pci.o ppc_oldworld.o
461 3cbee15b j_mayer
# NewWorld PowerMac
462 3cbee15b j_mayer
VL_OBJS+= unin_pci.o ppc_chrp.o
463 3cbee15b j_mayer
# PowerPC 4xx boards
464 3cbee15b j_mayer
VL_OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc405_uc.o ppc405_boards.o
465 a541f297 bellard
endif
466 fbe4f65b ths
ifeq ($(TARGET_BASE_ARCH), mips)
467 6bf5b4e8 ths
VL_OBJS+= mips_r4k.o mips_malta.o mips_pica61.o mips_mipssim.o
468 ad6fe1d2 ths
VL_OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o
469 31211df1 ths
VL_OBJS+= jazz_led.o
470 9542611a ths
VL_OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
471 4fb240a4 bellard
VL_OBJS+= piix_pci.o smbus_eeprom.o parallel.o cirrus_vga.o $(SOUND_HW)
472 6bf5b4e8 ths
VL_OBJS+= mipsnet.o
473 83b1fb88 ths
CPPFLAGS += -DHAS_AUDIO
474 6af0bf9c bellard
endif
475 e7daa605 ths
ifeq ($(TARGET_BASE_ARCH), cris)
476 e7daa605 ths
VL_OBJS+= etraxfs.o
477 e7daa605 ths
VL_OBJS+= ptimer.o
478 e7daa605 ths
VL_OBJS+= etraxfs_timer.o
479 e7daa605 ths
VL_OBJS+= etraxfs_ser.o
480 e7daa605 ths
endif
481 64b3ab24 bellard
ifeq ($(TARGET_BASE_ARCH), sparc)
482 3475187d bellard
ifeq ($(TARGET_ARCH), sparc64)
483 502a5395 pbrook
VL_OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o
484 83469015 bellard
VL_OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o
485 20c9f095 blueswir1
VL_OBJS+= cirrus_vga.o parallel.o ptimer.o
486 3475187d bellard
else
487 67e999be bellard
VL_OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o
488 67e999be bellard
VL_OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o esp.o sparc32_dma.o
489 8d05ea8a blueswir1
VL_OBJS+= cs4231.o ptimer.o
490 3475187d bellard
endif
491 e95c8d51 bellard
endif
492 b5ff1b31 bellard
ifeq ($(TARGET_BASE_ARCH), arm)
493 cdbdb648 pbrook
VL_OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o
494 7e1543c2 pbrook
VL_OBJS+= arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
495 6963d7af pbrook
VL_OBJS+= versatile_pci.o sd.o ptimer.o
496 e69954b9 pbrook
VL_OBJS+= arm_gic.o realview.o arm_sysctl.o
497 8e71621f pbrook
VL_OBJS+= arm-semi.o
498 b00052e4 balrog
VL_OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
499 adb86c37 balrog
VL_OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o max111x.o max7310.o
500 4fb240a4 bellard
VL_OBJS+= spitz.o ads7846.o ide.o serial.o nand.o ecc.o wm8750.o
501 02645926 balrog
VL_OBJS+= omap.o omap_lcdc.o omap1_clk.o omap_mmc.o omap_i2c.o
502 02645926 balrog
VL_OBJS+= palm.o tsc210x.o
503 5a1237c4 balrog
CPPFLAGS += -DHAS_AUDIO
504 b5ff1b31 bellard
endif
505 fdf9b3e8 bellard
ifeq ($(TARGET_BASE_ARCH), sh4)
506 0d78f544 ths
VL_OBJS+= shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
507 80f515e6 balrog
VL_OBJS+= sh_timer.o ptimer.o sh_serial.o sh_intc.o
508 fdf9b3e8 bellard
endif
509 0633879f pbrook
ifeq ($(TARGET_BASE_ARCH), m68k)
510 7e049b8a pbrook
VL_OBJS+= an5206.o mcf5206.o ptimer.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
511 a87295e8 pbrook
VL_OBJS+= m68k-semi.o
512 0633879f pbrook
endif
513 a541f297 bellard
ifdef CONFIG_GDBSTUB
514 5fafdf24 ths
VL_OBJS+=gdbstub.o
515 728c9fd5 bellard
endif
516 5b0753e0 bellard
ifdef CONFIG_COCOA
517 1d14ffa9 bellard
COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
518 1d14ffa9 bellard
ifdef CONFIG_COREAUDIO
519 1d14ffa9 bellard
COCOA_LIBS+=-framework CoreAudio
520 1d14ffa9 bellard
endif
521 5b0753e0 bellard
endif
522 7c1f25b4 bellard
ifdef CONFIG_SLIRP
523 6f30fa85 ths
CPPFLAGS+=-I$(SRC_PATH)/slirp
524 626df76a bellard
endif
525 626df76a bellard
526 db8d7dd1 ths
VL_LDFLAGS=$(VL_OS_LDFLAGS)
527 70956b77 ths
VL_LIBS=$(AIOLIBS)
528 c321f673 bellard
# specific flags are needed for non soft mmu emulator
529 c321f673 bellard
ifdef CONFIG_STATIC
530 c321f673 bellard
VL_LDFLAGS+=-static
531 c321f673 bellard
endif
532 de5eaa64 bellard
ifndef CONFIG_SOFTMMU
533 5fafdf24 ths
VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld
534 de5eaa64 bellard
endif
535 83fb7adf bellard
ifndef CONFIG_DARWIN
536 11d9f695 bellard
ifndef CONFIG_WIN32
537 ec530c81 bellard
ifndef CONFIG_SOLARIS
538 70956b77 ths
VL_LIBS+=-lutil
539 11d9f695 bellard
endif
540 83fb7adf bellard
endif
541 ec530c81 bellard
endif
542 e3086fbf bellard
ifdef TARGET_GPROF
543 6f30fa85 ths
vl.o: BASE_CFLAGS+=-p
544 e3086fbf bellard
VL_LDFLAGS+=-p
545 e3086fbf bellard
endif
546 c321f673 bellard
547 b8076a74 bellard
ifeq ($(ARCH),ia64)
548 b8076a74 bellard
VL_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
549 b8076a74 bellard
endif
550 b8076a74 bellard
551 74ccb34e bellard
ifeq ($(ARCH),sparc64)
552 3142255c blueswir1
  VL_LDFLAGS+=-m64
553 3142255c blueswir1
  ifneq ($(CONFIG_SOLARIS),yes)
554 3142255c blueswir1
    VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
555 3142255c blueswir1
  endif
556 74ccb34e bellard
endif
557 74ccb34e bellard
558 1d14ffa9 bellard
ifdef CONFIG_WIN32
559 1d14ffa9 bellard
SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
560 1d14ffa9 bellard
endif
561 1d14ffa9 bellard
562 4fb240a4 bellard
$(QEMU_SYSTEM): $(VL_OBJS) ../libqemu_common.a libqemu.a
563 3a11702b pbrook
	$(CC) $(VL_LDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
564 5b0753e0 bellard
565 626df76a bellard
depend: $(SRCS)
566 6f30fa85 ths
	$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
567 626df76a bellard
568 1d14ffa9 bellard
vldepend: $(VL_OBJS:.o=.c)
569 6f30fa85 ths
	$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
570 1d14ffa9 bellard
571 5fafdf24 ths
# libqemu
572 626df76a bellard
573 626df76a bellard
libqemu.a: $(LIBOBJS)
574 626df76a bellard
	rm -f $@
575 626df76a bellard
	$(AR) rcs $@ $(LIBOBJS)
576 626df76a bellard
577 1e43adfc bellard
translate.o: translate.c gen-op.h opc.h cpu.h
578 626df76a bellard
579 158142c2 bellard
translate-all.o: translate-all.c opc.h cpu.h
580 158142c2 bellard
581 158142c2 bellard
translate-op.o: translate-all.c op.h opc.h cpu.h
582 626df76a bellard
583 1e43adfc bellard
op.h: op.o $(DYNGEN)
584 626df76a bellard
	$(DYNGEN) -o $@ $<
585 626df76a bellard
586 1e43adfc bellard
opc.h: op.o $(DYNGEN)
587 626df76a bellard
	$(DYNGEN) -c -o $@ $<
588 626df76a bellard
589 1e43adfc bellard
gen-op.h: op.o $(DYNGEN)
590 626df76a bellard
	$(DYNGEN) -g -o $@ $<
591 626df76a bellard
592 1e43adfc bellard
op.o: op.c
593 6f30fa85 ths
	$(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $<
594 626df76a bellard
595 6e1b3e4d bellard
# HELPER_CFLAGS is used for all the code compiled with static register
596 6e1b3e4d bellard
# variables
597 6e1b3e4d bellard
ifeq ($(TARGET_BASE_ARCH), i386)
598 6e1b3e4d bellard
# XXX: rename helper.c to op_helper.c
599 1e43adfc bellard
helper.o: helper.c
600 6f30fa85 ths
	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
601 6e1b3e4d bellard
else
602 6e1b3e4d bellard
op_helper.o: op_helper.c
603 6f30fa85 ths
	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
604 6e1b3e4d bellard
endif
605 6e1b3e4d bellard
606 6e1b3e4d bellard
cpu-exec.o: cpu-exec.c
607 6f30fa85 ths
	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
608 626df76a bellard
609 00a67ba1 bellard
# Note: this is a workaround. The real fix is to avoid compiling
610 00a67ba1 bellard
# cpu_signal_handler() in cpu-exec.c.
611 00a67ba1 bellard
signal.o: signal.c
612 6f30fa85 ths
	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
613 00a67ba1 bellard
614 626df76a bellard
%.o: %.c
615 6f30fa85 ths
	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
616 626df76a bellard
617 f72b519c bellard
%.o: %.S
618 6f30fa85 ths
	$(CC) $(CPPFLAGS) -c -o $@ $<
619 f72b519c bellard
620 626df76a bellard
clean:
621 4fb240a4 bellard
	rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o fpu/*.o
622 2f96c28d j_mayer
	rm -f *.d */*.d
623 1e43adfc bellard
624 5fafdf24 ths
install: all
625 9b14bb04 bellard
ifneq ($(PROGS),)
626 6a882643 pbrook
	$(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
627 9b14bb04 bellard
endif
628 626df76a bellard
629 626df76a bellard
ifneq ($(wildcard .depend),)
630 626df76a bellard
include .depend
631 626df76a bellard
endif
632 1d14ffa9 bellard
633 c0fe3827 bellard
ifeq (1, 0)
634 1d14ffa9 bellard
audio.o sdlaudio.o dsoundaudio.o ossaudio.o wavaudio.o noaudio.o \
635 c0fe3827 bellard
fmodaudio.o alsaaudio.o mixeng.o sb16.o es1370.o gus.o adlib.o: \
636 1d14ffa9 bellard
CFLAGS := $(CFLAGS) -Wall -Werror -W -Wsign-compare
637 1d14ffa9 bellard
endif
638 2f96c28d j_mayer
639 2f96c28d j_mayer
# Include automatically generated dependency files
640 2f96c28d j_mayer
-include $(wildcard *.d */*.d)