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