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