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