Statistics
| Branch: | Revision:

root / Makefile.target @ 86cc1ce0

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