Statistics
| Branch: | Revision:

root / Makefile.target @ 4fb240a4

History | View | Annotate | Download (15.9 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 f72b519c bellard
ifeq ($(ARCH), i386)
306 f72b519c bellard
LIBOBJS+=translate-copy.o
307 f72b519c bellard
endif
308 626df76a bellard
endif
309 626df76a bellard
310 0b0babc6 bellard
ifeq ($(TARGET_ARCH), x86_64)
311 0b0babc6 bellard
LIBOBJS+=helper.o helper2.o
312 0b0babc6 bellard
endif
313 0b0babc6 bellard
314 a2458627 bellard
ifeq ($(TARGET_BASE_ARCH), ppc)
315 728c9fd5 bellard
LIBOBJS+= op_helper.o helper.o
316 67867308 bellard
endif
317 67867308 bellard
318 fbe4f65b ths
ifeq ($(TARGET_BASE_ARCH), mips)
319 6af0bf9c bellard
LIBOBJS+= op_helper.o helper.o
320 6af0bf9c bellard
endif
321 6af0bf9c bellard
322 64b3ab24 bellard
ifeq ($(TARGET_BASE_ARCH), sparc)
323 e95c8d51 bellard
LIBOBJS+= op_helper.o helper.o
324 e95c8d51 bellard
endif
325 e95c8d51 bellard
326 b7bcbe95 bellard
ifeq ($(TARGET_BASE_ARCH), arm)
327 b5ff1b31 bellard
LIBOBJS+= op_helper.o helper.o
328 b7bcbe95 bellard
endif
329 b7bcbe95 bellard
330 fdf9b3e8 bellard
ifeq ($(TARGET_BASE_ARCH), sh4)
331 fdf9b3e8 bellard
LIBOBJS+= op_helper.o helper.o
332 fdf9b3e8 bellard
endif
333 fdf9b3e8 bellard
334 e6e5906b pbrook
ifeq ($(TARGET_BASE_ARCH), m68k)
335 0633879f pbrook
LIBOBJS+= op_helper.o helper.o
336 e6e5906b pbrook
endif
337 e6e5906b pbrook
338 cf6c1b16 j_mayer
ifeq ($(TARGET_BASE_ARCH), alpha)
339 cf6c1b16 j_mayer
LIBOBJS+= op_helper.o helper.o alpha_palcode.o
340 cf6c1b16 j_mayer
endif
341 cf6c1b16 j_mayer
342 e7daa605 ths
ifeq ($(TARGET_BASE_ARCH), cris)
343 e7daa605 ths
LIBOBJS+= op_helper.o helper.o
344 e7daa605 ths
LIBOBJS+= cris-dis.o
345 e7daa605 ths
346 e7daa605 ths
ifndef CONFIG_USER_ONLY
347 e7daa605 ths
LIBOBJS+= mmu.o
348 e7daa605 ths
endif
349 e7daa605 ths
endif
350 e7daa605 ths
351 626df76a bellard
# NOTE: the disassembler code is only needed for debugging
352 5fafdf24 ths
LIBOBJS+=disas.o
353 626df76a bellard
ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
354 bc51c5c9 bellard
USE_I386_DIS=y
355 bc51c5c9 bellard
endif
356 0b0babc6 bellard
ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
357 bc51c5c9 bellard
USE_I386_DIS=y
358 bc51c5c9 bellard
endif
359 bc51c5c9 bellard
ifdef USE_I386_DIS
360 626df76a bellard
LIBOBJS+=i386-dis.o
361 626df76a bellard
endif
362 626df76a bellard
ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
363 626df76a bellard
LIBOBJS+=alpha-dis.o
364 626df76a bellard
endif
365 a2458627 bellard
ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
366 626df76a bellard
LIBOBJS+=ppc-dis.o
367 626df76a bellard
endif
368 fbe4f65b ths
ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips)
369 6af0bf9c bellard
LIBOBJS+=mips-dis.o
370 6af0bf9c bellard
endif
371 64b3ab24 bellard
ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
372 626df76a bellard
LIBOBJS+=sparc-dis.o
373 626df76a bellard
endif
374 626df76a bellard
ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
375 626df76a bellard
LIBOBJS+=arm-dis.o
376 626df76a bellard
endif
377 48024e4a bellard
ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
378 48024e4a bellard
LIBOBJS+=m68k-dis.o
379 48024e4a bellard
endif
380 fdf9b3e8 bellard
ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
381 fdf9b3e8 bellard
LIBOBJS+=sh4-dis.o
382 fdf9b3e8 bellard
endif
383 8f860bb8 ths
ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390)
384 8f860bb8 ths
LIBOBJS+=s390-dis.o
385 8f860bb8 ths
endif
386 626df76a bellard
387 1fddef4b bellard
ifdef CONFIG_GDBSTUB
388 1fddef4b bellard
OBJS+=gdbstub.o
389 1fddef4b bellard
endif
390 626df76a bellard
391 1e43adfc bellard
all: $(PROGS)
392 626df76a bellard
393 1e43adfc bellard
$(QEMU_USER): $(OBJS)
394 6f30fa85 ths
	$(CC) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^  $(LIBS)
395 626df76a bellard
ifeq ($(ARCH),alpha)
396 626df76a bellard
# Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
397 626df76a bellard
# the address space (31 bit so sign extending doesn't matter)
398 626df76a bellard
	echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
399 626df76a bellard
endif
400 626df76a bellard
401 626df76a bellard
# must use static linking to avoid leaving stuff in virtual address space
402 4fb240a4 bellard
VL_OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o
403 4fb240a4 bellard
# XXX: suppress QEMU_TOOL tests
404 83f64091 bellard
VL_OBJS+=block.o block-raw.o
405 d537cf6c pbrook
VL_OBJS+=irq.o
406 a541f297 bellard
407 1d14ffa9 bellard
ifdef CONFIG_ALSA
408 1d14ffa9 bellard
LIBS += -lasound
409 1d14ffa9 bellard
endif
410 1d14ffa9 bellard
ifdef CONFIG_DSOUND
411 1d14ffa9 bellard
LIBS += -lole32 -ldxguid
412 85571bc7 bellard
endif
413 102a52e4 bellard
ifdef CONFIG_FMOD
414 102a52e4 bellard
LIBS += $(CONFIG_FMOD_LIB)
415 85571bc7 bellard
endif
416 4fb240a4 bellard
417 4fb240a4 bellard
SOUND_HW = sb16.o es1370.o
418 1d14ffa9 bellard
ifdef CONFIG_ADLIB
419 1d14ffa9 bellard
SOUND_HW += fmopl.o adlib.o
420 1d14ffa9 bellard
endif
421 85571bc7 bellard
422 8d5d2d4c ths
ifdef CONFIG_VNC_TLS
423 8d5d2d4c ths
CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
424 8d5d2d4c ths
LIBS += $(CONFIG_VNC_TLS_LIBS)
425 8d5d2d4c ths
endif
426 8d5d2d4c ths
427 0ff596d0 pbrook
VL_OBJS += i2c.o smbus.o
428 0ff596d0 pbrook
429 2e5d83bb pbrook
# SCSI layer
430 7d8406be pbrook
VL_OBJS+= scsi-disk.o cdrom.o lsi53c895a.o
431 2e5d83bb pbrook
432 a594cfbf bellard
# USB layer
433 2e5d83bb pbrook
VL_OBJS+= usb.o usb-hub.o usb-linux.o usb-hid.o usb-ohci.o usb-msd.o
434 f6d2a316 balrog
VL_OBJS+= usb-wacom.o
435 a594cfbf bellard
436 663e8e51 ths
# EEPROM emulation
437 663e8e51 ths
VL_OBJS += eeprom93xx.o
438 663e8e51 ths
439 a41b2ff2 pbrook
# PCI network cards
440 663e8e51 ths
VL_OBJS += eepro100.o
441 663e8e51 ths
VL_OBJS += ne2000.o
442 663e8e51 ths
VL_OBJS += pcnet.o
443 663e8e51 ths
VL_OBJS += rtl8139.o
444 a41b2ff2 pbrook
445 0b0babc6 bellard
ifeq ($(TARGET_BASE_ARCH), i386)
446 a541f297 bellard
# Hardware support
447 4fb240a4 bellard
VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o
448 fd06c375 bellard
VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
449 b00052e4 balrog
VL_OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o
450 591a6d62 ths
VL_OBJS+= usb-uhci.o smbus_eeprom.o vmmouse.o vmport.o vmware_vga.o
451 b00052e4 balrog
CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
452 67b915a5 bellard
endif
453 a2458627 bellard
ifeq ($(TARGET_BASE_ARCH), ppc)
454 b00052e4 balrog
CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
455 3cbee15b j_mayer
# shared objects
456 4fb240a4 bellard
VL_OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o
457 3cbee15b j_mayer
# PREP target
458 3cbee15b j_mayer
VL_OBJS+= pckbd.o ps2.o serial.o i8259.o i8254.o fdc.o m48t59.o mc146818rtc.o
459 3cbee15b j_mayer
VL_OBJS+= prep_pci.o ppc_prep.o
460 3cbee15b j_mayer
# Mac shared devices
461 3cbee15b j_mayer
VL_OBJS+= macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o
462 3cbee15b j_mayer
# OldWorld PowerMac
463 3cbee15b j_mayer
VL_OBJS+= heathrow_pic.o grackle_pci.o ppc_oldworld.o
464 3cbee15b j_mayer
# NewWorld PowerMac
465 3cbee15b j_mayer
VL_OBJS+= unin_pci.o ppc_chrp.o
466 3cbee15b j_mayer
# PowerPC 4xx boards
467 3cbee15b j_mayer
VL_OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc405_uc.o ppc405_boards.o
468 a541f297 bellard
endif
469 fbe4f65b ths
ifeq ($(TARGET_BASE_ARCH), mips)
470 6bf5b4e8 ths
VL_OBJS+= mips_r4k.o mips_malta.o mips_pica61.o mips_mipssim.o
471 ad6fe1d2 ths
VL_OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o
472 31211df1 ths
VL_OBJS+= jazz_led.o
473 9542611a ths
VL_OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
474 4fb240a4 bellard
VL_OBJS+= piix_pci.o smbus_eeprom.o parallel.o cirrus_vga.o $(SOUND_HW)
475 6bf5b4e8 ths
VL_OBJS+= mipsnet.o
476 83b1fb88 ths
CPPFLAGS += -DHAS_AUDIO
477 6af0bf9c bellard
endif
478 e7daa605 ths
ifeq ($(TARGET_BASE_ARCH), cris)
479 e7daa605 ths
VL_OBJS+= etraxfs.o
480 e7daa605 ths
VL_OBJS+= ptimer.o
481 e7daa605 ths
VL_OBJS+= etraxfs_timer.o
482 e7daa605 ths
VL_OBJS+= etraxfs_ser.o
483 e7daa605 ths
endif
484 64b3ab24 bellard
ifeq ($(TARGET_BASE_ARCH), sparc)
485 3475187d bellard
ifeq ($(TARGET_ARCH), sparc64)
486 502a5395 pbrook
VL_OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o
487 83469015 bellard
VL_OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o
488 20c9f095 blueswir1
VL_OBJS+= cirrus_vga.o parallel.o ptimer.o
489 3475187d bellard
else
490 67e999be bellard
VL_OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o
491 67e999be bellard
VL_OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o esp.o sparc32_dma.o
492 8d05ea8a blueswir1
VL_OBJS+= cs4231.o ptimer.o
493 3475187d bellard
endif
494 e95c8d51 bellard
endif
495 b5ff1b31 bellard
ifeq ($(TARGET_BASE_ARCH), arm)
496 cdbdb648 pbrook
VL_OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o
497 7e1543c2 pbrook
VL_OBJS+= arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
498 6963d7af pbrook
VL_OBJS+= versatile_pci.o sd.o ptimer.o
499 e69954b9 pbrook
VL_OBJS+= arm_gic.o realview.o arm_sysctl.o
500 8e71621f pbrook
VL_OBJS+= arm-semi.o
501 b00052e4 balrog
VL_OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
502 adb86c37 balrog
VL_OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o max111x.o max7310.o
503 4fb240a4 bellard
VL_OBJS+= spitz.o ads7846.o ide.o serial.o nand.o ecc.o wm8750.o
504 02645926 balrog
VL_OBJS+= omap.o omap_lcdc.o omap1_clk.o omap_mmc.o omap_i2c.o
505 02645926 balrog
VL_OBJS+= palm.o tsc210x.o
506 5a1237c4 balrog
CPPFLAGS += -DHAS_AUDIO
507 b5ff1b31 bellard
endif
508 fdf9b3e8 bellard
ifeq ($(TARGET_BASE_ARCH), sh4)
509 0d78f544 ths
VL_OBJS+= shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
510 80f515e6 balrog
VL_OBJS+= sh_timer.o ptimer.o sh_serial.o sh_intc.o
511 fdf9b3e8 bellard
endif
512 0633879f pbrook
ifeq ($(TARGET_BASE_ARCH), m68k)
513 7e049b8a pbrook
VL_OBJS+= an5206.o mcf5206.o ptimer.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
514 a87295e8 pbrook
VL_OBJS+= m68k-semi.o
515 0633879f pbrook
endif
516 a541f297 bellard
ifdef CONFIG_GDBSTUB
517 5fafdf24 ths
VL_OBJS+=gdbstub.o
518 728c9fd5 bellard
endif
519 5b0753e0 bellard
ifdef CONFIG_COCOA
520 1d14ffa9 bellard
COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
521 1d14ffa9 bellard
ifdef CONFIG_COREAUDIO
522 1d14ffa9 bellard
COCOA_LIBS+=-framework CoreAudio
523 1d14ffa9 bellard
endif
524 5b0753e0 bellard
endif
525 7c1f25b4 bellard
ifdef CONFIG_SLIRP
526 6f30fa85 ths
CPPFLAGS+=-I$(SRC_PATH)/slirp
527 626df76a bellard
endif
528 626df76a bellard
529 db8d7dd1 ths
VL_LDFLAGS=$(VL_OS_LDFLAGS)
530 70956b77 ths
VL_LIBS=$(AIOLIBS)
531 c321f673 bellard
# specific flags are needed for non soft mmu emulator
532 c321f673 bellard
ifdef CONFIG_STATIC
533 c321f673 bellard
VL_LDFLAGS+=-static
534 c321f673 bellard
endif
535 de5eaa64 bellard
ifndef CONFIG_SOFTMMU
536 5fafdf24 ths
VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld
537 de5eaa64 bellard
endif
538 83fb7adf bellard
ifndef CONFIG_DARWIN
539 11d9f695 bellard
ifndef CONFIG_WIN32
540 ec530c81 bellard
ifndef CONFIG_SOLARIS
541 70956b77 ths
VL_LIBS+=-lutil
542 11d9f695 bellard
endif
543 83fb7adf bellard
endif
544 ec530c81 bellard
endif
545 e3086fbf bellard
ifdef TARGET_GPROF
546 6f30fa85 ths
vl.o: BASE_CFLAGS+=-p
547 e3086fbf bellard
VL_LDFLAGS+=-p
548 e3086fbf bellard
endif
549 c321f673 bellard
550 b8076a74 bellard
ifeq ($(ARCH),ia64)
551 b8076a74 bellard
VL_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
552 b8076a74 bellard
endif
553 b8076a74 bellard
554 74ccb34e bellard
ifeq ($(ARCH),sparc64)
555 3142255c blueswir1
  VL_LDFLAGS+=-m64
556 3142255c blueswir1
  ifneq ($(CONFIG_SOLARIS),yes)
557 3142255c blueswir1
    VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
558 3142255c blueswir1
  endif
559 74ccb34e bellard
endif
560 74ccb34e bellard
561 1d14ffa9 bellard
ifdef CONFIG_WIN32
562 1d14ffa9 bellard
SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
563 1d14ffa9 bellard
endif
564 1d14ffa9 bellard
565 4fb240a4 bellard
$(QEMU_SYSTEM): $(VL_OBJS) ../libqemu_common.a libqemu.a
566 3a11702b pbrook
	$(CC) $(VL_LDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
567 5b0753e0 bellard
568 626df76a bellard
depend: $(SRCS)
569 6f30fa85 ths
	$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
570 626df76a bellard
571 1d14ffa9 bellard
vldepend: $(VL_OBJS:.o=.c)
572 6f30fa85 ths
	$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
573 1d14ffa9 bellard
574 5fafdf24 ths
# libqemu
575 626df76a bellard
576 626df76a bellard
libqemu.a: $(LIBOBJS)
577 626df76a bellard
	rm -f $@
578 626df76a bellard
	$(AR) rcs $@ $(LIBOBJS)
579 626df76a bellard
580 1e43adfc bellard
translate.o: translate.c gen-op.h opc.h cpu.h
581 626df76a bellard
582 158142c2 bellard
translate-all.o: translate-all.c opc.h cpu.h
583 158142c2 bellard
584 158142c2 bellard
translate-op.o: translate-all.c op.h opc.h cpu.h
585 626df76a bellard
586 1e43adfc bellard
op.h: op.o $(DYNGEN)
587 626df76a bellard
	$(DYNGEN) -o $@ $<
588 626df76a bellard
589 1e43adfc bellard
opc.h: op.o $(DYNGEN)
590 626df76a bellard
	$(DYNGEN) -c -o $@ $<
591 626df76a bellard
592 1e43adfc bellard
gen-op.h: op.o $(DYNGEN)
593 626df76a bellard
	$(DYNGEN) -g -o $@ $<
594 626df76a bellard
595 1e43adfc bellard
op.o: op.c
596 6f30fa85 ths
	$(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $<
597 626df76a bellard
598 6e1b3e4d bellard
# HELPER_CFLAGS is used for all the code compiled with static register
599 6e1b3e4d bellard
# variables
600 6e1b3e4d bellard
ifeq ($(TARGET_BASE_ARCH), i386)
601 6e1b3e4d bellard
# XXX: rename helper.c to op_helper.c
602 1e43adfc bellard
helper.o: helper.c
603 6f30fa85 ths
	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
604 6e1b3e4d bellard
else
605 6e1b3e4d bellard
op_helper.o: op_helper.c
606 6f30fa85 ths
	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
607 6e1b3e4d bellard
endif
608 6e1b3e4d bellard
609 6e1b3e4d bellard
cpu-exec.o: cpu-exec.c
610 6f30fa85 ths
	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
611 626df76a bellard
612 00a67ba1 bellard
# Note: this is a workaround. The real fix is to avoid compiling
613 00a67ba1 bellard
# cpu_signal_handler() in cpu-exec.c.
614 00a67ba1 bellard
signal.o: signal.c
615 6f30fa85 ths
	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
616 00a67ba1 bellard
617 626df76a bellard
%.o: %.c
618 6f30fa85 ths
	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
619 626df76a bellard
620 f72b519c bellard
%.o: %.S
621 6f30fa85 ths
	$(CC) $(CPPFLAGS) -c -o $@ $<
622 f72b519c bellard
623 626df76a bellard
clean:
624 4fb240a4 bellard
	rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o fpu/*.o
625 2f96c28d j_mayer
	rm -f *.d */*.d
626 1e43adfc bellard
627 5fafdf24 ths
install: all
628 9b14bb04 bellard
ifneq ($(PROGS),)
629 6a882643 pbrook
	$(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
630 9b14bb04 bellard
endif
631 626df76a bellard
632 626df76a bellard
ifneq ($(wildcard .depend),)
633 626df76a bellard
include .depend
634 626df76a bellard
endif
635 1d14ffa9 bellard
636 c0fe3827 bellard
ifeq (1, 0)
637 1d14ffa9 bellard
audio.o sdlaudio.o dsoundaudio.o ossaudio.o wavaudio.o noaudio.o \
638 c0fe3827 bellard
fmodaudio.o alsaaudio.o mixeng.o sb16.o es1370.o gus.o adlib.o: \
639 1d14ffa9 bellard
CFLAGS := $(CFLAGS) -Wall -Werror -W -Wsign-compare
640 1d14ffa9 bellard
endif
641 2f96c28d j_mayer
642 2f96c28d j_mayer
# Include automatically generated dependency files
643 2f96c28d j_mayer
-include $(wildcard *.d */*.d)