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