]>
Commit | Line | Data |
---|---|---|
626df76a | 1 | include config.mak |
17759187 | 2 | include $(SRC_PATH)/rules.mak |
626df76a | 3 | |
0b0babc6 FB |
4 | TARGET_BASE_ARCH:=$(TARGET_ARCH) |
5 | ifeq ($(TARGET_ARCH), x86_64) | |
6 | TARGET_BASE_ARCH:=i386 | |
7 | endif | |
540635ba TS |
8 | ifeq ($(TARGET_ARCH), mipsn32) |
9 | TARGET_BASE_ARCH:=mips | |
10 | endif | |
fbe4f65b TS |
11 | ifeq ($(TARGET_ARCH), mips64) |
12 | TARGET_BASE_ARCH:=mips | |
13 | endif | |
a2458627 FB |
14 | ifeq ($(TARGET_ARCH), ppc64) |
15 | TARGET_BASE_ARCH:=ppc | |
16 | endif | |
22f8a8b3 JM |
17 | ifeq ($(TARGET_ARCH), ppc64h) |
18 | TARGET_BASE_ARCH:=ppc | |
19 | endif | |
d4082e95 JM |
20 | ifeq ($(TARGET_ARCH), ppcemb) |
21 | TARGET_BASE_ARCH:=ppc | |
22 | endif | |
64b3ab24 FB |
23 | ifeq ($(TARGET_ARCH), sparc64) |
24 | TARGET_BASE_ARCH:=sparc | |
25 | endif | |
0b0babc6 | 26 | TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH) |
4fb240a4 | 27 | VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw |
46dc3881 | 28 | CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MT $@ -MP -DNEED_CPU_H |
0b0babc6 | 29 | #CFLAGS+=-Werror |
626df76a | 30 | LIBS= |
1e43adfc | 31 | # user emulator name |
0c64b9cd | 32 | ifndef TARGET_ARCH2 |
c91fde65 | 33 | TARGET_ARCH2=$(TARGET_ARCH) |
0c64b9cd | 34 | endif |
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 |
540635ba TS |
50 | ifeq ($(TARGET_ARCH),mipsn32) |
51 | ifneq ($(TARGET_WORDS_BIGENDIAN),yes) | |
52 | TARGET_ARCH2=mipsn32el | |
53 | endif | |
54 | endif | |
fbe4f65b TS |
55 | ifeq ($(TARGET_ARCH),mips64) |
56 | ifneq ($(TARGET_WORDS_BIGENDIAN),yes) | |
57 | TARGET_ARCH2=mips64el | |
58 | endif | |
59 | endif | |
40293e58 FB |
60 | |
61 | ifdef CONFIG_USER_ONLY | |
62 | # user emulator name | |
63 | QEMU_PROG=qemu-$(TARGET_ARCH2) | |
64 | else | |
1e43adfc | 65 | # system emulator name |
a541f297 | 66 | ifeq ($(TARGET_ARCH), i386) |
40293e58 | 67 | QEMU_PROG=qemu$(EXESUF) |
0db63474 | 68 | else |
40293e58 | 69 | QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF) |
a541f297 | 70 | endif |
de5eaa64 | 71 | endif |
626df76a | 72 | |
40293e58 | 73 | PROGS=$(QEMU_PROG) |
626df76a | 74 | |
6c041c54 | 75 | # cc-option |
c7328801 | 76 | # Usage: CFLAGS+=$(call cc-option, $(CFLAGS), -falign-functions=0, -malign-functions=0) |
6c041c54 | 77 | |
c7328801 AL |
78 | cc-option = $(shell if $(CC) $(1) $(2) -S -o /dev/null -xc /dev/null \ |
79 | > /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi ;) | |
6f30fa85 | 80 | |
40293e58 FB |
81 | HELPER_CFLAGS= |
82 | ||
626df76a | 83 | ifeq ($(ARCH),i386) |
6f30fa85 | 84 | HELPER_CFLAGS+=-fomit-frame-pointer |
bc51c5c9 FB |
85 | endif |
86 | ||
d19076fa | 87 | ifeq ($(subst ppc64,ppc,$(ARCH))$(TARGET_BASE_ARCH),ppcppc) |
88 | translate.o: CFLAGS := $(CFLAGS) $(call cc-option, $(CFLAGS), -fno-unit-at-a-time,) | |
89 | endif | |
90 | ||
626df76a | 91 | ifeq ($(ARCH),sparc) |
c7328801 | 92 | ifneq ($(CONFIG_SOLARIS),yes) |
40293e58 | 93 | HELPER_CFLAGS+=-ffixed-i0 |
3142255c | 94 | endif |
fdbb4691 | 95 | endif |
626df76a | 96 | |
626df76a | 97 | ifeq ($(ARCH),alpha) |
626df76a | 98 | # Ensure there's only a single GP |
40293e58 | 99 | CFLAGS+=-msmall-data |
626df76a FB |
100 | endif |
101 | ||
f54b3f92 | 102 | ifeq ($(ARCH),hppa) |
f54b3f92 AJ |
103 | BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld |
104 | endif | |
105 | ||
626df76a | 106 | ifeq ($(ARCH),ia64) |
40293e58 | 107 | CFLAGS+=-mno-sdata |
83fb7adf FB |
108 | endif |
109 | ||
40293e58 FB |
110 | CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS) |
111 | LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS) | |
626df76a | 112 | |
6f30fa85 | 113 | CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE |
626df76a | 114 | LIBS+=-lm |
67b915a5 | 115 | ifdef CONFIG_WIN32 |
3db38e87 | 116 | LIBS+=-lwinmm -lws2_32 -liphlpapi |
67b915a5 | 117 | endif |
ec530c81 FB |
118 | ifdef CONFIG_SOLARIS |
119 | LIBS+=-lsocket -lnsl -lresolv | |
0475a5ca TS |
120 | ifdef NEEDS_LIBSUNMATH |
121 | LIBS+=-lsunmath | |
122 | LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib | |
40293e58 | 123 | CFLAGS+=-I/opt/SUNWspro/prod/include/cc |
f72b519c | 124 | endif |
831b7825 TS |
125 | endif |
126 | ||
7ba1e619 AL |
127 | kvm.o: CFLAGS+=$(KVM_CFLAGS) |
128 | kvm-all.o: CFLAGS+=$(KVM_CFLAGS) | |
129 | ||
40293e58 | 130 | all: $(PROGS) |
626df76a | 131 | |
40293e58 | 132 | ######################################################### |
626df76a | 133 | # cpu emulator library |
57fec1fe | 134 | LIBOBJS=exec.o kqemu.o translate-all.o cpu-exec.o\ |
cf2be984 | 135 | translate.o host-utils.o |
57fec1fe | 136 | # TCG code generator |
49516bc0 | 137 | LIBOBJS+= tcg/tcg.o tcg/tcg-runtime.o |
57fec1fe | 138 | CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH) |
8289b279 BS |
139 | ifeq ($(ARCH),sparc64) |
140 | CPPFLAGS+=-I$(SRC_PATH)/tcg/sparc | |
141 | endif | |
158142c2 FB |
142 | ifdef CONFIG_SOFTFLOAT |
143 | LIBOBJS+=fpu/softfloat.o | |
144 | else | |
145 | LIBOBJS+=fpu/softfloat-native.o | |
146 | endif | |
6f30fa85 | 147 | CPPFLAGS+=-I$(SRC_PATH)/fpu |
e95c8d51 | 148 | LIBOBJS+= op_helper.o helper.o |
e95c8d51 | 149 | |
b7bcbe95 | 150 | ifeq ($(TARGET_BASE_ARCH), arm) |
eaa728ee | 151 | LIBOBJS+= neon_helper.o iwmmxt_helper.o |
e6e5906b PB |
152 | endif |
153 | ||
cf6c1b16 | 154 | ifeq ($(TARGET_BASE_ARCH), alpha) |
eaa728ee | 155 | LIBOBJS+= alpha_palcode.o |
cf6c1b16 JM |
156 | endif |
157 | ||
e7daa605 | 158 | ifeq ($(TARGET_BASE_ARCH), cris) |
e7daa605 TS |
159 | LIBOBJS+= cris-dis.o |
160 | ||
161 | ifndef CONFIG_USER_ONLY | |
162 | LIBOBJS+= mmu.o | |
163 | endif | |
164 | endif | |
165 | ||
626df76a | 166 | # NOTE: the disassembler code is only needed for debugging |
5fafdf24 | 167 | LIBOBJS+=disas.o |
626df76a | 168 | ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386) |
bc51c5c9 FB |
169 | USE_I386_DIS=y |
170 | endif | |
0b0babc6 | 171 | ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64) |
bc51c5c9 FB |
172 | USE_I386_DIS=y |
173 | endif | |
174 | ifdef USE_I386_DIS | |
626df76a FB |
175 | LIBOBJS+=i386-dis.o |
176 | endif | |
177 | ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha) | |
178 | LIBOBJS+=alpha-dis.o | |
179 | endif | |
a2458627 | 180 | ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc) |
626df76a FB |
181 | LIBOBJS+=ppc-dis.o |
182 | endif | |
fbe4f65b | 183 | ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips) |
6af0bf9c FB |
184 | LIBOBJS+=mips-dis.o |
185 | endif | |
64b3ab24 | 186 | ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc) |
626df76a FB |
187 | LIBOBJS+=sparc-dis.o |
188 | endif | |
189 | ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm) | |
190 | LIBOBJS+=arm-dis.o | |
191 | endif | |
48024e4a FB |
192 | ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k) |
193 | LIBOBJS+=m68k-dis.o | |
194 | endif | |
fdf9b3e8 FB |
195 | ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4) |
196 | LIBOBJS+=sh4-dis.o | |
197 | endif | |
f54b3f92 AJ |
198 | ifeq ($(findstring hppa, $(TARGET_BASE_ARCH) $(ARCH)),hppa) |
199 | LIBOBJS+=hppa-dis.o | |
200 | endif | |
8f860bb8 TS |
201 | ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390) |
202 | LIBOBJS+=s390-dis.o | |
203 | endif | |
626df76a | 204 | |
40293e58 FB |
205 | # libqemu |
206 | ||
207 | libqemu.a: $(LIBOBJS) | |
40293e58 | 208 | |
86e840ee | 209 | translate.o: translate.c cpu.h |
40293e58 | 210 | |
86e840ee | 211 | translate-all.o: translate-all.c cpu.h |
40293e58 | 212 | |
86e840ee | 213 | tcg/tcg.o: cpu.h |
40293e58 FB |
214 | |
215 | # HELPER_CFLAGS is used for all the code compiled with static register | |
216 | # variables | |
807544e2 | 217 | op_helper.o: CFLAGS += $(HELPER_CFLAGS) $(I386_CFLAGS) |
40293e58 | 218 | |
807544e2 | 219 | cpu-exec.o: CFLAGS += $(HELPER_CFLAGS) |
40293e58 FB |
220 | |
221 | ######################################################### | |
222 | # Linux user emulator target | |
223 | ||
224 | ifdef CONFIG_LINUX_USER | |
225 | ||
40293e58 FB |
226 | ifndef TARGET_ABI_DIR |
227 | TARGET_ABI_DIR=$(TARGET_ARCH) | |
228 | endif | |
3ebdd119 | 229 | VPATH+=:$(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) |
40293e58 FB |
230 | CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) |
231 | ||
232 | ifdef CONFIG_STATIC | |
233 | LDFLAGS+=-static | |
234 | endif | |
235 | ||
236 | ifeq ($(ARCH),i386) | |
237 | ifdef TARGET_GPROF | |
238 | USE_I386_LD=y | |
239 | endif | |
240 | ifdef CONFIG_STATIC | |
241 | USE_I386_LD=y | |
242 | endif | |
243 | ifdef USE_I386_LD | |
244 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
245 | else | |
246 | # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object | |
247 | # that the kernel ELF loader considers as an executable. I think this | |
248 | # is the simplest way to make it self virtualizable! | |
249 | LDFLAGS+=-Wl,-shared | |
250 | endif | |
251 | endif | |
252 | ||
253 | ifeq ($(ARCH),x86_64) | |
254 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
255 | endif | |
256 | ||
257 | ifeq ($(ARCH),ppc) | |
258 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
259 | endif | |
260 | ||
810260a8 | 261 | ifeq ($(ARCH),ppc64) |
262 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
263 | endif | |
264 | ||
40293e58 FB |
265 | ifeq ($(ARCH),s390) |
266 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
267 | endif | |
268 | ||
269 | ifeq ($(ARCH),sparc) | |
270 | # -static is used to avoid g1/g3 usage by the dynamic linker | |
271 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static | |
272 | endif | |
273 | ||
274 | ifeq ($(ARCH),sparc64) | |
275 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
276 | endif | |
277 | ||
278 | ifeq ($(ARCH),alpha) | |
279 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
280 | endif | |
281 | ||
282 | ifeq ($(ARCH),ia64) | |
283 | LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
284 | endif | |
285 | ||
286 | ifeq ($(ARCH),arm) | |
287 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
288 | endif | |
289 | ||
290 | ifeq ($(ARCH),m68k) | |
291 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
292 | endif | |
293 | ||
294 | ifeq ($(ARCH),mips) | |
295 | ifeq ($(WORDS_BIGENDIAN),yes) | |
296 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
297 | else | |
298 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld | |
299 | endif | |
300 | endif | |
301 | ||
302 | ifeq ($(ARCH),mips64) | |
303 | ifeq ($(WORDS_BIGENDIAN),yes) | |
304 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
305 | else | |
306 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld | |
307 | endif | |
308 | endif | |
309 | ||
6d946cda AJ |
310 | # profiling code |
311 | ifdef TARGET_GPROF | |
312 | LDFLAGS+=-p | |
313 | CFLAGS+=-p | |
314 | endif | |
315 | ||
17e2377a | 316 | OBJS= main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \ |
04a6dfeb | 317 | elfload.o linuxload.o uaccess.o envlist.o |
40293e58 FB |
318 | LIBS+= $(AIOLIBS) |
319 | ifdef TARGET_HAS_BFLT | |
320 | OBJS+= flatload.o | |
321 | endif | |
322 | ifdef TARGET_HAS_ELFLOAD32 | |
323 | OBJS+= elfload32.o | |
324 | elfload32.o: elfload.c | |
325 | endif | |
326 | ||
327 | ifeq ($(TARGET_ARCH), i386) | |
328 | OBJS+= vm86.o | |
329 | endif | |
330 | ifeq ($(TARGET_ARCH), arm) | |
331 | OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \ | |
332 | nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \ | |
333 | nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o | |
334 | endif | |
335 | ifeq ($(TARGET_ARCH), m68k) | |
336 | OBJS+= m68k-sim.o m68k-semi.o | |
337 | endif | |
338 | ||
1fddef4b | 339 | ifdef CONFIG_GDBSTUB |
56aebc89 | 340 | OBJS+=gdbstub.o gdbstub-xml.o |
1fddef4b | 341 | endif |
626df76a | 342 | |
40293e58 FB |
343 | OBJS+= libqemu.a |
344 | ||
345 | # Note: this is a workaround. The real fix is to avoid compiling | |
346 | # cpu_signal_handler() in cpu-exec.c. | |
807544e2 | 347 | signal.o: CFLAGS += $(HELPER_CFLAGS) |
626df76a | 348 | |
cec7d0b6 | 349 | $(QEMU_PROG): $(OBJS) ../libqemu_user.a |
3aa892d7 | 350 | $(LINK) |
626df76a FB |
351 | ifeq ($(ARCH),alpha) |
352 | # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of | |
353 | # the address space (31 bit so sign extending doesn't matter) | |
354 | echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc | |
355 | endif | |
356 | ||
40293e58 FB |
357 | endif #CONFIG_LINUX_USER |
358 | ||
359 | ######################################################### | |
360 | # Darwin user emulator target | |
361 | ||
362 | ifdef CONFIG_DARWIN_USER | |
363 | ||
364 | VPATH+=:$(SRC_PATH)/darwin-user | |
365 | CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH) | |
366 | ||
367 | # Leave some space for the regular program loading zone | |
368 | LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000 | |
369 | ||
370 | LIBS+=-lmx | |
371 | ||
17e2377a | 372 | OBJS= main.o commpage.o machload.o mmap.o signal.o syscall.o thunk.o |
40293e58 FB |
373 | |
374 | OBJS+= libqemu.a | |
375 | ||
376 | ifdef CONFIG_GDBSTUB | |
56aebc89 | 377 | OBJS+=gdbstub.o gdbstub-xml.o |
40293e58 FB |
378 | endif |
379 | ||
380 | # Note: this is a workaround. The real fix is to avoid compiling | |
381 | # cpu_signal_handler() in cpu-exec.c. | |
807544e2 | 382 | signal.o: CFLAGS += $(HELPER_CFLAGS) |
40293e58 FB |
383 | |
384 | $(QEMU_PROG): $(OBJS) | |
3aa892d7 | 385 | $(LINK) |
40293e58 FB |
386 | |
387 | endif #CONFIG_DARWIN_USER | |
388 | ||
84778508 BS |
389 | ######################################################### |
390 | # BSD user emulator target | |
391 | ||
392 | ifdef CONFIG_BSD_USER | |
393 | ||
394 | VPATH+=:$(SRC_PATH)/bsd-user | |
395 | CPPFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH) | |
396 | ||
397 | ifdef CONFIG_STATIC | |
398 | LDFLAGS+=-static | |
399 | endif | |
400 | ||
401 | ifeq ($(ARCH),i386) | |
402 | ifdef TARGET_GPROF | |
403 | USE_I386_LD=y | |
404 | endif | |
405 | ifdef CONFIG_STATIC | |
406 | USE_I386_LD=y | |
407 | endif | |
408 | ifdef USE_I386_LD | |
409 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
410 | else | |
411 | # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object | |
412 | # that the kernel ELF loader considers as an executable. I think this | |
413 | # is the simplest way to make it self virtualizable! | |
414 | LDFLAGS+=-Wl,-shared | |
415 | endif | |
416 | endif | |
417 | ||
418 | ifeq ($(ARCH),x86_64) | |
419 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
420 | endif | |
421 | ||
422 | ifeq ($(ARCH),ppc) | |
423 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
424 | endif | |
425 | ||
426 | ifeq ($(ARCH),ppc64) | |
427 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
428 | endif | |
429 | ||
430 | ifeq ($(ARCH),s390) | |
431 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
432 | endif | |
433 | ||
434 | ifeq ($(ARCH),sparc) | |
435 | # -static is used to avoid g1/g3 usage by the dynamic linker | |
436 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static | |
437 | endif | |
438 | ||
439 | ifeq ($(ARCH),sparc64) | |
440 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
441 | endif | |
442 | ||
443 | ifeq ($(ARCH),alpha) | |
444 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
445 | endif | |
446 | ||
447 | ifeq ($(ARCH),ia64) | |
448 | LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
449 | endif | |
450 | ||
451 | ifeq ($(ARCH),arm) | |
452 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
453 | endif | |
454 | ||
455 | ifeq ($(ARCH),m68k) | |
456 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
457 | endif | |
458 | ||
459 | ifeq ($(ARCH),mips) | |
460 | ifeq ($(WORDS_BIGENDIAN),yes) | |
461 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
462 | else | |
463 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld | |
464 | endif | |
465 | endif | |
466 | ||
467 | ifeq ($(ARCH),mips64) | |
468 | ifeq ($(WORDS_BIGENDIAN),yes) | |
469 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
470 | else | |
471 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld | |
472 | endif | |
473 | endif | |
474 | ||
475 | OBJS= main.o bsdload.o elfload.o mmap.o path.o signal.o strace.o syscall.o | |
476 | OBJS+= uaccess.o | |
477 | ||
478 | OBJS+= libqemu.a | |
479 | ||
480 | ifdef CONFIG_GDBSTUB | |
481 | OBJS+=gdbstub.o | |
482 | endif | |
483 | ||
484 | # Note: this is a workaround. The real fix is to avoid compiling | |
485 | # cpu_signal_handler() in cpu-exec.c. | |
807544e2 | 486 | signal.o: CFLAGS += $(HELPER_CFLAGS) |
84778508 BS |
487 | |
488 | $(QEMU_PROG): $(OBJS) ../libqemu_user.a | |
3aa892d7 | 489 | $(LINK) |
84778508 BS |
490 | |
491 | endif #CONFIG_BSD_USER | |
492 | ||
40293e58 FB |
493 | ######################################################### |
494 | # System emulator target | |
495 | ifndef CONFIG_USER_ONLY | |
496 | ||
244ab90e | 497 | OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o dma-helpers.o |
1fd31ad7 AL |
498 | # virtio has to be here due to weird dependency between PCI and virtio-net. |
499 | # need to fix this properly | |
9ede2fde | 500 | OBJS+=virtio.o virtio-blk.o virtio-balloon.o virtio-net.o virtio-console.o |
559b90fb | 501 | OBJS+=fw_cfg.o |
7ba1e619 AL |
502 | ifdef CONFIG_KVM |
503 | OBJS+=kvm.o kvm-all.o | |
504 | endif | |
223d4670 | 505 | ifdef CONFIG_WIN32 |
40293e58 | 506 | OBJS+=block-raw-win32.o |
223d4670 | 507 | else |
3c529d93 AL |
508 | ifdef CONFIG_AIO |
509 | OBJS+=posix-aio-compat.o | |
510 | endif | |
559b90fb | 511 | OBJS+=block-raw-posix.o |
a3392f9b AL |
512 | endif |
513 | ||
40293e58 | 514 | LIBS+=-lz |
1d14ffa9 | 515 | ifdef CONFIG_ALSA |
1d14ffa9 FB |
516 | LIBS += -lasound |
517 | endif | |
ca9cc28c AZ |
518 | ifdef CONFIG_ESD |
519 | LIBS += -lesd | |
520 | endif | |
b8e59f18 | 521 | ifdef CONFIG_PA |
522 | LIBS += -lpulse-simple | |
523 | endif | |
1d14ffa9 | 524 | ifdef CONFIG_DSOUND |
1d14ffa9 | 525 | LIBS += -lole32 -ldxguid |
85571bc7 | 526 | endif |
102a52e4 | 527 | ifdef CONFIG_FMOD |
102a52e4 | 528 | LIBS += $(CONFIG_FMOD_LIB) |
85571bc7 | 529 | endif |
2f6a1ab0 BS |
530 | ifdef CONFIG_OSS |
531 | LIBS += $(CONFIG_OSS_LIB) | |
532 | endif | |
4fb240a4 | 533 | |
b0f3b8fa | 534 | SOUND_HW = sb16.o es1370.o ac97.o |
1d14ffa9 FB |
535 | ifdef CONFIG_ADLIB |
536 | SOUND_HW += fmopl.o adlib.o | |
c40e866f | 537 | adlib.o fmopl.o: CFLAGS := ${CFLAGS} -DBUILD_Y8950=0 |
1d14ffa9 | 538 | endif |
423d65f4 AZ |
539 | ifdef CONFIG_GUS |
540 | SOUND_HW += gus.o gusemu_hal.o gusemu_mixer.o | |
541 | endif | |
cc53d26d | 542 | ifdef CONFIG_CS4231A |
543 | SOUND_HW += cs4231a.o | |
544 | endif | |
85571bc7 | 545 | |
8d5d2d4c TS |
546 | ifdef CONFIG_VNC_TLS |
547 | CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS) | |
548 | LIBS += $(CONFIG_VNC_TLS_LIBS) | |
549 | endif | |
550 | ||
2f9606b3 AL |
551 | ifdef CONFIG_VNC_SASL |
552 | CPPFLAGS += $(CONFIG_VNC_SASL_CFLAGS) | |
553 | LIBS += $(CONFIG_VNC_SASL_LIBS) | |
554 | endif | |
555 | ||
fb599c9a AZ |
556 | ifdef CONFIG_BLUEZ |
557 | LIBS += $(CONFIG_BLUEZ_LIBS) | |
558 | endif | |
559 | ||
2e5d83bb | 560 | # SCSI layer |
8b17de88 | 561 | OBJS+= lsi53c895a.o esp.o |
2e5d83bb | 562 | |
a594cfbf | 563 | # USB layer |
40293e58 | 564 | OBJS+= usb-ohci.o |
a594cfbf | 565 | |
663e8e51 | 566 | # EEPROM emulation |
40293e58 | 567 | OBJS += eeprom93xx.o |
663e8e51 | 568 | |
a41b2ff2 | 569 | # PCI network cards |
40293e58 FB |
570 | OBJS += eepro100.o |
571 | OBJS += ne2000.o | |
572 | OBJS += pcnet.o | |
573 | OBJS += rtl8139.o | |
7c23b892 | 574 | OBJS += e1000.o |
a41b2ff2 | 575 | |
aa71cf80 AJ |
576 | # Serial mouse |
577 | OBJS += msmouse.o | |
578 | ||
0b0babc6 | 579 | ifeq ($(TARGET_BASE_ARCH), i386) |
a541f297 | 580 | # Hardware support |
40293e58 FB |
581 | OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o |
582 | OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o | |
610626af | 583 | OBJS+= cirrus_vga.o apic.o ioapic.o parallel.o acpi.o piix_pci.o |
16b29ae1 | 584 | OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o |
6f338c34 | 585 | OBJS += device-hotplug.o pci-hotplug.o |
b00052e4 | 586 | CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE |
67b915a5 | 587 | endif |
a2458627 | 588 | ifeq ($(TARGET_BASE_ARCH), ppc) |
70ad3dec | 589 | CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE |
3cbee15b | 590 | # shared objects |
40293e58 | 591 | OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o |
3cbee15b | 592 | # PREP target |
40293e58 FB |
593 | OBJS+= pckbd.o ps2.o serial.o i8259.o i8254.o fdc.o m48t59.o mc146818rtc.o |
594 | OBJS+= prep_pci.o ppc_prep.o | |
3cbee15b | 595 | # Mac shared devices |
7fa9ae1a | 596 | OBJS+= macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o escc.o |
3cbee15b | 597 | # OldWorld PowerMac |
40293e58 | 598 | OBJS+= heathrow_pic.o grackle_pci.o ppc_oldworld.o |
3cbee15b | 599 | # NewWorld PowerMac |
b98a003c | 600 | OBJS+= unin_pci.o ppc_newworld.o |
3cbee15b | 601 | # PowerPC 4xx boards |
825bb581 | 602 | OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o |
2c9fade2 | 603 | OBJS+= ppc440.o ppc440_bamboo.o |
74c62ba8 | 604 | # PowerPC E500 boards |
1db09b84 | 605 | OBJS+= ppce500_pci.o ppce500_mpc8544ds.o |
f652e6af AJ |
606 | ifdef FDT_LIBS |
607 | OBJS+= device_tree.o | |
608 | LIBS+= $(FDT_LIBS) | |
609 | endif | |
d76d1650 AJ |
610 | ifdef CONFIG_KVM |
611 | OBJS+= kvm_ppc.o | |
612 | endif | |
a541f297 | 613 | endif |
fbe4f65b | 614 | ifeq ($(TARGET_BASE_ARCH), mips) |
c171148c | 615 | OBJS+= mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o |
4ce7ff6e AJ |
616 | OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o rc4030.o |
617 | OBJS+= g364fb.o jazz_led.o | |
40293e58 | 618 | OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o |
4ce7ff6e | 619 | OBJS+= piix_pci.o parallel.o cirrus_vga.o pcspk.o $(SOUND_HW) |
40293e58 FB |
620 | OBJS+= mipsnet.o |
621 | OBJS+= pflash_cfi01.o | |
1f605a76 | 622 | OBJS+= vmware_vga.o |
4ce7ff6e | 623 | CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE |
6af0bf9c | 624 | endif |
e7daa605 | 625 | ifeq ($(TARGET_BASE_ARCH), cris) |
10c144e2 EI |
626 | # Boards |
627 | OBJS+= etraxfs.o axis_dev88.o | |
628 | ||
629 | # IO blocks | |
48318011 | 630 | OBJS+= etraxfs_dma.o |
e62b5b13 | 631 | OBJS+= etraxfs_pic.o |
48318011 | 632 | OBJS+= etraxfs_eth.o |
40293e58 FB |
633 | OBJS+= etraxfs_timer.o |
634 | OBJS+= etraxfs_ser.o | |
e62b5b13 EI |
635 | |
636 | OBJS+= ptimer.o | |
10c144e2 | 637 | OBJS+= pflash_cfi02.o nand.o |
e7daa605 | 638 | endif |
64b3ab24 | 639 | ifeq ($(TARGET_BASE_ARCH), sparc) |
3475187d | 640 | ifeq ($(TARGET_ARCH), sparc64) |
40293e58 FB |
641 | OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o |
642 | OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o | |
643 | OBJS+= cirrus_vga.o parallel.o ptimer.o | |
3475187d | 644 | else |
40293e58 | 645 | OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o |
2aa2ab3a | 646 | OBJS+= slavio_timer.o escc.o slavio_misc.o fdc.o sparc32_dma.o |
40293e58 | 647 | OBJS+= cs4231.o ptimer.o eccmemctl.o sbi.o sun4c_intctl.o |
3475187d | 648 | endif |
e95c8d51 | 649 | endif |
b5ff1b31 | 650 | ifeq ($(TARGET_BASE_ARCH), arm) |
40293e58 FB |
651 | OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o |
652 | OBJS+= arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o | |
653 | OBJS+= versatile_pci.o ptimer.o | |
654 | OBJS+= realview_gic.o realview.o arm_sysctl.o mpcore.o | |
655 | OBJS+= armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o | |
656 | OBJS+= pl061.o | |
657 | OBJS+= arm-semi.o | |
658 | OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o | |
659 | OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o | |
660 | OBJS+= pflash_cfi01.o gumstix.o | |
88d2c950 | 661 | OBJS+= zaurus.o ide.o serial.o nand.o ecc.o spitz.o tosa.o tc6393xb.o |
b4e3104b | 662 | OBJS+= omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o |
afbb5194 | 663 | OBJS+= omap2.o omap_dss.o soc_dma.o |
997641a8 | 664 | OBJS+= omap_sx1.o palm.o tsc210x.o |
942ac052 | 665 | OBJS+= nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o |
58a26b47 | 666 | OBJS+= tsc2005.o bt-hci-csr.o |
40293e58 | 667 | OBJS+= mst_fpga.o mainstone.o |
24859b68 | 668 | OBJS+= musicpal.o pflash_cfi02.o |
714fa308 | 669 | OBJS+= framebuffer.o |
5a1237c4 | 670 | CPPFLAGS += -DHAS_AUDIO |
b5ff1b31 | 671 | endif |
fdf9b3e8 | 672 | ifeq ($(TARGET_BASE_ARCH), sh4) |
40293e58 | 673 | OBJS+= shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o |
1e5459a3 | 674 | OBJS+= sh_timer.o ptimer.o sh_serial.o sh_intc.o sh_pci.o sm501.o serial.o |
a4a771c0 | 675 | OBJS+= ide.o |
fdf9b3e8 | 676 | endif |
0633879f | 677 | ifeq ($(TARGET_BASE_ARCH), m68k) |
40293e58 FB |
678 | OBJS+= an5206.o mcf5206.o ptimer.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o |
679 | OBJS+= m68k-semi.o dummy_m68k.o | |
0633879f | 680 | endif |
a541f297 | 681 | ifdef CONFIG_GDBSTUB |
56aebc89 | 682 | OBJS+=gdbstub.o gdbstub-xml.o |
728c9fd5 | 683 | endif |
5b0753e0 | 684 | ifdef CONFIG_COCOA |
1d14ffa9 FB |
685 | COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit |
686 | ifdef CONFIG_COREAUDIO | |
687 | COCOA_LIBS+=-framework CoreAudio | |
688 | endif | |
5b0753e0 | 689 | endif |
7c1f25b4 | 690 | ifdef CONFIG_SLIRP |
6f30fa85 | 691 | CPPFLAGS+=-I$(SRC_PATH)/slirp |
626df76a FB |
692 | endif |
693 | ||
40293e58 | 694 | LIBS+=$(AIOLIBS) |
c321f673 | 695 | # specific flags are needed for non soft mmu emulator |
c321f673 | 696 | ifdef CONFIG_STATIC |
40293e58 | 697 | LDFLAGS+=-static |
de5eaa64 | 698 | endif |
83fb7adf | 699 | ifndef CONFIG_DARWIN |
11d9f695 | 700 | ifndef CONFIG_WIN32 |
ec530c81 | 701 | ifndef CONFIG_SOLARIS |
b29fe3ed | 702 | ifndef CONFIG_AIX |
40293e58 | 703 | LIBS+=-lutil |
11d9f695 | 704 | endif |
b29fe3ed | 705 | endif |
83fb7adf | 706 | endif |
ec530c81 | 707 | endif |
e3086fbf | 708 | ifdef TARGET_GPROF |
40293e58 FB |
709 | vl.o: CFLAGS+=-p |
710 | LDFLAGS+=-p | |
e3086fbf | 711 | endif |
c321f673 | 712 | |
b8076a74 | 713 | ifeq ($(ARCH),ia64) |
40293e58 | 714 | LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld |
74ccb34e FB |
715 | endif |
716 | ||
1d14ffa9 FB |
717 | ifdef CONFIG_WIN32 |
718 | SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole | |
719 | endif | |
720 | ||
40293e58 FB |
721 | # profiling code |
722 | ifdef TARGET_GPROF | |
723 | LDFLAGS+=-p | |
724 | main.o: CFLAGS+=-p | |
6e1b3e4d FB |
725 | endif |
726 | ||
5824d651 BS |
727 | vl.o: qemu-options.h |
728 | ||
3aa892d7 AL |
729 | $(QEMU_PROG): LIBS += $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS) |
730 | ||
40293e58 | 731 | $(QEMU_PROG): $(OBJS) ../libqemu_common.a libqemu.a |
3aa892d7 | 732 | $(LINK) |
626df76a | 733 | |
40293e58 | 734 | endif # !CONFIG_USER_ONLY |
00a67ba1 | 735 | |
56aebc89 | 736 | gdbstub-xml.c: $(TARGET_XML_FILES) feature_to_c.sh |
56aebc89 | 737 | ifeq ($(TARGET_XML_FILES),) |
1aef4c57 | 738 | $(call quiet-command,rm -f $@ && echo > $@," GEN $(TARGET_DIR)$@") |
56aebc89 | 739 | else |
1aef4c57 | 740 | $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/feature_to_c.sh $@ $(TARGET_XML_FILES)," GEN $(TARGET_DIR)$@") |
56aebc89 PB |
741 | endif |
742 | ||
5824d651 | 743 | qemu-options.h: $(SRC_PATH)/qemu-options.hx |
0d00e563 | 744 | $(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@") |
5824d651 | 745 | |
626df76a | 746 | clean: |
5824d651 | 747 | rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o qemu-options.h |
57fec1fe | 748 | rm -f *.d */*.d tcg/*.o |
1e43adfc | 749 | |
5fafdf24 | 750 | install: all |
9b14bb04 | 751 | ifneq ($(PROGS),) |
6a882643 | 752 | $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)" |
9b14bb04 | 753 | endif |
626df76a | 754 | |
2f96c28d JM |
755 | # Include automatically generated dependency files |
756 | -include $(wildcard *.d */*.d) |