Clean up KVM/QEMU interaction
[qemu-kvm/fedora.git] / Makefile.target
blob44589712ceb1b574cadf7ba94870b8460c0b93b7
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 -MP -DNEED_CPU_H
35 ifdef CONFIG_DARWIN_USER
36 VPATH+=:$(SRC_PATH)/darwin-user
37 CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
38 endif
39 ifdef CONFIG_LINUX_USER
40 VPATH+=:$(SRC_PATH)/linux-user
41 ifndef TARGET_ABI_DIR
42   TARGET_ABI_DIR=$(TARGET_ARCH)
43 endif
44 CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
45 endif
46 BASE_CFLAGS=
47 BASE_LDFLAGS=
48 #CFLAGS+=-Werror
49 LIBS=
50 HELPER_CFLAGS=$(CFLAGS)
51 DYNGEN=../dyngen$(EXESUF)
52 # user emulator name
53 ifndef TARGET_ARCH2
54 TARGET_ARCH2=$(TARGET_ARCH)
55 endif
56 ifeq ($(TARGET_ARCH),arm)
57   ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
58     TARGET_ARCH2=armeb
59   endif
60 endif
61 ifeq ($(TARGET_ARCH),sh4)
62   ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
63     TARGET_ARCH2=sh4eb
64   endif
65 endif
66 ifeq ($(TARGET_ARCH),mips)
67   ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
68     TARGET_ARCH2=mipsel
69   endif
70 endif
71 ifeq ($(TARGET_ARCH),mipsn32)
72   ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
73     TARGET_ARCH2=mipsn32el
74   endif
75 endif
76 ifeq ($(TARGET_ARCH),mips64)
77   ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
78     TARGET_ARCH2=mips64el
79   endif
80 endif
81 QEMU_USER=qemu-$(TARGET_ARCH2)
82 # system emulator name
83 ifdef CONFIG_SOFTMMU
84 ifeq ($(TARGET_ARCH), i386)
85 QEMU_SYSTEM=qemu$(EXESUF)
86 else
87 QEMU_SYSTEM=qemu-system-$(TARGET_ARCH2)$(EXESUF)
88 endif
89 else
90 QEMU_SYSTEM=qemu-fast
91 endif
93 ifdef CONFIG_USER_ONLY
94 PROGS=$(QEMU_USER)
95 else
96 PROGS+=$(QEMU_SYSTEM)
97 ifndef CONFIG_SOFTMMU
98 CONFIG_STATIC=y
99 endif
100 endif # !CONFIG_USER_ONLY
102 ifdef CONFIG_STATIC
103 BASE_LDFLAGS+=-static
104 endif
106 # We require -O2 to avoid the stack setup prologue in EXIT_TB
107 OP_CFLAGS := -Wall -O2 -g -fno-strict-aliasing
109 # cc-option
110 # Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0)
112 cc-option = $(shell if $(CC) $(OP_CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
113               > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
115 OP_CFLAGS+=$(call cc-option, -fno-reorder-blocks, "")
116 OP_CFLAGS+=$(call cc-option, -fno-gcse, "")
117 OP_CFLAGS+=$(call cc-option, -fno-tree-ch, "")
118 OP_CFLAGS+=$(call cc-option, -fno-optimize-sibling-calls, "")
119 OP_CFLAGS+=$(call cc-option, -fno-crossjumping, "")
120 OP_CFLAGS+=$(call cc-option, -fno-align-labels, "")
121 OP_CFLAGS+=$(call cc-option, -fno-align-jumps, "")
122 OP_CFLAGS+=$(call cc-option, -fno-align-functions, $(call cc-option, -malign-functions=0, ""))
123 OP_CFLAGS+=$(call cc-option, -fno-section-anchors, "")
125 ifeq ($(ARCH),i386)
126 HELPER_CFLAGS+=-fomit-frame-pointer
127 OP_CFLAGS+=-mpreferred-stack-boundary=2 -fomit-frame-pointer
128 ifdef TARGET_GPROF
129 USE_I386_LD=y
130 endif
131 ifdef CONFIG_STATIC
132 USE_I386_LD=y
133 endif
134 ifdef USE_I386_LD
135 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
136 else
137 ifdef CONFIG_LINUX_USER
138 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
139 # that the kernel ELF loader considers as an executable. I think this
140 # is the simplest way to make it self virtualizable!
141 BASE_LDFLAGS+=-Wl,-shared
142 endif
143 endif
144 endif
146 ifeq ($(ARCH),x86_64)
147   ifneq ($(CONFIG_SOLARIS),yes)
148     BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
149   endif
150 endif
152 ifeq ($(ARCH),ppc)
153 CPPFLAGS+= -D__powerpc__
154 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
155 endif
157 ifeq ($(ARCH),s390)
158 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
159 endif
161 ifeq ($(ARCH),sparc)
162   BASE_CFLAGS+=-ffixed-g2 -ffixed-g3
163   OP_CFLAGS+=-fno-delayed-branch -ffixed-i0
164   ifeq ($(CONFIG_SOLARIS),yes)
165     OP_CFLAGS+=-fno-omit-frame-pointer
166   else
167     BASE_CFLAGS+=-ffixed-g1 -ffixed-g6
168     HELPER_CFLAGS=$(CFLAGS) -ffixed-i0
169     # -static is used to avoid g1/g3 usage by the dynamic linker
170     BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
171   endif
172 endif
174 ifeq ($(ARCH),sparc64)
175   BASE_CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
176   OP_CFLAGS+=-mcpu=ultrasparc -m64 -fno-delayed-branch -ffixed-i0
177   ifneq ($(CONFIG_SOLARIS),yes)
178     BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
179     OP_CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
180   endif
181 endif
183 ifeq ($(ARCH),alpha)
184 # -msmall-data is not used for OP_CFLAGS because we want two-instruction
185 # relocations for the constant constructions
186 # Ensure there's only a single GP
187 BASE_CFLAGS+=-msmall-data
188 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
189 endif
191 ifeq ($(ARCH),ia64)
192 BASE_CFLAGS+=-mno-sdata
193 OP_CFLAGS+=-mno-sdata
194 BASE_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
195 endif
197 ifeq ($(ARCH),arm)
198 OP_CFLAGS+=-mno-sched-prolog -fno-omit-frame-pointer
199 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
200 endif
202 ifeq ($(ARCH),m68k)
203 OP_CFLAGS+=-fomit-frame-pointer
204 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
205 endif
207 ifeq ($(ARCH),mips)
208 OP_CFLAGS+=-mabi=32 -G0 -fno-PIC -mno-abicalls -fomit-frame-pointer -fno-delayed-branch -Wa,-O0
209 ifeq ($(WORDS_BIGENDIAN),yes)
210 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
211 else
212 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
213 endif
214 endif
216 ifeq ($(ARCH),mips64)
217 OP_CFLAGS+=-mabi=n32 -G0 -fno-PIC -mno-abicalls -fomit-frame-pointer -fno-delayed-branch -Wa,-O0
218 ifeq ($(WORDS_BIGENDIAN),yes)
219 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
220 else
221 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
222 endif
223 endif
225 ifeq ($(CONFIG_DARWIN),yes)
226 LIBS+=-lmx
227 endif
229 ifdef CONFIG_DARWIN_USER
230 # Leave some space for the regular program loading zone
231 BASE_LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000
232 endif
234 BASE_CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
235 BASE_LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS)
236 OP_CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
237 OP_LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS)
239 #########################################################
241 CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__user=
242 LIBS+=-lm
243 ifndef CONFIG_USER_ONLY
244 LIBS+=-lz
245 endif
246 ifdef CONFIG_WIN32
247 LIBS+=-lwinmm -lws2_32 -liphlpapi
248 endif
249 ifdef CONFIG_SOLARIS
250 LIBS+=-lsocket -lnsl -lresolv
251 ifdef NEEDS_LIBSUNMATH
252 LIBS+=-lsunmath
253 LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib
254 OP_CFLAGS+=-I/opt/SUNWspro/prod/include/cc
255 BASE_CFLAGS+=-I/opt/SUNWspro/prod/include/cc
256 endif
257 endif
259 # profiling code
260 ifdef TARGET_GPROF
261 BASE_LDFLAGS+=-p
262 main.o: BASE_CFLAGS+=-p
263 endif
265 ifdef CONFIG_LINUX_USER
266 OBJS= main.o syscall.o strace.o mmap.o signal.o path.o osdep.o thunk.o \
267       elfload.o linuxload.o uaccess.o
268 LIBS+= $(AIOLIBS)
269 ifdef TARGET_HAS_BFLT
270 OBJS+= flatload.o
271 endif
272 ifdef TARGET_HAS_ELFLOAD32
273 OBJS+= elfload32.o
274 elfload32.o: elfload.c
275 endif
277 ifeq ($(TARGET_ARCH), i386)
278 OBJS+= vm86.o
279 endif
280 ifeq ($(TARGET_ARCH), arm)
281 OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
282 nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
283  nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o
284 endif
285 ifeq ($(TARGET_ARCH), m68k)
286 OBJS+= m68k-sim.o m68k-semi.o
287 endif
288 endif #CONFIG_LINUX_USER
290 ifdef CONFIG_DARWIN_USER
291 OBJS= main.o commpage.o machload.o mmap.o osdep.o signal.o syscall.o thunk.o
292 endif
294 SRCS:= $(OBJS:.o=.c)
295 OBJS+= libqemu.a
297 # cpu emulator library
298 LIBOBJS=exec.o kqemu.o translate-op.o translate-all.o cpu-exec.o\
299         translate.o op.o host-utils.o
300 ifeq ($(USE_KVM), 1)
301 LIBOBJS+=qemu-kvm.o
302 endif
304 ifdef CONFIG_SOFTFLOAT
305 LIBOBJS+=fpu/softfloat.o
306 else
307 LIBOBJS+=fpu/softfloat-native.o
308 endif
309 CPPFLAGS+=-I$(SRC_PATH)/fpu
311 ifeq ($(TARGET_ARCH), i386)
312 LIBOBJS+=helper.o helper2.o
313 ifeq ($(USE_KVM), 1)
314 LIBOBJS+=qemu-kvm-x86.o kvm-tpr-opt.o
315 LIBOBJS+=qemu-kvm-helper.o
316 endif
317 endif
319 ifeq ($(TARGET_ARCH), x86_64)
320 LIBOBJS+=helper.o helper2.o
321 ifeq ($(USE_KVM), 1)
322 LIBOBJS+=qemu-kvm-x86.o kvm-tpr-opt.o
323 LIBOBJS+=qemu-kvm-helper.o
324 endif
325 endif
327 ifeq ($(TARGET_BASE_ARCH), ppc)
328 LIBOBJS+= op_helper.o helper.o
329 ifeq ($(USE_KVM), 1)
330 LIBOBJS+= qemu-kvm-powerpc.o
331 endif
332 endif
334 ifeq ($(TARGET_BASE_ARCH), mips)
335 LIBOBJS+= op_helper.o helper.o
336 endif
338 ifeq ($(TARGET_BASE_ARCH), sparc)
339 LIBOBJS+= op_helper.o helper.o
340 endif
342 ifeq ($(TARGET_BASE_ARCH), arm)
343 LIBOBJS+= op_helper.o helper.o
344 endif
346 ifeq ($(TARGET_BASE_ARCH), sh4)
347 LIBOBJS+= op_helper.o helper.o
348 endif
350 ifeq ($(TARGET_BASE_ARCH), m68k)
351 LIBOBJS+= op_helper.o helper.o
352 endif
354 ifeq ($(TARGET_BASE_ARCH), alpha)
355 LIBOBJS+= op_helper.o helper.o alpha_palcode.o
356 endif
358 ifeq ($(TARGET_BASE_ARCH), ia64)
359 LIBOBJS+=op_helper.o firmware.o
360 ifeq ($(USE_KVM), 1)
361 LIBOBJS+=qemu-kvm-ia64.o
362 endif
363 endif
365 ifeq ($(TARGET_BASE_ARCH), cris)
366 LIBOBJS+= op_helper.o helper.o
367 LIBOBJS+= cris-dis.o
369 ifndef CONFIG_USER_ONLY
370 LIBOBJS+= mmu.o
371 endif
372 endif
375 # NOTE: the disassembler code is only needed for debugging
376 LIBOBJS+=disas.o
377 ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
378 USE_I386_DIS=y
379 endif
380 ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
381 USE_I386_DIS=y
382 endif
383 ifdef USE_I386_DIS
384 LIBOBJS+=i386-dis.o
385 endif
386 ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
387 LIBOBJS+=alpha-dis.o
388 endif
389 ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
390 LIBOBJS+=ppc-dis.o
391 endif
392 ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips)
393 LIBOBJS+=mips-dis.o
394 endif
395 ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
396 LIBOBJS+=sparc-dis.o
397 endif
398 ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
399 LIBOBJS+=arm-dis.o
400 endif
401 ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
402 LIBOBJS+=m68k-dis.o
403 endif
404 ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
405 LIBOBJS+=sh4-dis.o
406 endif
407 ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390)
408 LIBOBJS+=s390-dis.o
409 endif
411 ifdef CONFIG_GDBSTUB
412 OBJS+=gdbstub.o
413 endif
415 all: $(PROGS)
417 $(QEMU_USER): $(OBJS)
418         $(CC) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^  $(LIBS)
419 ifeq ($(ARCH),alpha)
420 # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
421 # the address space (31 bit so sign extending doesn't matter)
422         echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
423 endif
425 # must use static linking to avoid leaving stuff in virtual address space
426 VL_OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o migration.o
427 # XXX: suppress QEMU_TOOL tests
428 ifdef CONFIG_WIN32
429 VL_OBJS+=block-raw-win32.o
430 else
431 VL_OBJS+=block-raw-posix.o
432 endif
434 ifdef CONFIG_ALSA
435 LIBS += -lasound
436 endif
437 ifdef CONFIG_ESD
438 LIBS += -lesd
439 endif
440 ifdef CONFIG_DSOUND
441 LIBS += -lole32 -ldxguid
442 endif
443 ifdef CONFIG_FMOD
444 LIBS += $(CONFIG_FMOD_LIB)
445 endif
447 SOUND_HW = sb16.o es1370.o
448 ifdef CONFIG_AC97
449 SOUND_HW += ac97.o
450 endif
451 ifdef CONFIG_ADLIB
452 SOUND_HW += fmopl.o adlib.o
453 endif
454 ifdef CONFIG_GUS
455 SOUND_HW += gus.o gusemu_hal.o gusemu_mixer.o
456 endif
458 ifdef CONFIG_KVM_KERNEL_INC
459 CFLAGS += -I $(CONFIG_KVM_KERNEL_INC)
460 LIBS += -lkvm
461 DEPLIBS += ../libkvm/libkvm.a
462 endif
464 ifdef CONFIG_VNC_TLS
465 CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
466 LIBS += $(CONFIG_VNC_TLS_LIBS)
467 endif
469 # SCSI layer
470 VL_OBJS+= lsi53c895a.o
472 # USB layer
473 VL_OBJS+= usb-ohci.o
475 # EEPROM emulation
476 VL_OBJS += eeprom93xx.o
478 # PCI network cards
479 VL_OBJS += eepro100.o
480 VL_OBJS += ne2000.o
481 VL_OBJS += pcnet.o
482 VL_OBJS += rtl8139.o
484 # PCI Hypercall
485 VL_OBJS+= hypercall.o
487 # virtio devices
488 VL_OBJS += virtio.o virtio-net.o virtio-blk.o
490 ifeq ($(TARGET_BASE_ARCH), i386)
491 # Hardware support
492 VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o
493 VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
494 VL_OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o
495 VL_OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o extboot.o
496 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
497 endif
498 ifeq ($(TARGET_BASE_ARCH), ia64)
499 # Hardware support
500 VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
501 VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o ipf.o
502 VL_OBJS+= cirrus_vga.o parallel.o acpi.o piix_pci.o
503 VL_OBJS+= usb-uhci.o smbus_eeprom.o
504 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
505 endif
506 ifeq ($(TARGET_BASE_ARCH), ppc)
507 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
508 # shared objects
509 VL_OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o
510 VL_OBJS+= cirrus_vga.o
511 # PREP target
512 VL_OBJS+= pckbd.o ps2.o serial.o i8259.o i8254.o fdc.o m48t59.o mc146818rtc.o
513 VL_OBJS+= prep_pci.o ppc_prep.o
514 # Mac shared devices
515 VL_OBJS+= macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o
516 # OldWorld PowerMac
517 VL_OBJS+= heathrow_pic.o grackle_pci.o ppc_oldworld.o
518 # NewWorld PowerMac
519 VL_OBJS+= unin_pci.o ppc_chrp.o
520 # PowerPC 4xx boards
521 VL_OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc405_uc.o ppc405_boards.o
522 VL_OBJS+= ppc440.o ppc440_bamboo.o
523 endif
524 ifeq ($(TARGET_BASE_ARCH), mips)
525 VL_OBJS+= mips_r4k.o mips_malta.o mips_pica61.o mips_mipssim.o
526 VL_OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o
527 VL_OBJS+= jazz_led.o
528 VL_OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
529 VL_OBJS+= piix_pci.o parallel.o cirrus_vga.o $(SOUND_HW)
530 VL_OBJS+= mipsnet.o
531 VL_OBJS+= pflash_cfi01.o
532 CPPFLAGS += -DHAS_AUDIO
533 endif
534 ifeq ($(TARGET_BASE_ARCH), cris)
535 VL_OBJS+= etraxfs.o
536 VL_OBJS+= ptimer.o
537 VL_OBJS+= etraxfs_timer.o
538 VL_OBJS+= etraxfs_ser.o
539 endif
540 ifeq ($(TARGET_BASE_ARCH), sparc)
541 ifeq ($(TARGET_ARCH), sparc64)
542 VL_OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o
543 VL_OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o
544 VL_OBJS+= cirrus_vga.o parallel.o ptimer.o
545 else
546 VL_OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o
547 VL_OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o esp.o sparc32_dma.o
548 VL_OBJS+= cs4231.o ptimer.o eccmemctl.o sbi.o sun4c_intctl.o
549 endif
550 endif
551 ifeq ($(TARGET_BASE_ARCH), arm)
552 VL_OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o
553 VL_OBJS+= arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
554 VL_OBJS+= versatile_pci.o ptimer.o
555 VL_OBJS+= realview_gic.o realview.o arm_sysctl.o mpcore.o
556 VL_OBJS+= armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
557 VL_OBJS+= pl061.o
558 VL_OBJS+= arm-semi.o
559 VL_OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
560 VL_OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
561 VL_OBJS+= pflash_cfi01.o gumstix.o
562 VL_OBJS+= spitz.o ide.o serial.o nand.o ecc.o
563 VL_OBJS+= omap.o omap_lcdc.o omap1_clk.o omap_mmc.o omap_i2c.o
564 VL_OBJS+= palm.o tsc210x.o
565 VL_OBJS+= mst_fpga.o mainstone.o
566 CPPFLAGS += -DHAS_AUDIO
567 endif
568 ifeq ($(TARGET_BASE_ARCH), sh4)
569 VL_OBJS+= shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
570 VL_OBJS+= sh_timer.o ptimer.o sh_serial.o sh_intc.o
571 endif
572 ifeq ($(TARGET_BASE_ARCH), m68k)
573 VL_OBJS+= an5206.o mcf5206.o ptimer.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
574 VL_OBJS+= m68k-semi.o dummy_m68k.o
575 endif
576 ifdef CONFIG_GDBSTUB
577 VL_OBJS+=gdbstub.o
578 endif
579 ifdef CONFIG_COCOA
580 COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
581 ifdef CONFIG_COREAUDIO
582 COCOA_LIBS+=-framework CoreAudio
583 endif
584 endif
585 ifdef CONFIG_SLIRP
586 CPPFLAGS+=-I$(SRC_PATH)/slirp
587 endif
589 VL_LDFLAGS=$(VL_OS_LDFLAGS)
590 VL_LIBS=$(AIOLIBS)
591 # specific flags are needed for non soft mmu emulator
592 ifdef CONFIG_STATIC
593 VL_LDFLAGS+=-static
594 endif
595 ifndef CONFIG_SOFTMMU
596 VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld
597 endif
598 ifndef CONFIG_DARWIN
599 ifndef CONFIG_WIN32
600 ifndef CONFIG_SOLARIS
601 VL_LIBS+=-lutil
602 endif
603 endif
604 endif
605 ifdef TARGET_GPROF
606 vl.o: BASE_CFLAGS+=-p
607 VL_LDFLAGS+=-p
608 endif
610 ifeq ($(ARCH),ia64)
611 VL_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
612 endif
614 ifeq ($(ARCH),sparc64)
615   VL_LDFLAGS+=-m64
616   ifneq ($(CONFIG_SOLARIS),yes)
617     VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
618   endif
619 endif
621 ifeq ($(ARCH),x86_64)
622   VL_LDFLAGS+=-m64
623   ifneq ($(CONFIG_SOLARIS),yes)
624     VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
625   endif
626 endif
628 ifdef CONFIG_WIN32
629 SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
630 endif
632 $(QEMU_SYSTEM): $(VL_OBJS) ../libqemu_common.a libqemu.a $(DEPLIBS)
633         $(CC) $(VL_LDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
635 depend: $(SRCS)
636         $(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
638 vldepend: $(VL_OBJS:.o=.c)
639         $(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
641 # libqemu
643 libqemu.a: $(LIBOBJS)
644         rm -f $@
645         $(AR) rcs $@ $(LIBOBJS)
647 translate.o: translate.c gen-op.h opc.h cpu.h
649 translate-all.o: translate-all.c opc.h cpu.h
651 translate-op.o: translate-all.c op.h opc.h cpu.h
653 op.h: op.o $(DYNGEN)
654         $(DYNGEN) -o $@ $<
656 opc.h: op.o $(DYNGEN)
657         $(DYNGEN) -c -o $@ $<
659 gen-op.h: op.o $(DYNGEN)
660         $(DYNGEN) -g -o $@ $<
662 op.o: op.c
663         $(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $<
665 # HELPER_CFLAGS is used for all the code compiled with static register
666 # variables
667 ifeq ($(TARGET_BASE_ARCH), i386)
668 # XXX: rename helper.c to op_helper.c
669 qemu-kvm-x86.o: qemu-kvm-x86.c qemu-kvm.h
671 helper.o: helper.c
672         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
673 else
674 op_helper.o: op_helper.c
675         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
676 endif
677 ifeq ($(TARGET_ARCH), ia64)
678 qemu-kvm-ia64.o: qemu-kvm-ia64.c qemu-kvm.h
679 firmware.o: firmware.c
680         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
681 endif
683 ifeq ($(TARGET_ARCH), ppc)
684 qemu-kvm-powerpc.o: qemu-kvm-powerpc.c qemu-kvm.h
685 endif
687 cpu-exec.o: cpu-exec.c
688         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
690 qemu-kvm.o: qemu-kvm.c qemu-kvm.h
691 ifeq ($(TARGET_BASE_ARCH), i386)
692 qemu-kvm-helper.o: qemu-kvm-helper.c
693 endif
695         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
697 # Note: this is a workaround. The real fix is to avoid compiling
698 # cpu_signal_handler() in cpu-exec.c.
699 signal.o: signal.c
700         $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
702 %.o: %.c
703         $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
705 %.o: %.S
706         $(CC) $(CPPFLAGS) -c -o $@ $<
708 clean:
709         rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o fpu/*.o
710         rm -f *.d */*.d
712 install: all
713 ifneq ($(PROGS),)
714         $(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)"
715 endif
717 ifneq ($(wildcard .depend),)
718 include .depend
719 endif
721 ifeq (1, 0)
722 audio.o sdlaudio.o dsoundaudio.o ossaudio.o wavaudio.o noaudio.o \
723 fmodaudio.o alsaaudio.o mixeng.o sb16.o es1370.o ac97.o gus.o adlib.o \
724 esdaudio.o audio_pt_int.o: \
725 CFLAGS := $(CFLAGS) -O0 -g -Wall -Werror -W -Wsign-compare -Wno-unused
726 endif
728 # Include automatically generated dependency files
729 -include $(wildcard *.d */*.d)