Fix virtio_blk_init() calls
[qemu-kvm/fedora.git] / Makefile.target
blob2b1aa37c940fa046c27a2cae8a7a288a7ffa1886
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),ppc)
109 CPPFLAGS+= -D__powerpc__
110 OP_CFLAGS+= -mlongcall
111 endif
113 ifeq ($(ARCH),sparc)
114   CFLAGS+=-ffixed-g2 -ffixed-g3
115   OP_CFLAGS+=-fno-delayed-branch -ffixed-i0
116   ifeq ($(CONFIG_SOLARIS),yes)
117     OP_CFLAGS+=-fno-omit-frame-pointer
118   else
119     CFLAGS+=-ffixed-g1 -ffixed-g6
120     HELPER_CFLAGS+=-ffixed-i0
121   endif
122 endif
124 ifeq ($(ARCH),sparc64)
125   OP_CFLAGS+=-mcpu=ultrasparc -m64 -fno-delayed-branch -ffixed-i0
126   ifneq ($(CONFIG_SOLARIS),yes)
127     CFLAGS+=-ffixed-g5 -ffixed-g6 -ffixed-g7
128     OP_CFLAGS+=-ffixed-g5 -ffixed-g6 -ffixed-g7
129   else
130     CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
131   endif
132 endif
134 ifeq ($(ARCH),alpha)
135 # -msmall-data is not used for OP_CFLAGS because we want two-instruction
136 # relocations for the constant constructions
137 # Ensure there's only a single GP
138 CFLAGS+=-msmall-data
139 endif
141 ifeq ($(ARCH),hppa)
142 OP_CFLAGS=-O1 -fno-delayed-branch
143 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
144 endif
146 ifeq ($(ARCH),ia64)
147 CFLAGS+=-mno-sdata
148 OP_CFLAGS+=-mno-sdata
149 endif
151 ifeq ($(ARCH),arm)
152 OP_CFLAGS+=-mno-sched-prolog -fno-omit-frame-pointer
153 endif
155 ifeq ($(ARCH),m68k)
156 OP_CFLAGS+=-fomit-frame-pointer
157 endif
159 ifeq ($(ARCH),mips)
160 OP_CFLAGS+=-mabi=32 -G0 -fno-PIC -mno-abicalls -fomit-frame-pointer -fno-delayed-branch -Wa,-O0
161 endif
163 ifeq ($(ARCH),mips64)
164 OP_CFLAGS+=-mabi=n32 -G0 -fno-PIC -mno-abicalls -fomit-frame-pointer -fno-delayed-branch -Wa,-O0
165 endif
167 CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
168 LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS)
169 OP_CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
171 CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__user=
172 LIBS+=-lm
173 ifdef CONFIG_WIN32
174 LIBS+=-lwinmm -lws2_32 -liphlpapi
175 endif
176 ifdef CONFIG_SOLARIS
177 LIBS+=-lsocket -lnsl -lresolv
178 ifdef NEEDS_LIBSUNMATH
179 LIBS+=-lsunmath
180 LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib
181 OP_CFLAGS+=-I/opt/SUNWspro/prod/include/cc
182 CFLAGS+=-I/opt/SUNWspro/prod/include/cc
183 endif
184 endif
186 kvm.o: CFLAGS+=$(KVM_CFLAGS)
187 kvm-all.o: CFLAGS+=$(KVM_CFLAGS)
189 all: $(PROGS)
191 #########################################################
192 # cpu emulator library
193 LIBOBJS=exec.o kqemu.o cpu-exec.o host-utils.o
195 ifeq ($(NO_CPU_EMULATION), 1)
196 LIBOBJS+=fake-exec.o
197 else
198 LIBOBJS+= translate-all.o translate.o
199 # TCG code generator
200 LIBOBJS+= tcg/tcg.o tcg/tcg-runtime.o
201 CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH)
202 endif
203 ifeq ($(ARCH),sparc64)
204 CPPFLAGS+=-I$(SRC_PATH)/tcg/sparc
205 endif
207 ifeq ($(USE_KVM), 1)
208 LIBOBJS+=qemu-kvm.o
209 endif
210 ifdef CONFIG_SOFTFLOAT
211 LIBOBJS+=fpu/softfloat.o
212 else
213 LIBOBJS+=fpu/softfloat-native.o
214 endif
215 CPPFLAGS+=-I$(SRC_PATH)/fpu
216 LIBOBJS+= op_helper.o helper.o
218 ifeq ($(TARGET_ARCH), i386)
219 LIBOBJS+=helper.o
220 ifeq ($(USE_KVM), 1)
221 LIBOBJS+=qemu-kvm-x86.o kvm-tpr-opt.o
222 LIBOBJS+=qemu-kvm-helper.o
223 endif
224 endif
226 ifeq ($(TARGET_ARCH), x86_64)
227 LIBOBJS+=helper.o
228 ifeq ($(USE_KVM), 1)
229 LIBOBJS+=qemu-kvm-x86.o kvm-tpr-opt.o
230 LIBOBJS+=qemu-kvm-helper.o
231 endif
232 endif
234 LIBOBJS+= op_helper.o
236 ifneq ($(TARGET_ARCH), ia64)
237 LIBOBJS+= helper.o
238 endif
240 ifeq ($(TARGET_BASE_ARCH), arm)
241 LIBOBJS+= neon_helper.o iwmmxt_helper.o
242 endif
244 ifeq ($(TARGET_BASE_ARCH), alpha)
245 LIBOBJS+= alpha_palcode.o
246 endif
248 ifeq ($(TARGET_BASE_ARCH), ia64)
249 LIBOBJS+=op_helper.o firmware.o
250 ifeq ($(USE_KVM), 1)
251 LIBOBJS+=qemu-kvm-ia64.o
252 endif
253 endif
255 ifeq ($(TARGET_BASE_ARCH), cris)
256 LIBOBJS+= cris-dis.o
258 ifndef CONFIG_USER_ONLY
259 LIBOBJS+= mmu.o
260 endif
261 endif
264 # NOTE: the disassembler code is only needed for debugging
265 LIBOBJS+=disas.o
266 ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
267 USE_I386_DIS=y
268 endif
269 ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
270 USE_I386_DIS=y
271 endif
272 ifdef USE_I386_DIS
273 LIBOBJS+=i386-dis.o
274 endif
275 ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
276 LIBOBJS+=alpha-dis.o
277 endif
278 ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
279 LIBOBJS+=ppc-dis.o
280 endif
281 ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips)
282 LIBOBJS+=mips-dis.o
283 endif
284 ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
285 LIBOBJS+=sparc-dis.o
286 endif
287 ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
288 LIBOBJS+=arm-dis.o
289 endif
290 ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
291 LIBOBJS+=m68k-dis.o
292 endif
293 ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
294 LIBOBJS+=sh4-dis.o
295 endif
296 ifeq ($(findstring hppa, $(TARGET_BASE_ARCH) $(ARCH)),hppa)
297 LIBOBJS+=hppa-dis.o
298 endif
299 ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390)
300 LIBOBJS+=s390-dis.o
301 endif
303 # libqemu
305 libqemu.a: $(LIBOBJS)
306         rm -f $@
307         $(AR) rcs $@ $(LIBOBJS)
309 translate.o: translate.c cpu.h
311 translate-all.o: translate-all.c cpu.h
313 tcg/tcg.o: cpu.h
315 machine.o: machine.c
316         $(CC) $(OP_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
318 # HELPER_CFLAGS is used for all the code compiled with static register
319 # variables
320 op_helper.o: op_helper.c
321         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) $(I386_CFLAGS) -c -o $@ $<
323 cpu-exec.o: cpu-exec.c
324         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
326 qemu-kvm-helper.o: qemu-kvm-helper.c
327         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
329 #########################################################
330 # Linux user emulator target
332 ifdef CONFIG_LINUX_USER
334 ifndef TARGET_ABI_DIR
335   TARGET_ABI_DIR=$(TARGET_ARCH)
336 endif
337 VPATH+=:$(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
338 CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
340 ifdef CONFIG_STATIC
341 LDFLAGS+=-static
342 endif
344 ifeq ($(ARCH),i386)
345 ifdef TARGET_GPROF
346 USE_I386_LD=y
347 endif
348 ifdef CONFIG_STATIC
349 USE_I386_LD=y
350 endif
351 ifdef USE_I386_LD
352 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
353 else
354 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
355 # that the kernel ELF loader considers as an executable. I think this
356 # is the simplest way to make it self virtualizable!
357 LDFLAGS+=-Wl,-shared
358 endif
359 endif
361 ifeq ($(ARCH),x86_64)
362 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
363 endif
365 ifeq ($(ARCH),ppc)
366 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
367 endif
369 ifeq ($(ARCH),ppc64)
370 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
371 endif
373 ifeq ($(ARCH),s390)
374 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
375 endif
377 ifeq ($(ARCH),sparc)
378 # -static is used to avoid g1/g3 usage by the dynamic linker    
379 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
380 endif
382 ifeq ($(ARCH),sparc64)
383 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
384 endif
386 ifeq ($(ARCH),alpha)
387 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
388 endif
390 ifeq ($(ARCH),ia64)
391 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
392 endif
394 ifeq ($(ARCH),arm)
395 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
396 endif
398 ifeq ($(ARCH),m68k)
399 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
400 endif
402 ifeq ($(ARCH),mips)
403 ifeq ($(WORDS_BIGENDIAN),yes)
404 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
405 else
406 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
407 endif
408 endif
410 ifeq ($(ARCH),mips64)
411 ifeq ($(WORDS_BIGENDIAN),yes)
412 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
413 else
414 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
415 endif
416 endif
418 # profiling code
419 ifdef TARGET_GPROF
420 LDFLAGS+=-p
421 CFLAGS+=-p
422 endif
424 OBJS= main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \
425       elfload.o linuxload.o uaccess.o
426 LIBS+= $(AIOLIBS)
427 ifdef TARGET_HAS_BFLT
428 OBJS+= flatload.o
429 endif
430 ifdef TARGET_HAS_ELFLOAD32
431 OBJS+= elfload32.o
432 elfload32.o: elfload.c
433 endif
435 ifeq ($(TARGET_ARCH), i386)
436 OBJS+= vm86.o
437 endif
438 ifeq ($(TARGET_ARCH), arm)
439 OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
440 nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
441  nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o
442 endif
443 ifeq ($(TARGET_ARCH), m68k)
444 OBJS+= m68k-sim.o m68k-semi.o
445 endif
447 ifdef CONFIG_GDBSTUB
448 OBJS+=gdbstub.o gdbstub-xml.o
449 endif
451 OBJS+= libqemu.a
453 # Note: this is a workaround. The real fix is to avoid compiling
454 # cpu_signal_handler() in cpu-exec.c.
455 signal.o: signal.c
456         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
458 $(QEMU_PROG): $(OBJS) ../libqemu_user.a
459         $(CC) $(LDFLAGS) -o $@ $^  $(LIBS)
460 ifeq ($(ARCH),alpha)
461 # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
462 # the address space (31 bit so sign extending doesn't matter)
463         echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
464 endif
466 endif #CONFIG_LINUX_USER
468 #########################################################
469 # Darwin user emulator target
471 ifdef CONFIG_DARWIN_USER
473 VPATH+=:$(SRC_PATH)/darwin-user
474 CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
476 # Leave some space for the regular program loading zone
477 LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000
479 LIBS+=-lmx
481 OBJS= main.o commpage.o machload.o mmap.o signal.o syscall.o thunk.o
483 OBJS+= libqemu.a
485 ifdef CONFIG_GDBSTUB
486 OBJS+=gdbstub.o gdbstub-xml.o
487 endif
489 # Note: this is a workaround. The real fix is to avoid compiling
490 # cpu_signal_handler() in cpu-exec.c.
491 signal.o: signal.c
492         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
494 $(QEMU_PROG): $(OBJS)
495         $(CC) $(LDFLAGS) -o $@ $^  $(LIBS)
497 endif #CONFIG_DARWIN_USER
499 #########################################################
500 # BSD user emulator target
502 ifdef CONFIG_BSD_USER
504 VPATH+=:$(SRC_PATH)/bsd-user
505 CPPFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
507 ifdef CONFIG_STATIC
508 LDFLAGS+=-static
509 endif
511 ifeq ($(ARCH),i386)
512 ifdef TARGET_GPROF
513 USE_I386_LD=y
514 endif
515 ifdef CONFIG_STATIC
516 USE_I386_LD=y
517 endif
518 ifdef USE_I386_LD
519 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
520 else
521 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
522 # that the kernel ELF loader considers as an executable. I think this
523 # is the simplest way to make it self virtualizable!
524 LDFLAGS+=-Wl,-shared
525 endif
526 endif
528 ifeq ($(ARCH),x86_64)
529 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
530 endif
532 ifeq ($(ARCH),ppc)
533 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
534 endif
536 ifeq ($(ARCH),ppc64)
537 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
538 endif
540 ifeq ($(ARCH),s390)
541 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
542 endif
544 ifeq ($(ARCH),sparc)
545 # -static is used to avoid g1/g3 usage by the dynamic linker
546 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
547 endif
549 ifeq ($(ARCH),sparc64)
550 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
551 endif
553 ifeq ($(ARCH),alpha)
554 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
555 endif
557 ifeq ($(ARCH),ia64)
558 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
559 endif
561 ifeq ($(ARCH),arm)
562 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
563 endif
565 ifeq ($(ARCH),m68k)
566 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
567 endif
569 ifeq ($(ARCH),mips)
570 ifeq ($(WORDS_BIGENDIAN),yes)
571 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
572 else
573 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
574 endif
575 endif
577 ifeq ($(ARCH),mips64)
578 ifeq ($(WORDS_BIGENDIAN),yes)
579 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
580 else
581 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
582 endif
583 endif
585 OBJS= main.o bsdload.o elfload.o mmap.o path.o signal.o strace.o syscall.o
586 OBJS+= uaccess.o
588 OBJS+= libqemu.a
590 ifdef CONFIG_GDBSTUB
591 OBJS+=gdbstub.o
592 endif
594 # Note: this is a workaround. The real fix is to avoid compiling
595 # cpu_signal_handler() in cpu-exec.c.
596 signal.o: signal.c
597         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
599 $(QEMU_PROG): $(OBJS) ../libqemu_user.a
600         $(CC) $(LDFLAGS) -o $@ $^  $(LIBS)
602 endif #CONFIG_BSD_USER
604 #########################################################
605 # System emulator target
606 ifndef CONFIG_USER_ONLY
608 OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o
609 # virtio has to be here due to weird dependency between PCI and virtio-net.
610 # need to fix this properly
611 OBJS+=virtio.o virtio-blk.o virtio-balloon.o virtio-net.o
612 OBJS+=fw_cfg.o
613 ifdef CONFIG_KVM
614 OBJS+=kvm.o kvm-all.o
615 endif
616 ifdef CONFIG_WIN32
617 OBJS+=block-raw-win32.o
618 else
619 ifdef CONFIG_AIO
620 OBJS+=posix-aio-compat.o
621 endif
622 OBJS+=block-raw-posix.o
623 endif
625 ifdef CONFIG_AIO
626 OBJS+=compatfd.o
627 endif
629 LIBS+=-lz
630 ifdef CONFIG_ALSA
631 LIBS += -lasound
632 endif
633 ifdef CONFIG_ESD
634 LIBS += -lesd
635 endif
636 ifdef CONFIG_PA
637 LIBS += -lpulse-simple
638 endif
639 ifdef CONFIG_DSOUND
640 LIBS += -lole32 -ldxguid
641 endif
642 ifdef CONFIG_FMOD
643 LIBS += $(CONFIG_FMOD_LIB)
644 endif
645 ifdef CONFIG_OSS
646 LIBS += $(CONFIG_OSS_LIB)
647 endif
649 SOUND_HW = sb16.o es1370.o ac97.o
650 ifdef CONFIG_ADLIB
651 SOUND_HW += fmopl.o adlib.o
652 adlib.o fmopl.o: CFLAGS := ${CFLAGS} -DBUILD_Y8950=0
653 endif
654 ifdef CONFIG_GUS
655 SOUND_HW += gus.o gusemu_hal.o gusemu_mixer.o
656 endif
657 ifdef CONFIG_CS4231A
658 SOUND_HW += cs4231a.o
659 endif
661 ifdef CONFIG_KVM_KERNEL_INC
662 CFLAGS += -I $(CONFIG_KVM_KERNEL_INC)
663 LIBS += -lkvm
664 DEPLIBS += ../libkvm/libkvm.a
665 endif
667 ifdef CONFIG_VNC_TLS
668 CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
669 LIBS += $(CONFIG_VNC_TLS_LIBS)
670 endif
672 ifdef CONFIG_BLUEZ
673 LIBS += $(CONFIG_BLUEZ_LIBS)
674 endif
676 # SCSI layer
677 OBJS+= lsi53c895a.o esp.o
679 # USB layer
680 OBJS+= usb-ohci.o
682 # EEPROM emulation
683 OBJS += eeprom93xx.o
685 # PCI network cards
686 OBJS += eepro100.o
687 OBJS += ne2000.o
688 OBJS += pcnet.o
689 OBJS += rtl8139.o
690 OBJS += e1000.o
692 OBJS += device-hotplug.o
694 ifeq ($(USE_KVM_DEVICE_ASSIGNMENT), 1)
695 OBJS+= device-assignment.o
696 endif
698 ifeq ($(TARGET_BASE_ARCH), i386)
699 # Hardware support
700 OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o
701 OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
702 OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o
703 OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
704 OBJS+= extboot.o
705 # virtio support
706 OBJS+= virtio.o virtio-blk.o virtio-balloon.o
707 OBJS += virtio-net.o
708 ifeq ($(USE_KVM_PIT), 1)
709 OBJS+= i8254-kvm.o
710 endif
711 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
712 endif
713 ifeq ($(TARGET_BASE_ARCH), ia64)
714 # Hardware support
715 OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
716 OBJS+= fdc.o mc146818rtc.o serial.o i8259.o ipf.o
717 OBJS+= cirrus_vga.o parallel.o acpi.o piix_pci.o
718 OBJS+= usb-uhci.o smbus_eeprom.o
719 # virtio support
720 OBJS+= virtio.o virtio-blk.o virtio-balloon.o
721 OBJS+= virtio-net.o
722 endif
723 ifeq ($(TARGET_BASE_ARCH), ppc)
724 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
725 # shared objects
726 OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o
727 OBJS+= cirrus_vga.o
728 # PREP target
729 OBJS+= pckbd.o ps2.o serial.o i8259.o i8254.o fdc.o m48t59.o mc146818rtc.o
730 OBJS+= prep_pci.o ppc_prep.o
731 # Mac shared devices
732 OBJS+= macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o escc.o
733 # OldWorld PowerMac
734 OBJS+= heathrow_pic.o grackle_pci.o ppc_oldworld.o
735 # NewWorld PowerMac
736 OBJS+= unin_pci.o ppc_chrp.o
737 # PowerPC 4xx boards
738 OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o
739 OBJS+= ppc440.o ppc440_bamboo.o
740 ifdef FDT_LIBS
741 OBJS+= device_tree.o
742 LIBS+= $(FDT_LIBS)
743 endif
744 ifdef CONFIG_KVM
745 OBJS+= kvm_ppc.o
746 endif
747 endif
748 ifeq ($(TARGET_BASE_ARCH), mips)
749 OBJS+= mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o
750 OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o rc4030.o
751 OBJS+= g364fb.o jazz_led.o
752 OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
753 OBJS+= piix_pci.o parallel.o cirrus_vga.o pcspk.o $(SOUND_HW)
754 OBJS+= mipsnet.o
755 OBJS+= pflash_cfi01.o
756 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
757 endif
758 ifeq ($(TARGET_BASE_ARCH), cris)
759 # Boards
760 OBJS+= etraxfs.o axis_dev88.o
762 # IO blocks
763 OBJS+= etraxfs_dma.o
764 OBJS+= etraxfs_pic.o
765 OBJS+= etraxfs_eth.o
766 OBJS+= etraxfs_timer.o
767 OBJS+= etraxfs_ser.o
769 OBJS+= ptimer.o
770 OBJS+= pflash_cfi02.o nand.o
771 endif
772 ifeq ($(TARGET_BASE_ARCH), sparc)
773 ifeq ($(TARGET_ARCH), sparc64)
774 OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o
775 OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o
776 OBJS+= cirrus_vga.o parallel.o ptimer.o
777 else
778 OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o
779 OBJS+= slavio_timer.o escc.o slavio_misc.o fdc.o sparc32_dma.o
780 OBJS+= cs4231.o ptimer.o eccmemctl.o sbi.o sun4c_intctl.o
781 endif
782 endif
783 ifeq ($(TARGET_BASE_ARCH), arm)
784 OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o
785 OBJS+= arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
786 OBJS+= versatile_pci.o ptimer.o
787 OBJS+= realview_gic.o realview.o arm_sysctl.o mpcore.o
788 OBJS+= armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
789 OBJS+= pl061.o
790 OBJS+= arm-semi.o
791 OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
792 OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
793 OBJS+= pflash_cfi01.o gumstix.o
794 OBJS+= zaurus.o ide.o serial.o nand.o ecc.o spitz.o tosa.o tc6393xb.o
795 OBJS+= omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o
796 OBJS+= omap2.o omap_dss.o soc_dma.o
797 OBJS+= omap_sx1.o palm.o tsc210x.o
798 OBJS+= nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o
799 OBJS+= tsc2005.o bt-hci-csr.o
800 OBJS+= mst_fpga.o mainstone.o
801 OBJS+= musicpal.o pflash_cfi02.o
802 CPPFLAGS += -DHAS_AUDIO
803 endif
804 ifeq ($(TARGET_BASE_ARCH), sh4)
805 OBJS+= shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
806 OBJS+= sh_timer.o ptimer.o sh_serial.o sh_intc.o sh_pci.o sm501.o serial.o
807 OBJS+= ide.o
808 endif
809 ifeq ($(TARGET_BASE_ARCH), m68k)
810 OBJS+= an5206.o mcf5206.o ptimer.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
811 OBJS+= m68k-semi.o dummy_m68k.o
812 endif
813 ifdef CONFIG_GDBSTUB
814 OBJS+=gdbstub.o gdbstub-xml.o
815 endif
816 ifdef CONFIG_COCOA
817 COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
818 ifdef CONFIG_COREAUDIO
819 COCOA_LIBS+=-framework CoreAudio
820 endif
821 endif
822 ifdef CONFIG_SLIRP
823 CPPFLAGS+=-I$(SRC_PATH)/slirp
824 endif
826 LIBS+=$(AIOLIBS)
827 # specific flags are needed for non soft mmu emulator
828 ifdef CONFIG_STATIC
829 LDFLAGS+=-static
830 endif
831 ifndef CONFIG_DARWIN
832 ifndef CONFIG_WIN32
833 ifndef CONFIG_SOLARIS
834 ifndef CONFIG_AIX
835 LIBS+=-lutil
836 endif
837 endif
838 endif
839 endif
840 ifdef TARGET_GPROF
841 vl.o: CFLAGS+=-p
842 LDFLAGS+=-p
843 endif
845 ifeq ($(ARCH),ia64)
846 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
847 endif
849 ifdef CONFIG_WIN32
850 SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
851 endif
853 # profiling code
854 ifdef TARGET_GPROF
855 LDFLAGS+=-p
856 main.o: CFLAGS+=-p
857 endif
858 ifeq ($(TARGET_ARCH), ia64)
859 firmware.o: firmware.c
860         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
861 endif
863 $(QEMU_PROG): $(OBJS) ../libqemu_common.a libqemu.a $(DEPLIBS)
864         $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS)
866 endif # !CONFIG_USER_ONLY
868 gdbstub-xml.c: $(TARGET_XML_FILES) feature_to_c.sh
869         rm -f $@
870 ifeq ($(TARGET_XML_FILES),)
871         echo > $@
872 else
873         $(SHELL) $(SRC_PATH)/feature_to_c.sh $@ $(TARGET_XML_FILES)
874 endif
876 %.o: %.c
877         $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
879 %.o: %.S
880         $(CC) $(CPPFLAGS) -c -o $@ $<
882 clean:
883         rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o
884         rm -f *.d */*.d tcg/*.o
886 install: all
887 ifneq ($(PROGS),)
888         $(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)"
889 endif
891 # Include automatically generated dependency files
892 -include $(wildcard *.d */*.d)