Statistics
| Branch: | Revision:

root / Makefile.target @ d0bdf2a2

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