Make --mem-path memory allocation depend on mmu notifiers
[qemu-kvm/amd-iommu.git] / Makefile.target
blob5e1b936b3ead95334d96cf9f62ea9e242880362a
1 CFLAGS=
2 LDFLAGS=
4 include config.mak
6 LDFLAGS_BASE:=$(LDFLAGS)
7 TARGET_BASE_ARCH:=$(TARGET_ARCH)
8 ifeq ($(TARGET_ARCH), x86_64)
9 TARGET_BASE_ARCH:=i386
10 endif
11 ifeq ($(TARGET_ARCH), mipsn32)
12 TARGET_BASE_ARCH:=mips
13 endif
14 ifeq ($(TARGET_ARCH), mips64)
15 TARGET_BASE_ARCH:=mips
16 endif
17 ifeq ($(TARGET_ARCH), ppc64)
18 TARGET_BASE_ARCH:=ppc
19 endif
20 ifeq ($(TARGET_ARCH), ppc64h)
21 TARGET_BASE_ARCH:=ppc
22 endif
23 ifeq ($(TARGET_ARCH), ppcemb)
24 TARGET_BASE_ARCH:=ppc
25 endif
26 ifeq ($(TARGET_ARCH), sparc64)
27 TARGET_BASE_ARCH:=sparc
28 endif
29 ifeq ($(TARGET_ARCH), ia64)
30 TARGET_BASE_ARCH:=ia64
31 endif
32 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
33 VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw
34 CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MT $@ -MP -DNEED_CPU_H
35 #CFLAGS+=-Werror
36 LIBS=
37 # user emulator name
38 ifndef TARGET_ARCH2
39 TARGET_ARCH2=$(TARGET_ARCH)
40 endif
41 ifeq ($(TARGET_ARCH),arm)
42   ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
43     TARGET_ARCH2=armeb
44   endif
45 endif
46 ifeq ($(TARGET_ARCH),sh4)
47   ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
48     TARGET_ARCH2=sh4eb
49   endif
50 endif
51 ifeq ($(TARGET_ARCH),mips)
52   ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
53     TARGET_ARCH2=mipsel
54   endif
55 endif
56 ifeq ($(TARGET_ARCH),mipsn32)
57   ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
58     TARGET_ARCH2=mipsn32el
59   endif
60 endif
61 ifeq ($(TARGET_ARCH),mips64)
62   ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
63     TARGET_ARCH2=mips64el
64   endif
65 endif
67 ifdef CONFIG_USER_ONLY
68 # user emulator name
69 QEMU_PROG=qemu-$(TARGET_ARCH2)
70 else
71 # system emulator name
72 ifeq ($(TARGET_ARCH), i386)
73 QEMU_PROG=qemu$(EXESUF)
74 else
75 QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF)
76 endif
77 endif
79 PROGS=$(QEMU_PROG)
81 # We require -O2 to avoid the stack setup prologue in EXIT_TB
82 OP_CFLAGS := -O2 -g -fno-strict-aliasing
83 OP_CFLAGS += -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls
85 # cc-option
86 # Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0)
88 cc-option = $(shell if $(CC) $(OP_CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
89               > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
91 OP_CFLAGS+=$(call cc-option, -fno-reorder-blocks, "")
92 OP_CFLAGS+=$(call cc-option, -fno-gcse, "")
93 OP_CFLAGS+=$(call cc-option, -fno-tree-ch, "")
94 OP_CFLAGS+=$(call cc-option, -fno-optimize-sibling-calls, "")
95 OP_CFLAGS+=$(call cc-option, -fno-crossjumping, "")
96 OP_CFLAGS+=$(call cc-option, -fno-align-labels, "")
97 OP_CFLAGS+=$(call cc-option, -fno-align-jumps, "")
98 OP_CFLAGS+=$(call cc-option, -fno-align-functions, $(call cc-option, -malign-functions=0, ""))
99 OP_CFLAGS+=$(call cc-option, -fno-section-anchors, "")
101 HELPER_CFLAGS=
103 ifeq ($(ARCH),i386)
104 HELPER_CFLAGS+=-fomit-frame-pointer
105 OP_CFLAGS+=-mpreferred-stack-boundary=2 -fomit-frame-pointer
106 endif
108 ifeq ($(ARCH),sparc)
109   CFLAGS+=-ffixed-g2 -ffixed-g3
110   OP_CFLAGS+=-fno-delayed-branch -ffixed-i0
111   ifeq ($(CONFIG_SOLARIS),yes)
112     OP_CFLAGS+=-fno-omit-frame-pointer
113   else
114     CFLAGS+=-ffixed-g1 -ffixed-g6
115     HELPER_CFLAGS+=-ffixed-i0
116   endif
117 endif
119 ifeq ($(ARCH),sparc64)
120   OP_CFLAGS+=-mcpu=ultrasparc -m64 -fno-delayed-branch -ffixed-i0
121   ifneq ($(CONFIG_SOLARIS),yes)
122     CFLAGS+=-ffixed-g5 -ffixed-g6 -ffixed-g7
123     OP_CFLAGS+=-ffixed-g5 -ffixed-g6 -ffixed-g7
124   else
125     CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
126   endif
127 endif
129 ifeq ($(ARCH),alpha)
130 # -msmall-data is not used for OP_CFLAGS because we want two-instruction
131 # relocations for the constant constructions
132 # Ensure there's only a single GP
133 CFLAGS+=-msmall-data
134 endif
136 ifeq ($(ARCH),hppa)
137 OP_CFLAGS=-O1 -fno-delayed-branch
138 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
139 endif
141 ifeq ($(ARCH),ia64)
142 CFLAGS+=-mno-sdata
143 OP_CFLAGS+=-mno-sdata
144 endif
146 ifeq ($(ARCH),arm)
147 OP_CFLAGS+=-mno-sched-prolog -fno-omit-frame-pointer
148 endif
150 ifeq ($(ARCH),m68k)
151 OP_CFLAGS+=-fomit-frame-pointer
152 endif
154 ifeq ($(ARCH),mips)
155 OP_CFLAGS+=-mabi=32 -G0 -fno-PIC -mno-abicalls -fomit-frame-pointer -fno-delayed-branch -Wa,-O0
156 endif
158 ifeq ($(ARCH),mips64)
159 OP_CFLAGS+=-mabi=n32 -G0 -fno-PIC -mno-abicalls -fomit-frame-pointer -fno-delayed-branch -Wa,-O0
160 endif
162 CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
163 LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS)
164 OP_CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
166 CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__user=
167 LIBS+=-lm
168 ifdef CONFIG_WIN32
169 LIBS+=-lwinmm -lws2_32 -liphlpapi
170 endif
171 ifdef CONFIG_SOLARIS
172 LIBS+=-lsocket -lnsl -lresolv
173 ifdef NEEDS_LIBSUNMATH
174 LIBS+=-lsunmath
175 LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib
176 OP_CFLAGS+=-I/opt/SUNWspro/prod/include/cc
177 CFLAGS+=-I/opt/SUNWspro/prod/include/cc
178 endif
179 endif
181 kvm.o: CFLAGS+=$(KVM_CFLAGS)
182 kvm-all.o: CFLAGS+=$(KVM_CFLAGS)
184 all: $(PROGS)
186 #########################################################
187 # cpu emulator library
188 LIBOBJS=exec.o kqemu.o cpu-exec.o host-utils.o
190 ifeq ($(NO_CPU_EMULATION), 1)
191 LIBOBJS+=fake-exec.o
192 else
193 LIBOBJS+= translate-all.o translate.o
194 # TCG code generator
195 LIBOBJS+= tcg/tcg.o tcg/tcg-runtime.o
196 CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH)
197 endif
198 ifeq ($(ARCH),sparc64)
199 CPPFLAGS+=-I$(SRC_PATH)/tcg/sparc
200 endif
202 ifeq ($(USE_KVM), 1)
203 LIBOBJS+=qemu-kvm.o
204 endif
205 ifdef CONFIG_SOFTFLOAT
206 LIBOBJS+=fpu/softfloat.o
207 else
208 LIBOBJS+=fpu/softfloat-native.o
209 endif
210 CPPFLAGS+=-I$(SRC_PATH)/fpu
211 LIBOBJS+= op_helper.o helper.o
213 ifeq ($(TARGET_ARCH), i386)
214 LIBOBJS+=helper.o
215 ifeq ($(USE_KVM), 1)
216 LIBOBJS+=qemu-kvm-x86.o kvm-tpr-opt.o
217 LIBOBJS+=qemu-kvm-helper.o
218 endif
219 endif
221 ifeq ($(TARGET_ARCH), x86_64)
222 LIBOBJS+=helper.o
223 ifeq ($(USE_KVM), 1)
224 LIBOBJS+=qemu-kvm-x86.o kvm-tpr-opt.o
225 LIBOBJS+=qemu-kvm-helper.o
226 endif
227 endif
229 LIBOBJS+= op_helper.o
231 ifneq ($(TARGET_ARCH), ia64)
232 LIBOBJS+= helper.o
233 endif
235 ifeq ($(TARGET_BASE_ARCH), arm)
236 LIBOBJS+= neon_helper.o iwmmxt_helper.o
237 endif
239 ifeq ($(TARGET_BASE_ARCH), alpha)
240 LIBOBJS+= alpha_palcode.o
241 endif
243 ifeq ($(TARGET_BASE_ARCH), ia64)
244 LIBOBJS+=op_helper.o firmware.o
245 ifeq ($(USE_KVM), 1)
246 LIBOBJS+=qemu-kvm-ia64.o
247 endif
248 endif
250 ifeq ($(TARGET_BASE_ARCH), cris)
251 LIBOBJS+= cris-dis.o
253 ifndef CONFIG_USER_ONLY
254 LIBOBJS+= mmu.o
255 endif
256 endif
259 # NOTE: the disassembler code is only needed for debugging
260 LIBOBJS+=disas.o
261 ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
262 USE_I386_DIS=y
263 endif
264 ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
265 USE_I386_DIS=y
266 endif
267 ifdef USE_I386_DIS
268 LIBOBJS+=i386-dis.o
269 endif
270 ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
271 LIBOBJS+=alpha-dis.o
272 endif
273 ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
274 LIBOBJS+=ppc-dis.o
275 endif
276 ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips)
277 LIBOBJS+=mips-dis.o
278 endif
279 ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
280 LIBOBJS+=sparc-dis.o
281 endif
282 ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
283 LIBOBJS+=arm-dis.o
284 endif
285 ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
286 LIBOBJS+=m68k-dis.o
287 endif
288 ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
289 LIBOBJS+=sh4-dis.o
290 endif
291 ifeq ($(findstring hppa, $(TARGET_BASE_ARCH) $(ARCH)),hppa)
292 LIBOBJS+=hppa-dis.o
293 endif
294 ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390)
295 LIBOBJS+=s390-dis.o
296 endif
298 # libqemu
300 libqemu.a: $(LIBOBJS)
301         rm -f $@
302         $(AR) rcs $@ $(LIBOBJS)
304 translate.o: translate.c cpu.h
306 translate-all.o: translate-all.c cpu.h
308 tcg/tcg.o: cpu.h
310 machine.o: machine.c
311         $(CC) $(OP_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
313 # HELPER_CFLAGS is used for all the code compiled with static register
314 # variables
315 op_helper.o: op_helper.c
316         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) $(I386_CFLAGS) -c -o $@ $<
318 cpu-exec.o: cpu-exec.c
319         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
321 qemu-kvm-helper.o: qemu-kvm-helper.c
322         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
324 #########################################################
325 # Linux user emulator target
327 ifdef CONFIG_LINUX_USER
329 ifndef TARGET_ABI_DIR
330   TARGET_ABI_DIR=$(TARGET_ARCH)
331 endif
332 VPATH+=:$(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
333 CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
335 ifdef CONFIG_STATIC
336 LDFLAGS+=-static
337 endif
339 ifeq ($(ARCH),i386)
340 ifdef TARGET_GPROF
341 USE_I386_LD=y
342 endif
343 ifdef CONFIG_STATIC
344 USE_I386_LD=y
345 endif
346 ifdef USE_I386_LD
347 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
348 else
349 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
350 # that the kernel ELF loader considers as an executable. I think this
351 # is the simplest way to make it self virtualizable!
352 LDFLAGS+=-Wl,-shared
353 endif
354 endif
356 ifeq ($(ARCH),x86_64)
357 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
358 endif
360 ifeq ($(ARCH),ppc)
361 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
362 endif
364 ifeq ($(ARCH),ppc64)
365 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
366 endif
368 ifeq ($(ARCH),s390)
369 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
370 endif
372 ifeq ($(ARCH),sparc)
373 # -static is used to avoid g1/g3 usage by the dynamic linker    
374 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
375 endif
377 ifeq ($(ARCH),sparc64)
378 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
379 endif
381 ifeq ($(ARCH),alpha)
382 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
383 endif
385 ifeq ($(ARCH),ia64)
386 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
387 endif
389 ifeq ($(ARCH),arm)
390 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
391 endif
393 ifeq ($(ARCH),m68k)
394 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
395 endif
397 ifeq ($(ARCH),mips)
398 ifeq ($(WORDS_BIGENDIAN),yes)
399 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
400 else
401 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
402 endif
403 endif
405 ifeq ($(ARCH),mips64)
406 ifeq ($(WORDS_BIGENDIAN),yes)
407 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
408 else
409 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
410 endif
411 endif
413 # profiling code
414 ifdef TARGET_GPROF
415 LDFLAGS+=-p
416 CFLAGS+=-p
417 endif
419 OBJS= main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \
420       elfload.o linuxload.o uaccess.o
421 LIBS+= $(AIOLIBS)
422 ifdef TARGET_HAS_BFLT
423 OBJS+= flatload.o
424 endif
425 ifdef TARGET_HAS_ELFLOAD32
426 OBJS+= elfload32.o
427 elfload32.o: elfload.c
428 endif
430 ifeq ($(TARGET_ARCH), i386)
431 OBJS+= vm86.o
432 endif
433 ifeq ($(TARGET_ARCH), arm)
434 OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
435 nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
436  nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o
437 endif
438 ifeq ($(TARGET_ARCH), m68k)
439 OBJS+= m68k-sim.o m68k-semi.o
440 endif
442 ifdef CONFIG_GDBSTUB
443 OBJS+=gdbstub.o gdbstub-xml.o
444 endif
446 OBJS+= libqemu.a
448 # Note: this is a workaround. The real fix is to avoid compiling
449 # cpu_signal_handler() in cpu-exec.c.
450 signal.o: signal.c
451         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
453 $(QEMU_PROG): $(OBJS) ../libqemu_user.a
454         $(CC) $(LDFLAGS) -o $@ $^  $(LIBS)
455 ifeq ($(ARCH),alpha)
456 # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
457 # the address space (31 bit so sign extending doesn't matter)
458         echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
459 endif
461 endif #CONFIG_LINUX_USER
463 #########################################################
464 # Darwin user emulator target
466 ifdef CONFIG_DARWIN_USER
468 VPATH+=:$(SRC_PATH)/darwin-user
469 CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
471 # Leave some space for the regular program loading zone
472 LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000
474 LIBS+=-lmx
476 OBJS= main.o commpage.o machload.o mmap.o signal.o syscall.o thunk.o
478 OBJS+= libqemu.a
480 ifdef CONFIG_GDBSTUB
481 OBJS+=gdbstub.o gdbstub-xml.o
482 endif
484 # Note: this is a workaround. The real fix is to avoid compiling
485 # cpu_signal_handler() in cpu-exec.c.
486 signal.o: signal.c
487         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
489 $(QEMU_PROG): $(OBJS)
490         $(CC) $(LDFLAGS) -o $@ $^  $(LIBS)
492 endif #CONFIG_DARWIN_USER
494 #########################################################
495 # BSD user emulator target
497 ifdef CONFIG_BSD_USER
499 VPATH+=:$(SRC_PATH)/bsd-user
500 CPPFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
502 ifdef CONFIG_STATIC
503 LDFLAGS+=-static
504 endif
506 ifeq ($(ARCH),i386)
507 ifdef TARGET_GPROF
508 USE_I386_LD=y
509 endif
510 ifdef CONFIG_STATIC
511 USE_I386_LD=y
512 endif
513 ifdef USE_I386_LD
514 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
515 else
516 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
517 # that the kernel ELF loader considers as an executable. I think this
518 # is the simplest way to make it self virtualizable!
519 LDFLAGS+=-Wl,-shared
520 endif
521 endif
523 ifeq ($(ARCH),x86_64)
524 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
525 endif
527 ifeq ($(ARCH),ppc)
528 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
529 endif
531 ifeq ($(ARCH),ppc64)
532 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
533 endif
535 ifeq ($(ARCH),s390)
536 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
537 endif
539 ifeq ($(ARCH),sparc)
540 # -static is used to avoid g1/g3 usage by the dynamic linker
541 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
542 endif
544 ifeq ($(ARCH),sparc64)
545 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
546 endif
548 ifeq ($(ARCH),alpha)
549 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
550 endif
552 ifeq ($(ARCH),ia64)
553 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
554 endif
556 ifeq ($(ARCH),arm)
557 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
558 endif
560 ifeq ($(ARCH),m68k)
561 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
562 endif
564 ifeq ($(ARCH),mips)
565 ifeq ($(WORDS_BIGENDIAN),yes)
566 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
567 else
568 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
569 endif
570 endif
572 ifeq ($(ARCH),mips64)
573 ifeq ($(WORDS_BIGENDIAN),yes)
574 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
575 else
576 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
577 endif
578 endif
580 OBJS= main.o bsdload.o elfload.o mmap.o path.o signal.o strace.o syscall.o
581 OBJS+= uaccess.o
583 OBJS+= libqemu.a
585 ifdef CONFIG_GDBSTUB
586 OBJS+=gdbstub.o
587 endif
589 # Note: this is a workaround. The real fix is to avoid compiling
590 # cpu_signal_handler() in cpu-exec.c.
591 signal.o: signal.c
592         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
594 $(QEMU_PROG): $(OBJS) ../libqemu_user.a
595         $(CC) $(LDFLAGS) -o $@ $^  $(LIBS)
597 endif #CONFIG_BSD_USER
599 #########################################################
600 # System emulator target
601 ifndef CONFIG_USER_ONLY
603 OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o
604 # virtio has to be here due to weird dependency between PCI and virtio-net.
605 # need to fix this properly
606 OBJS+=virtio.o virtio-blk.o virtio-balloon.o virtio-net.o virtio-console.o
607 OBJS+=fw_cfg.o
608 ifdef CONFIG_KVM
609 OBJS+=kvm.o kvm-all.o
610 endif
611 ifdef CONFIG_WIN32
612 OBJS+=block-raw-win32.o
613 else
614 ifdef CONFIG_AIO
615 OBJS+=posix-aio-compat.o
616 endif
617 OBJS+=block-raw-posix.o
618 endif
620 ifdef CONFIG_AIO
621 OBJS+=compatfd.o
622 endif
624 LIBS+=-lz
625 ifdef CONFIG_ALSA
626 LIBS += -lasound
627 endif
628 ifdef CONFIG_ESD
629 LIBS += -lesd
630 endif
631 ifdef CONFIG_PA
632 LIBS += -lpulse-simple
633 endif
634 ifdef CONFIG_DSOUND
635 LIBS += -lole32 -ldxguid
636 endif
637 ifdef CONFIG_FMOD
638 LIBS += $(CONFIG_FMOD_LIB)
639 endif
640 ifdef CONFIG_OSS
641 LIBS += $(CONFIG_OSS_LIB)
642 endif
644 SOUND_HW = sb16.o es1370.o ac97.o
645 ifdef CONFIG_ADLIB
646 SOUND_HW += fmopl.o adlib.o
647 adlib.o fmopl.o: CFLAGS := ${CFLAGS} -DBUILD_Y8950=0
648 endif
649 ifdef CONFIG_GUS
650 SOUND_HW += gus.o gusemu_hal.o gusemu_mixer.o
651 endif
652 ifdef CONFIG_CS4231A
653 SOUND_HW += cs4231a.o
654 endif
656 ifdef CONFIG_KVM_KERNEL_INC
657 CFLAGS += -I $(CONFIG_KVM_KERNEL_INC)
658 LIBS += -lkvm
659 DEPLIBS += ../libkvm/libkvm.a
660 endif
662 ifdef CONFIG_VNC_TLS
663 CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
664 LIBS += $(CONFIG_VNC_TLS_LIBS)
665 endif
667 ifdef CONFIG_BLUEZ
668 LIBS += $(CONFIG_BLUEZ_LIBS)
669 endif
671 # SCSI layer
672 OBJS+= lsi53c895a.o esp.o
674 # USB layer
675 OBJS+= usb-ohci.o
677 # EEPROM emulation
678 OBJS += eeprom93xx.o
680 # PCI network cards
681 OBJS += eepro100.o
682 OBJS += ne2000.o
683 OBJS += pcnet.o
684 OBJS += rtl8139.o
685 OBJS += e1000.o
687 OBJS += device-hotplug.o
689 ifeq ($(USE_KVM_DEVICE_ASSIGNMENT), 1)
690 OBJS+= device-assignment.o
691 endif
693 ifeq ($(TARGET_BASE_ARCH), i386)
694 # Hardware support
695 OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o
696 OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
697 OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o
698 OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
699 OBJS+= extboot.o
700 # virtio support
701 OBJS+= virtio.o virtio-blk.o virtio-balloon.o
702 OBJS += virtio-net.o
703 ifeq ($(USE_KVM_PIT), 1)
704 OBJS+= i8254-kvm.o
705 endif
706 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
707 endif
708 ifeq ($(TARGET_BASE_ARCH), ia64)
709 # Hardware support
710 OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
711 OBJS+= fdc.o mc146818rtc.o serial.o i8259.o ipf.o
712 OBJS+= cirrus_vga.o parallel.o acpi.o piix_pci.o
713 OBJS+= usb-uhci.o smbus_eeprom.o
714 # virtio support
715 OBJS+= virtio.o virtio-blk.o virtio-balloon.o
716 OBJS+= virtio-net.o
717 endif
718 ifeq ($(TARGET_BASE_ARCH), ppc)
719 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
720 # shared objects
721 OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o
722 OBJS+= cirrus_vga.o
723 # PREP target
724 OBJS+= pckbd.o ps2.o serial.o i8259.o i8254.o fdc.o m48t59.o mc146818rtc.o
725 OBJS+= prep_pci.o ppc_prep.o
726 # Mac shared devices
727 OBJS+= macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o escc.o
728 # OldWorld PowerMac
729 OBJS+= heathrow_pic.o grackle_pci.o ppc_oldworld.o
730 # NewWorld PowerMac
731 OBJS+= unin_pci.o ppc_chrp.o
732 # PowerPC 4xx boards
733 OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o
734 OBJS+= ppc440.o ppc440_bamboo.o
735 ifdef FDT_LIBS
736 OBJS+= device_tree.o
737 LIBS+= $(FDT_LIBS)
738 endif
739 ifdef CONFIG_KVM
740 OBJS+= kvm_ppc.o
741 endif
742 endif
743 ifeq ($(TARGET_BASE_ARCH), mips)
744 OBJS+= mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o
745 OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o rc4030.o
746 OBJS+= g364fb.o jazz_led.o
747 OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
748 OBJS+= piix_pci.o parallel.o cirrus_vga.o pcspk.o $(SOUND_HW)
749 OBJS+= mipsnet.o
750 OBJS+= pflash_cfi01.o
751 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
752 endif
753 ifeq ($(TARGET_BASE_ARCH), cris)
754 # Boards
755 OBJS+= etraxfs.o axis_dev88.o
757 # IO blocks
758 OBJS+= etraxfs_dma.o
759 OBJS+= etraxfs_pic.o
760 OBJS+= etraxfs_eth.o
761 OBJS+= etraxfs_timer.o
762 OBJS+= etraxfs_ser.o
764 OBJS+= ptimer.o
765 OBJS+= pflash_cfi02.o nand.o
766 endif
767 ifeq ($(TARGET_BASE_ARCH), sparc)
768 ifeq ($(TARGET_ARCH), sparc64)
769 OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o
770 OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o
771 OBJS+= cirrus_vga.o parallel.o ptimer.o
772 else
773 OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o
774 OBJS+= slavio_timer.o escc.o slavio_misc.o fdc.o sparc32_dma.o
775 OBJS+= cs4231.o ptimer.o eccmemctl.o sbi.o sun4c_intctl.o
776 endif
777 endif
778 ifeq ($(TARGET_BASE_ARCH), arm)
779 OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o
780 OBJS+= arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
781 OBJS+= versatile_pci.o ptimer.o
782 OBJS+= realview_gic.o realview.o arm_sysctl.o mpcore.o
783 OBJS+= armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
784 OBJS+= pl061.o
785 OBJS+= arm-semi.o
786 OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
787 OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
788 OBJS+= pflash_cfi01.o gumstix.o
789 OBJS+= zaurus.o ide.o serial.o nand.o ecc.o spitz.o tosa.o tc6393xb.o
790 OBJS+= omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o
791 OBJS+= omap2.o omap_dss.o soc_dma.o
792 OBJS+= omap_sx1.o palm.o tsc210x.o
793 OBJS+= nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o
794 OBJS+= tsc2005.o bt-hci-csr.o
795 OBJS+= mst_fpga.o mainstone.o
796 OBJS+= musicpal.o pflash_cfi02.o
797 CPPFLAGS += -DHAS_AUDIO
798 endif
799 ifeq ($(TARGET_BASE_ARCH), sh4)
800 OBJS+= shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
801 OBJS+= sh_timer.o ptimer.o sh_serial.o sh_intc.o sh_pci.o sm501.o serial.o
802 OBJS+= ide.o
803 endif
804 ifeq ($(TARGET_BASE_ARCH), m68k)
805 OBJS+= an5206.o mcf5206.o ptimer.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
806 OBJS+= m68k-semi.o dummy_m68k.o
807 endif
808 ifdef CONFIG_GDBSTUB
809 OBJS+=gdbstub.o gdbstub-xml.o
810 endif
811 ifdef CONFIG_COCOA
812 COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
813 ifdef CONFIG_COREAUDIO
814 COCOA_LIBS+=-framework CoreAudio
815 endif
816 endif
817 ifdef CONFIG_SLIRP
818 CPPFLAGS+=-I$(SRC_PATH)/slirp
819 endif
821 LIBS+=$(AIOLIBS)
822 # specific flags are needed for non soft mmu emulator
823 ifdef CONFIG_STATIC
824 LDFLAGS+=-static
825 endif
826 ifndef CONFIG_DARWIN
827 ifndef CONFIG_WIN32
828 ifndef CONFIG_SOLARIS
829 ifndef CONFIG_AIX
830 LIBS+=-lutil
831 endif
832 endif
833 endif
834 endif
835 ifdef TARGET_GPROF
836 vl.o: CFLAGS+=-p
837 LDFLAGS+=-p
838 endif
840 ifeq ($(ARCH),ia64)
841 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
842 endif
844 ifdef CONFIG_WIN32
845 SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
846 endif
848 # profiling code
849 ifdef TARGET_GPROF
850 LDFLAGS+=-p
851 main.o: CFLAGS+=-p
852 endif
853 ifeq ($(TARGET_ARCH), ia64)
854 firmware.o: firmware.c
855         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
856 endif
858 $(QEMU_PROG): $(OBJS) ../libqemu_common.a libqemu.a $(DEPLIBS)
859         $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS)
861 endif # !CONFIG_USER_ONLY
863 gdbstub-xml.c: $(TARGET_XML_FILES) feature_to_c.sh
864         rm -f $@
865 ifeq ($(TARGET_XML_FILES),)
866         echo > $@
867 else
868         $(SHELL) $(SRC_PATH)/feature_to_c.sh $@ $(TARGET_XML_FILES)
869 endif
871 %.o: %.c
872         $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
874 %.o: %.S
875         $(CC) $(CPPFLAGS) -c -o $@ $<
877 clean:
878         rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o
879         rm -f *.d */*.d tcg/*.o
881 install: all
882 ifneq ($(PROGS),)
883         $(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)"
884 endif
886 # Include automatically generated dependency files
887 -include $(wildcard *.d */*.d)