2 include $(SRC_PATH)/rules.mak
4 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
5 VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw
6 CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MT $@ -MP -DNEED_CPU_H
10 ifdef CONFIG_USER_ONLY
12 QEMU_PROG=qemu-$(TARGET_ARCH2)
14 # system emulator name
15 ifeq ($(TARGET_ARCH), i386)
16 QEMU_PROG=qemu$(EXESUF)
18 QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF)
27 HELPER_CFLAGS+=-fomit-frame-pointer
30 ifeq ($(subst ppc64,ppc,$(ARCH))$(TARGET_BASE_ARCH),ppcppc)
31 translate.o: CFLAGS := $(CFLAGS) $(call cc-option, $(CFLAGS), -fno-unit-at-a-time,)
35 ifneq ($(CONFIG_SOLARIS),y)
36 HELPER_CFLAGS+=-ffixed-i0
41 # Ensure there's only a single GP
49 CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
50 CPPFLAGS+=-U_FORTIFY_SOURCE
53 LIBS+=-lwinmm -lws2_32 -liphlpapi
56 LIBS+=-lsocket -lnsl -lresolv
57 ifdef CONFIG_NEEDS_LIBSUNMATH
59 LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib
60 CFLAGS+=-I/opt/SUNWspro/prod/include/cc
64 kvm.o: CFLAGS+=$(KVM_CFLAGS)
65 kvm-all.o: CFLAGS+=$(KVM_CFLAGS)
68 # Dummy command so that make thinks it has done something
71 #########################################################
72 # cpu emulator library
73 libobj-y = exec.o translate-all.o cpu-exec.o translate.o host-utils.o
74 libobj-$(CONFIG_KQEMU) += kqemu.o
76 libobj-y += tcg/tcg.o tcg/tcg-runtime.o
77 CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH)
78 ifeq ($(ARCH),sparc64)
79 CPPFLAGS+=-I$(SRC_PATH)/tcg/sparc
81 ifdef CONFIG_SOFTFLOAT
82 libobj-y += fpu/softfloat.o
84 libobj-y += fpu/softfloat-native.o
86 CPPFLAGS+=-I$(SRC_PATH)/fpu
87 libobj-y += op_helper.o helper.o
89 ifeq ($(TARGET_BASE_ARCH), arm)
90 libobj-y += neon_helper.o iwmmxt_helper.o
93 ifeq ($(TARGET_BASE_ARCH), alpha)
94 libobj-y += alpha_palcode.o
97 ifeq ($(TARGET_BASE_ARCH), cris)
98 libobj-y += cris-dis.o
100 ifndef CONFIG_USER_ONLY
105 # NOTE: the disassembler code is only needed for debugging
107 ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
110 ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
113 libobj-$(USE_I386_DIS) += i386-dis.o
114 ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
115 libobj-y += alpha-dis.o
117 ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
118 libobj-y += ppc-dis.o
120 ifeq ($(findstring microblaze, $(TARGET_BASE_ARCH) $(ARCH)),microblaze)
121 libobj-y += microblaze-dis.o
122 ifndef CONFIG_USER_ONLY
126 ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips)
127 libobj-y += mips-dis.o
129 ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
130 libobj-y += sparc-dis.o
132 ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
133 libobj-y += arm-dis.o
135 ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
136 libobj-y += m68k-dis.o
138 ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
139 libobj-y += sh4-dis.o
141 ifeq ($(findstring hppa, $(TARGET_BASE_ARCH) $(ARCH)),hppa)
142 libobj-y += hppa-dis.o
144 ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390)
145 libobj-y += s390-dis.o
150 libqemu.a: $(libobj-y)
152 translate.o: translate.c cpu.h
154 translate-all.o: translate-all.c cpu.h
158 # HELPER_CFLAGS is used for all the code compiled with static register
160 op_helper.o: CFLAGS += $(HELPER_CFLAGS)
162 cpu-exec.o: CFLAGS += $(HELPER_CFLAGS)
164 #########################################################
165 # Linux user emulator target
167 ifdef CONFIG_LINUX_USER
169 VPATH+=:$(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
170 CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
180 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
182 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
183 # that the kernel ELF loader considers as an executable. I think this
184 # is the simplest way to make it self virtualizable!
189 ifeq ($(ARCH),x86_64)
190 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
194 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
198 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
202 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
206 # -static is used to avoid g1/g3 usage by the dynamic linker
207 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
210 ifeq ($(ARCH),sparc64)
211 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
215 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
219 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
223 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
227 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
231 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
234 ifeq ($(ARCH),mips64)
235 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
244 obj-y = main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \
245 elfload.o linuxload.o uaccess.o envlist.o gdbstub.o gdbstub-xml.o \
247 obj-$(TARGET_HAS_BFLT) += flatload.o
249 ifdef TARGET_HAS_ELFLOAD32
250 elfload32.o: elfload.c
252 obj-$(TARGET_HAS_ELFLOAD32) += elfload32.o
254 ifeq ($(TARGET_ARCH), i386)
258 nwfpe-obj-y := fpa11.o fpa11_cpdo.o fpa11_cpdt.o fpa11_cprt.o fpopcode.o
259 nwfpe-obj-y += single_cpdo.o double_cpdo.o extended_cpdo.o
260 obj-arm-y += $(addprefix nwfpe/, $(nwfpe-obj-y))
261 obj-arm-y += arm-semi.o
263 obj-m68k-y += m68k-sim.o m68k-semi.o
265 # Note: this is a workaround. The real fix is to avoid compiling
266 # cpu_signal_handler() in cpu-exec.c.
267 signal.o: CFLAGS += $(HELPER_CFLAGS)
269 ARLIBS=../libqemu_user.a libqemu.a
270 endif #CONFIG_LINUX_USER
272 LIBS+= $(PTHREADLIBS)
275 #########################################################
276 # Darwin user emulator target
278 ifdef CONFIG_DARWIN_USER
280 VPATH+=:$(SRC_PATH)/darwin-user
281 CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
283 # Leave some space for the regular program loading zone
284 LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000
288 obj-y = main.o commpage.o machload.o mmap.o signal.o syscall.o thunk.o \
289 gdbstub.o gdbstub-xml.o ioport-user.o
291 # Note: this is a workaround. The real fix is to avoid compiling
292 # cpu_signal_handler() in cpu-exec.c.
293 signal.o: CFLAGS += $(HELPER_CFLAGS)
297 endif #CONFIG_DARWIN_USER
299 #########################################################
300 # BSD user emulator target
302 ifdef CONFIG_BSD_USER
304 VPATH+=:$(SRC_PATH)/bsd-user
305 CPPFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
315 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
317 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
318 # that the kernel ELF loader considers as an executable. I think this
319 # is the simplest way to make it self virtualizable!
324 ifeq ($(ARCH),x86_64)
325 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
329 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
333 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
337 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
341 # -static is used to avoid g1/g3 usage by the dynamic linker
342 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
345 ifeq ($(ARCH),sparc64)
346 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
350 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
354 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
358 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
362 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
366 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
369 ifeq ($(ARCH),mips64)
370 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
373 obj-y = main.o bsdload.o elfload.o mmap.o path.o signal.o strace.o syscall.o \
374 gdbstub.o gdbstub-xml.o ioport-user.o
377 # Note: this is a workaround. The real fix is to avoid compiling
378 # cpu_signal_handler() in cpu-exec.c.
379 signal.o: CFLAGS += $(HELPER_CFLAGS)
381 ARLIBS=libqemu.a ../libqemu_user.a
383 endif #CONFIG_BSD_USER
385 #########################################################
386 # System emulator target
387 ifndef CONFIG_USER_ONLY
389 obj-y = vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o \
390 gdbstub.o gdbstub-xml.o msix.o ioport.o
391 # virtio has to be here due to weird dependency between PCI and virtio-net.
392 # need to fix this properly
393 obj-y += virtio-blk.o virtio-balloon.o virtio-net.o virtio-console.o
394 obj-$(CONFIG_KVM) += kvm.o kvm-all.o
404 LIBS += -lpulse-simple
407 LIBS += -lole32 -ldxguid
417 sound-obj-$(CONFIG_SB16) += sb16.o
418 sound-obj-$(CONFIG_ES1370) += es1370.o
419 sound-obj-$(CONFIG_AC97) += ac97.o
420 sound-obj-$(CONFIG_ADLIB) += fmopl.o adlib.o
421 sound-obj-$(CONFIG_GUS) += gus.o gusemu_hal.o gusemu_mixer.o
422 sound-obj-$(CONFIG_CS4231A) += cs4231a.o
425 adlib.o fmopl.o: CFLAGS := ${CFLAGS} -DBUILD_Y8950=0
429 CPPFLAGS += $(VNC_TLS_CFLAGS)
430 LIBS += $(VNC_TLS_LIBS)
433 ifdef CONFIG_VNC_SASL
434 CPPFLAGS += $(VNC_SASL_CFLAGS)
435 LIBS += $(VNC_SASL_LIBS)
439 LIBS += $(BLUEZ_LIBS)
442 # xen backend driver support
443 obj-$(CONFIG_XEN) += xen_machine_pv.o xen_domainbuild.o
444 ifeq ($(CONFIG_XEN), y)
458 # Generic watchdog support and some watchdog devices
459 obj-y += wdt_ib700.o wdt_i6300esb.o
462 obj-i386-y = ide.o pckbd.o vga.o $(sound-obj-y) dma.o
463 obj-i386-y += fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
464 obj-i386-y += cirrus_vga.o apic.o ioapic.o parallel.o acpi.o piix_pci.o
465 obj-i386-y += usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
466 obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o
468 ifeq ($(TARGET_BASE_ARCH), i386)
469 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
473 obj-ppc-y = ppc.o ide.o vga.o $(sound-obj-y) dma.o openpic.o
475 obj-ppc-y += pckbd.o serial.o i8259.o i8254.o fdc.o mc146818rtc.o
476 obj-ppc-y += prep_pci.o ppc_prep.o
478 obj-ppc-y += macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o
480 obj-ppc-y += heathrow_pic.o grackle_pci.o ppc_oldworld.o
482 obj-ppc-y += unin_pci.o ppc_newworld.o
484 obj-ppc-y += pflash_cfi02.o ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o
485 obj-ppc-y += ppc440.o ppc440_bamboo.o
486 # PowerPC E500 boards
487 obj-ppc-y += ppce500_pci.o ppce500_mpc8544ds.o
488 obj-ppc-$(CONFIG_KVM) += kvm_ppc.o
490 ifeq ($(TARGET_BASE_ARCH), ppc)
491 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
494 obj-ppc-$(CONFIG_FDT) += device_tree.o
497 obj-mips-y = mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o
498 obj-mips-y += mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o rc4030.o
499 obj-mips-y += g364fb.o jazz_led.o dp8393x.o
500 obj-mips-y += ide.o gt64xxx.o pckbd.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
501 obj-mips-y += piix_pci.o parallel.o cirrus_vga.o pcspk.o $(sound-obj-y)
502 obj-mips-y += mipsnet.o
503 obj-mips-y += pflash_cfi01.o
504 obj-mips-y += vmware_vga.o
506 ifeq ($(TARGET_BASE_ARCH), mips)
507 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
510 obj-microblaze-y = petalogix_s3adsp1800_mmu.o
512 obj-microblaze-y += microblaze_pic_cpu.o
513 obj-microblaze-y += xilinx_intc.o
514 obj-microblaze-y += xilinx_timer.o
515 obj-microblaze-y += xilinx_uartlite.o
516 obj-microblaze-y += xilinx_ethlite.o
518 obj-microblaze-y += pflash_cfi02.o
520 obj-microblaze-$(CONFIG_FDT) += device_tree.o
524 obj-cris-y = cris_pic_cpu.o etraxfs.o axis_dev88.o
527 obj-cris-y += etraxfs_dma.o
528 obj-cris-y += etraxfs_pic.o
529 obj-cris-y += etraxfs_eth.o
530 obj-cris-y += etraxfs_timer.o
531 obj-cris-y += etraxfs_ser.o
533 obj-cris-y += pflash_cfi02.o
535 ifeq ($(TARGET_ARCH), sparc64)
536 obj-sparc-y = sun4u.o ide.o pckbd.o vga.o apb_pci.o
537 obj-sparc-y += fdc.o mc146818rtc.o serial.o
538 obj-sparc-y += cirrus_vga.o parallel.o
540 obj-sparc-y = sun4m.o tcx.o iommu.o slavio_intctl.o
541 obj-sparc-y += slavio_timer.o slavio_misc.o fdc.o sparc32_dma.o
542 obj-sparc-y += cs4231.o eccmemctl.o sbi.o sun4c_intctl.o
545 obj-arm-y = integratorcp.o versatilepb.o smc91c111.o arm_pic.o arm_timer.o
546 obj-arm-y += arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
547 obj-arm-y += versatile_pci.o
548 obj-arm-y += realview_gic.o realview.o arm_sysctl.o mpcore.o
549 obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
551 obj-arm-y += arm-semi.o
552 obj-arm-y += pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
553 obj-arm-y += pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
554 obj-arm-y += pflash_cfi01.o gumstix.o
555 obj-arm-y += zaurus.o ide.o serial.o spitz.o tosa.o tc6393xb.o
556 obj-arm-y += omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o
557 obj-arm-y += omap2.o omap_dss.o soc_dma.o
558 obj-arm-y += omap_sx1.o palm.o tsc210x.o
559 obj-arm-y += nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o
560 obj-arm-y += mst_fpga.o mainstone.o
561 obj-arm-y += musicpal.o pflash_cfi02.o
562 obj-arm-y += framebuffer.o
563 obj-arm-y += syborg.o syborg_fb.o syborg_interrupt.o syborg_keyboard.o
564 obj-arm-y += syborg_serial.o syborg_timer.o syborg_pointer.o syborg_rtc.o
565 obj-arm-y += syborg_virtio.o
567 ifeq ($(TARGET_BASE_ARCH), arm)
568 CPPFLAGS += -DHAS_AUDIO
571 obj-sh4-y = shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
572 obj-sh4-y += sh_timer.o sh_serial.o sh_intc.o sh_pci.o sm501.o serial.o
575 obj-m68k-y = an5206.o mcf5206.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
576 obj-m68k-y += m68k-semi.o dummy_m68k.o
579 COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
580 ifdef CONFIG_COREAUDIO
581 COCOA_LIBS+=-framework CoreAudio
585 CPPFLAGS+=-I$(SRC_PATH)/slirp
588 # specific flags are needed for non soft mmu emulator
591 ifndef CONFIG_SOLARIS
604 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
608 SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
617 vl.o: CFLAGS+=$(SDL_CFLAGS)
621 monitor.o: qemu-monitor.h
623 LIBS += $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS) $(CURL_LIBS)
624 ARLIBS=../libqemu_common.a libqemu.a $(HWLIB)
626 endif # !CONFIG_USER_ONLY
628 $(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y) $(ARLIBS)
629 $(call LINK,$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y))
632 gdbstub-xml.c: $(TARGET_XML_FILES) feature_to_c.sh
633 ifeq ($(TARGET_XML_FILES),)
634 $(call quiet-command,rm -f $@ && echo > $@," GEN $(TARGET_DIR)$@")
636 $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/feature_to_c.sh $@ $(TARGET_XML_FILES)," GEN $(TARGET_DIR)$@")
639 qemu-options.h: $(SRC_PATH)/qemu-options.hx
640 $(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@")
642 qemu-monitor.h: $(SRC_PATH)/qemu-monitor.hx
643 $(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@")
646 rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o
647 rm -f *.d */*.d tcg/*.o
648 rm -f qemu-options.h qemu-monitor.h gdbstub-xml.c
652 $(INSTALL) -m 755 $(STRIP_OPT) $(PROGS) "$(DESTDIR)$(bindir)"
655 # Include automatically generated dependency files
656 -include $(wildcard *.d */*.d)