Statistics
| Branch: | Revision:

root / Makefile.target @ 8a0ef219

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 faf07963 pbrook
CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MP -DNEED_CPU_H
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 8a0ef219 ths
  ifneq ($(CONFIG_SOLARIS),yes)
144 8a0ef219 ths
    BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
145 8a0ef219 ths
  endif
146 bc51c5c9 bellard
endif
147 bc51c5c9 bellard
148 626df76a bellard
ifeq ($(ARCH),ppc)
149 6f30fa85 ths
CPPFLAGS+= -D__powerpc__
150 6f30fa85 ths
BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
151 626df76a bellard
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 579a97f7 bellard
      elfload.o linuxload.o uaccess.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 faf07963 pbrook
VL_OBJS+=block-raw.o
402 a541f297 bellard
403 1d14ffa9 bellard
ifdef CONFIG_ALSA
404 1d14ffa9 bellard
LIBS += -lasound
405 1d14ffa9 bellard
endif
406 1d14ffa9 bellard
ifdef CONFIG_DSOUND
407 1d14ffa9 bellard
LIBS += -lole32 -ldxguid
408 85571bc7 bellard
endif
409 102a52e4 bellard
ifdef CONFIG_FMOD
410 102a52e4 bellard
LIBS += $(CONFIG_FMOD_LIB)
411 85571bc7 bellard
endif
412 4fb240a4 bellard
413 4fb240a4 bellard
SOUND_HW = sb16.o es1370.o
414 1d14ffa9 bellard
ifdef CONFIG_ADLIB
415 1d14ffa9 bellard
SOUND_HW += fmopl.o adlib.o
416 1d14ffa9 bellard
endif
417 85571bc7 bellard
418 8d5d2d4c ths
ifdef CONFIG_VNC_TLS
419 8d5d2d4c ths
CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
420 8d5d2d4c ths
LIBS += $(CONFIG_VNC_TLS_LIBS)
421 8d5d2d4c ths
endif
422 8d5d2d4c ths
423 2e5d83bb pbrook
# SCSI layer
424 87ecb68b pbrook
VL_OBJS+= lsi53c895a.o
425 2e5d83bb pbrook
426 a594cfbf bellard
# USB layer
427 87ecb68b pbrook
VL_OBJS+= usb-ohci.o
428 a594cfbf bellard
429 663e8e51 ths
# EEPROM emulation
430 663e8e51 ths
VL_OBJS += eeprom93xx.o
431 663e8e51 ths
432 a41b2ff2 pbrook
# PCI network cards
433 663e8e51 ths
VL_OBJS += eepro100.o
434 663e8e51 ths
VL_OBJS += ne2000.o
435 663e8e51 ths
VL_OBJS += pcnet.o
436 663e8e51 ths
VL_OBJS += rtl8139.o
437 a41b2ff2 pbrook
438 0b0babc6 bellard
ifeq ($(TARGET_BASE_ARCH), i386)
439 a541f297 bellard
# Hardware support
440 4fb240a4 bellard
VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o
441 fd06c375 bellard
VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
442 b00052e4 balrog
VL_OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o
443 87ecb68b pbrook
VL_OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o
444 b00052e4 balrog
CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
445 67b915a5 bellard
endif
446 a2458627 bellard
ifeq ($(TARGET_BASE_ARCH), ppc)
447 b00052e4 balrog
CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
448 3cbee15b j_mayer
# shared objects
449 4fb240a4 bellard
VL_OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o
450 3cbee15b j_mayer
# PREP target
451 3cbee15b j_mayer
VL_OBJS+= pckbd.o ps2.o serial.o i8259.o i8254.o fdc.o m48t59.o mc146818rtc.o
452 3cbee15b j_mayer
VL_OBJS+= prep_pci.o ppc_prep.o
453 3cbee15b j_mayer
# Mac shared devices
454 3cbee15b j_mayer
VL_OBJS+= macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o
455 3cbee15b j_mayer
# OldWorld PowerMac
456 3cbee15b j_mayer
VL_OBJS+= heathrow_pic.o grackle_pci.o ppc_oldworld.o
457 3cbee15b j_mayer
# NewWorld PowerMac
458 3cbee15b j_mayer
VL_OBJS+= unin_pci.o ppc_chrp.o
459 3cbee15b j_mayer
# PowerPC 4xx boards
460 3cbee15b j_mayer
VL_OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc405_uc.o ppc405_boards.o
461 a541f297 bellard
endif
462 fbe4f65b ths
ifeq ($(TARGET_BASE_ARCH), mips)
463 6bf5b4e8 ths
VL_OBJS+= mips_r4k.o mips_malta.o mips_pica61.o mips_mipssim.o
464 ad6fe1d2 ths
VL_OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o
465 31211df1 ths
VL_OBJS+= jazz_led.o
466 9542611a ths
VL_OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
467 87ecb68b pbrook
VL_OBJS+= piix_pci.o parallel.o cirrus_vga.o $(SOUND_HW)
468 6bf5b4e8 ths
VL_OBJS+= mipsnet.o
469 83b1fb88 ths
CPPFLAGS += -DHAS_AUDIO
470 6af0bf9c bellard
endif
471 e7daa605 ths
ifeq ($(TARGET_BASE_ARCH), cris)
472 e7daa605 ths
VL_OBJS+= etraxfs.o
473 e7daa605 ths
VL_OBJS+= ptimer.o
474 e7daa605 ths
VL_OBJS+= etraxfs_timer.o
475 e7daa605 ths
VL_OBJS+= etraxfs_ser.o
476 e7daa605 ths
endif
477 64b3ab24 bellard
ifeq ($(TARGET_BASE_ARCH), sparc)
478 3475187d bellard
ifeq ($(TARGET_ARCH), sparc64)
479 502a5395 pbrook
VL_OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o
480 83469015 bellard
VL_OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o
481 20c9f095 blueswir1
VL_OBJS+= cirrus_vga.o parallel.o ptimer.o
482 3475187d bellard
else
483 67e999be bellard
VL_OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o
484 67e999be bellard
VL_OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o esp.o sparc32_dma.o
485 8d05ea8a blueswir1
VL_OBJS+= cs4231.o ptimer.o
486 3475187d bellard
endif
487 e95c8d51 bellard
endif
488 b5ff1b31 bellard
ifeq ($(TARGET_BASE_ARCH), arm)
489 cdbdb648 pbrook
VL_OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o
490 7e1543c2 pbrook
VL_OBJS+= arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
491 6963d7af pbrook
VL_OBJS+= versatile_pci.o sd.o ptimer.o
492 9ee6e8bb pbrook
VL_OBJS+= realview_gic.o realview.o arm_sysctl.o mpcore.o
493 87ecb68b pbrook
VL_OBJS+= armv7m.o armv7m_nvic.o stellaris.o pl022.o
494 87ecb68b pbrook
VL_OBJS+= pl061.o
495 8e71621f pbrook
VL_OBJS+= arm-semi.o
496 b00052e4 balrog
VL_OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
497 87ecb68b pbrook
VL_OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o
498 05ee37eb balrog
VL_OBJS+= pflash_cfi01.o gumstix.o
499 87ecb68b pbrook
VL_OBJS+= spitz.o ide.o serial.o nand.o ecc.o
500 02645926 balrog
VL_OBJS+= omap.o omap_lcdc.o omap1_clk.o omap_mmc.o omap_i2c.o
501 02645926 balrog
VL_OBJS+= palm.o tsc210x.o
502 5a1237c4 balrog
CPPFLAGS += -DHAS_AUDIO
503 b5ff1b31 bellard
endif
504 fdf9b3e8 bellard
ifeq ($(TARGET_BASE_ARCH), sh4)
505 0d78f544 ths
VL_OBJS+= shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
506 80f515e6 balrog
VL_OBJS+= sh_timer.o ptimer.o sh_serial.o sh_intc.o
507 fdf9b3e8 bellard
endif
508 0633879f pbrook
ifeq ($(TARGET_BASE_ARCH), m68k)
509 7e049b8a pbrook
VL_OBJS+= an5206.o mcf5206.o ptimer.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
510 ca02f319 pbrook
VL_OBJS+= m68k-semi.o dummy_m68k.o
511 0633879f pbrook
endif
512 a541f297 bellard
ifdef CONFIG_GDBSTUB
513 5fafdf24 ths
VL_OBJS+=gdbstub.o
514 728c9fd5 bellard
endif
515 5b0753e0 bellard
ifdef CONFIG_COCOA
516 1d14ffa9 bellard
COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
517 1d14ffa9 bellard
ifdef CONFIG_COREAUDIO
518 1d14ffa9 bellard
COCOA_LIBS+=-framework CoreAudio
519 1d14ffa9 bellard
endif
520 5b0753e0 bellard
endif
521 7c1f25b4 bellard
ifdef CONFIG_SLIRP
522 6f30fa85 ths
CPPFLAGS+=-I$(SRC_PATH)/slirp
523 626df76a bellard
endif
524 626df76a bellard
525 db8d7dd1 ths
VL_LDFLAGS=$(VL_OS_LDFLAGS)
526 70956b77 ths
VL_LIBS=$(AIOLIBS)
527 c321f673 bellard
# specific flags are needed for non soft mmu emulator
528 c321f673 bellard
ifdef CONFIG_STATIC
529 c321f673 bellard
VL_LDFLAGS+=-static
530 c321f673 bellard
endif
531 de5eaa64 bellard
ifndef CONFIG_SOFTMMU
532 5fafdf24 ths
VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld
533 de5eaa64 bellard
endif
534 83fb7adf bellard
ifndef CONFIG_DARWIN
535 11d9f695 bellard
ifndef CONFIG_WIN32
536 ec530c81 bellard
ifndef CONFIG_SOLARIS
537 70956b77 ths
VL_LIBS+=-lutil
538 11d9f695 bellard
endif
539 83fb7adf bellard
endif
540 ec530c81 bellard
endif
541 e3086fbf bellard
ifdef TARGET_GPROF
542 6f30fa85 ths
vl.o: BASE_CFLAGS+=-p
543 e3086fbf bellard
VL_LDFLAGS+=-p
544 e3086fbf bellard
endif
545 c321f673 bellard
546 b8076a74 bellard
ifeq ($(ARCH),ia64)
547 b8076a74 bellard
VL_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
548 b8076a74 bellard
endif
549 b8076a74 bellard
550 74ccb34e bellard
ifeq ($(ARCH),sparc64)
551 3142255c blueswir1
  VL_LDFLAGS+=-m64
552 3142255c blueswir1
  ifneq ($(CONFIG_SOLARIS),yes)
553 3142255c blueswir1
    VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
554 3142255c blueswir1
  endif
555 8a0ef219 ths
endif
556 8a0ef219 ths
557 8a0ef219 ths
ifeq ($(ARCH),x86_64)
558 8a0ef219 ths
  VL_LDFLAGS+=-m64
559 8a0ef219 ths
  ifneq ($(CONFIG_SOLARIS),yes)
560 8a0ef219 ths
    VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
561 8a0ef219 ths
  endif
562 74ccb34e bellard
endif
563 74ccb34e bellard
564 1d14ffa9 bellard
ifdef CONFIG_WIN32
565 1d14ffa9 bellard
SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
566 1d14ffa9 bellard
endif
567 1d14ffa9 bellard
568 4fb240a4 bellard
$(QEMU_SYSTEM): $(VL_OBJS) ../libqemu_common.a libqemu.a
569 3a11702b pbrook
	$(CC) $(VL_LDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
570 5b0753e0 bellard
571 626df76a bellard
depend: $(SRCS)
572 6f30fa85 ths
	$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
573 626df76a bellard
574 1d14ffa9 bellard
vldepend: $(VL_OBJS:.o=.c)
575 6f30fa85 ths
	$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
576 1d14ffa9 bellard
577 5fafdf24 ths
# libqemu
578 626df76a bellard
579 626df76a bellard
libqemu.a: $(LIBOBJS)
580 626df76a bellard
	rm -f $@
581 626df76a bellard
	$(AR) rcs $@ $(LIBOBJS)
582 626df76a bellard
583 1e43adfc bellard
translate.o: translate.c gen-op.h opc.h cpu.h
584 626df76a bellard
585 158142c2 bellard
translate-all.o: translate-all.c opc.h cpu.h
586 158142c2 bellard
587 158142c2 bellard
translate-op.o: translate-all.c op.h opc.h cpu.h
588 626df76a bellard
589 1e43adfc bellard
op.h: op.o $(DYNGEN)
590 626df76a bellard
	$(DYNGEN) -o $@ $<
591 626df76a bellard
592 1e43adfc bellard
opc.h: op.o $(DYNGEN)
593 626df76a bellard
	$(DYNGEN) -c -o $@ $<
594 626df76a bellard
595 1e43adfc bellard
gen-op.h: op.o $(DYNGEN)
596 626df76a bellard
	$(DYNGEN) -g -o $@ $<
597 626df76a bellard
598 1e43adfc bellard
op.o: op.c
599 6f30fa85 ths
	$(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $<
600 626df76a bellard
601 6e1b3e4d bellard
# HELPER_CFLAGS is used for all the code compiled with static register
602 6e1b3e4d bellard
# variables
603 6e1b3e4d bellard
ifeq ($(TARGET_BASE_ARCH), i386)
604 6e1b3e4d bellard
# XXX: rename helper.c to op_helper.c
605 1e43adfc bellard
helper.o: helper.c
606 6f30fa85 ths
	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
607 6e1b3e4d bellard
else
608 6e1b3e4d bellard
op_helper.o: op_helper.c
609 6f30fa85 ths
	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
610 6e1b3e4d bellard
endif
611 6e1b3e4d bellard
612 6e1b3e4d bellard
cpu-exec.o: cpu-exec.c
613 6f30fa85 ths
	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
614 626df76a bellard
615 00a67ba1 bellard
# Note: this is a workaround. The real fix is to avoid compiling
616 00a67ba1 bellard
# cpu_signal_handler() in cpu-exec.c.
617 00a67ba1 bellard
signal.o: signal.c
618 6f30fa85 ths
	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
619 00a67ba1 bellard
620 626df76a bellard
%.o: %.c
621 6f30fa85 ths
	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
622 626df76a bellard
623 f72b519c bellard
%.o: %.S
624 6f30fa85 ths
	$(CC) $(CPPFLAGS) -c -o $@ $<
625 f72b519c bellard
626 626df76a bellard
clean:
627 4fb240a4 bellard
	rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o fpu/*.o
628 2f96c28d j_mayer
	rm -f *.d */*.d
629 1e43adfc bellard
630 5fafdf24 ths
install: all
631 9b14bb04 bellard
ifneq ($(PROGS),)
632 6a882643 pbrook
	$(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
633 9b14bb04 bellard
endif
634 626df76a bellard
635 626df76a bellard
ifneq ($(wildcard .depend),)
636 626df76a bellard
include .depend
637 626df76a bellard
endif
638 1d14ffa9 bellard
639 c0fe3827 bellard
ifeq (1, 0)
640 1d14ffa9 bellard
audio.o sdlaudio.o dsoundaudio.o ossaudio.o wavaudio.o noaudio.o \
641 c0fe3827 bellard
fmodaudio.o alsaaudio.o mixeng.o sb16.o es1370.o gus.o adlib.o: \
642 1d14ffa9 bellard
CFLAGS := $(CFLAGS) -Wall -Werror -W -Wsign-compare
643 1d14ffa9 bellard
endif
644 2f96c28d j_mayer
645 2f96c28d j_mayer
# Include automatically generated dependency files
646 2f96c28d j_mayer
-include $(wildcard *.d */*.d)