aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile.target
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2011-02-07 18:10:54 +0100
committerDavid 'Digit' Turner <digit@android.com>2011-02-24 01:15:23 +0100
commitaff94b88c4ec057f20950d5e7a88b90cc4d97dce (patch)
tree589c82139a6575bec8202eb4bb4c792729a870de /Makefile.target
parent02f10347d2244c192de8da96a6d6a6a66c394721 (diff)
downloadexternal_qemu-aff94b88c4ec057f20950d5e7a88b90cc4d97dce.zip
external_qemu-aff94b88c4ec057f20950d5e7a88b90cc4d97dce.tar.gz
external_qemu-aff94b88c4ec057f20950d5e7a88b90cc4d97dce.tar.bz2
Build arm and x86 binaries at the same time.
This patch modifies the way we build the emulator's various programs. It reduces the number of static libraries generated, and better segregates between common, ui, qemu and target-specific code. Note that we build both the arm and x86 binaries at the same time in all build scenarios for now. This is done to catch build regressions as soon as possible. Change-Id: I6240705041e137e32f207e1e2444c614c52aaf05
Diffstat (limited to 'Makefile.target')
-rw-r--r--Makefile.target353
1 files changed, 353 insertions, 0 deletions
diff --git a/Makefile.target b/Makefile.target
new file mode 100644
index 0000000..ab263bd
--- /dev/null
+++ b/Makefile.target
@@ -0,0 +1,353 @@
+# This file is included several times to build target-specific
+# modules for the Android emulator. It will be called several times
+# (e.g. once for the arm target, and once for the x86 target).
+#
+
+ifndef EMULATOR_TARGET_ARCH
+$(error EMULATOR_TARGET_ARCH is not defined!)
+endif
+
+EMULATOR_TARGET_CPU := $(EMULATOR_TARGET_ARCH)
+ifeq ($(EMULATOR_TARGET_CPU),x86)
+ EMULATOR_TARGET_CPU := i386
+endif
+
+##############################################################################
+##############################################################################
+###
+### emulator-target-$CPU: target-specific emulation code.
+###
+### Used by both the core and standalone programs.
+###
+
+# Common compiler flags for all target-dependent libraries
+EMULATOR_TARGET_CFLAGS := \
+ -I$(LOCAL_PATH)/android/config/$(HOST_PREBUILT_TAG) \
+ -I$(LOCAL_PATH)/android/config/target-$(EMULATOR_TARGET_ARCH) \
+ -I$(LOCAL_PATH)/target-$(EMULATOR_TARGET_CPU) \
+ -I$(LOCAL_PATH)/fpu \
+ -DNEED_CPU_H \
+
+TCG_TARGET := $(HOST_ARCH)
+ifeq ($(TCG_TARGET),x86)
+ TCG_TARGET := i386
+endif
+
+EMULATOR_TARGET_CFLAGS += \
+ -I$(LOCAL_PATH)/tcg \
+ -I$(LOCAL_PATH)/tcg/$(TCG_TARGET) \
+ -DTARGET_ARCH=\"$(EMULATOR_TARGET_ARCH)\"
+
+
+$(call start-emulator-library, emulator-target-$(EMULATOR_TARGET_CPU))
+
+# The following is to ensure that "config.h" will map to a target-specific
+# configuration file header.
+LOCAL_CFLAGS += $(EMULATOR_TARGET_CFLAGS)
+
+LOCAL_SRC_FILES += \
+ tcg/tcg.c \
+
+##############################################################################
+# Emulated hardware devices.
+#
+
+HW_SOURCES := \
+ bt.c \
+ bt-hci.c \
+ bt-hid.c \
+ bt-l2cap.c \
+ bt-sdp.c \
+ cdrom.c \
+ dma.c \
+ irq.c \
+ goldfish_device.c \
+ goldfish_events_device.c \
+ goldfish_fb.c \
+ goldfish_battery.c \
+ goldfish_mmc.c \
+ goldfish_memlog.c \
+ goldfish_nand.c \
+ goldfish_tty.c \
+ msmouse.c \
+ pci.c \
+ qdev.c \
+ scsi-disk.c \
+ sysbus.c \
+ usb-hid.c \
+ usb-hub.c \
+ usb-msd.c \
+ usb-ohci.c \
+ usb.c \
+ watchdog.c
+
+ifeq ($(EMULATOR_TARGET_ARCH),arm)
+HW_SOURCES += android_arm.c \
+ arm_pic.c \
+ goldfish_audio.c \
+ goldfish_interrupt.c \
+ goldfish_switch.c \
+ goldfish_timer.c \
+ goldfish_trace.c \
+ arm_boot.c \
+
+# The following sources must be compiled with the final executables
+# because they contain device_init() or machine_init() statements.
+HW_OBJ_SOURCES := hw/smc91c111.c
+HW_OBJ_CFLAGS := $(EMULATOR_TARGET_CFLAGS)
+
+LOCAL_SRC_FILES += arm-dis.c
+
+# smc91c111.c requires <zlib.h>
+LOCAL_CFLAGS += $(ZLIB_CFLAGS)
+endif
+
+ifeq ($(EMULATOR_TARGET_ARCH),x86)
+HW_SOURCES += \
+ apic.c \
+ i8259.c \
+ mc146818rtc.c \
+ piix_pci.c \
+ i8254.c \
+ pckbd.c \
+ ioapic.c \
+ ps2.c \
+ smbios.c \
+ fw_cfg.c
+
+# The following sources must be compiled with the final executables
+# because they contain device_init() or machine_init() statements.
+HW_OBJ_SOURCES := \
+ hw/ne2000.c \
+ hw/pc.c
+
+HW_OBJ_CFLAGS := $(EMULATOR_TARGET_CFLAGS)
+
+endif
+
+LOCAL_SRC_FILES += $(HW_SOURCES:%=hw/%)
+
+LOCAL_SRC_FILES += \
+ exec.c \
+ cpu-exec.c \
+ translate-all.c \
+ trace.c \
+ varint.c \
+ dcache.c \
+ softmmu_outside_jit.c \
+
+##############################################################################
+# CPU-specific emulation.
+#
+LOCAL_CFLAGS += -fno-PIC -fomit-frame-pointer -Wno-sign-compare
+
+ifeq ($(HOST_ARCH),ppc)
+ LOCAL_CFLAGS += -D__powerpc__
+endif
+
+ifeq ($(EMULATOR_TARGET_ARCH),arm)
+LOCAL_SRC_FILES += \
+ target-arm/op_helper.c \
+ target-arm/iwmmxt_helper.c \
+ target-arm/neon_helper.c \
+ target-arm/helper.c \
+ target-arm/translate.c \
+ target-arm/machine.c \
+ hw/armv7m.c \
+ hw/armv7m_nvic.c \
+ arm-semi.c \
+
+LOCAL_SRC_FILES += fpu/softfloat.c
+endif
+
+ifeq ($(EMULATOR_TARGET_ARCH), x86)
+LOCAL_SRC_FILES += \
+ target-i386/op_helper.c \
+ target-i386/helper.c \
+ target-i386/translate.c \
+ target-i386/machine.c \
+
+LOCAL_SRC_FILES += fpu/softfloat-native.c
+endif
+
+##############################################################################
+# Memory-access checking support.
+# Memory access checker uses information collected by instrumented code in
+# libc.so in order to keep track of memory blocks allocated from heap. Memory
+# checker then uses this information to make sure that every access to allocated
+# memory is within allocated block. This information also allows detecting
+# memory leaks and attempts to free/realloc invalid pointers.
+#
+LOCAL_CFLAGS += \
+ -I$(LOCAL_PATH)/memcheck \
+ -I$(LOCAL_PATH)/elff
+
+MCHK_SOURCES := \
+ memcheck.c \
+ memcheck_proc_management.c \
+ memcheck_malloc_map.c \
+ memcheck_mmrange_map.c \
+ memcheck_util.c \
+
+LOCAL_SRC_FILES += $(MCHK_SOURCES:%=memcheck/%)
+
+
+$(call end-emulator-library)
+
+##############################################################################
+##############################################################################
+###
+### qemu-android-$CPU: headless emulator core program
+###
+###
+$(call start-emulator-program, qemu-android-$(EMULATOR_TARGET_ARCH))
+
+LOCAL_CFLAGS += \
+ $(EMULATOR_COMMON_CFLAGS) \
+ $(ELFF_CFLAGS) \
+ $(EMULATOR_LIBQEMU_CFLAGS) \
+ $(EMULATOR_TARGET_CFLAGS) \
+ -DCONFIG_STANDALONE_CORE \
+
+LOCAL_CFLAGS += -Wno-missing-field-initializers
+
+
+LOCAL_STATIC_LIBRARIES := \
+ emulator-libqemu \
+ emulator-target-$(EMULATOR_TARGET_CPU) \
+ emulator-libelff \
+ emulator-common \
+
+
+LOCAL_LDLIBS += \
+ $(EMULATOR_COMMON_LDLIBS) \
+ $(EMULATOR_LIBQEMU_LDLIBS) \
+ $(ELFF_LDLIBS) \
+
+LOCAL_SRC_FILES := \
+ audio/audio.c \
+ disas.c \
+ dma-helpers.c \
+ gdbstub.c \
+ keymaps.c \
+ loader.c \
+ monitor.c \
+ qemu-timer.c \
+ user-events-qemu.c \
+ vl-android.c \
+ android/console.c \
+ android/display-core.c \
+ android/protocol/attach-ui-proxy.c \
+ android/protocol/fb-updates-proxy.c \
+ android/protocol/user-events-impl.c \
+ android/protocol/ui-commands-proxy.c \
+ android/protocol/core-commands-impl.c \
+ android/protocol/core-commands-qemu.c \
+
+$(call gen-hx-header,qemu-monitor.hx,monitor.c)
+$(call gen-hx-header,qemu-options.hx,vl-android.c)
+
+ifeq ($(HOST_OS),darwin)
+ FRAMEWORKS := OpenGL Cocoa QuickTime ApplicationServices Carbon IOKit
+ LOCAL_LDLIBS += $(FRAMEWORKS:%=-Wl,-framework,%)
+endif
+
+# Generate a completely static executable if needed.
+# Note that this means no sound and graphics on Linux.
+#
+ifeq ($(CONFIG_STATIC_EXECUTABLE),true)
+ LOCAL_SRC_FILES += dynlink-static.c
+ LOCAL_LDLIBS += -static
+endif
+
+# The following files cannot be in static libraries because they contain
+# constructor functions that are otherwise stripped by the final linker
+LOCAL_SRC_FILES += $(HW_OBJ_SOURCES)
+LOCAL_CFLAGS += $(HW_OBJ_CFLAGS)
+
+LOCAL_SRC_FILES += $(BLOCK_SOURCES)
+LOCAL_CFLAGS += $(BLOCK_CFLAGS)
+
+LOCAL_MODULE_TAGS := debug
+
+$(call end-emulator-program)
+
+##############################################################################
+##############################################################################
+###
+### emulator-$ARCH: Standalone emulator program
+###
+###
+
+# Special case, "emulator-arm" is named "emulator" for now.
+ifeq ($(EMULATOR_TARGET_ARCH),arm)
+$(call start-emulator-program, emulator)
+else
+$(call start-emulator-program, emulator-$(EMULATOR_TARGET_ARCH))
+endif
+
+LOCAL_STATIC_LIBRARIES := \
+ emulator-libui \
+ emulator-libqemu \
+ emulator-target-$(EMULATOR_TARGET_CPU) \
+ emulator-libelff \
+ emulator-common \
+
+LOCAL_LDLIBS += \
+ $(EMULATOR_COMMON_LDLIBS) \
+ $(EMULATOR_LIBQEMU_LDLIBS) \
+ $(EMULATOR_LIBUI_LDLIBS) \
+ $(ELFF_LDLIBS) \
+
+LOCAL_CFLAGS += \
+ $(EMULATOR_TARGET_CFLAGS) \
+ $(EMULATOR_COMMON_CFLAGS) \
+ $(EMULATOR_LIBQEMU_CFLAGS) \
+ $(EMULATOR_LIBUI_CFLAGS)
+
+LOCAL_SRC_FILES := \
+ audio/audio.c \
+ disas.c \
+ dma-helpers.c \
+ gdbstub.c \
+ keymaps.c \
+ loader.c \
+ monitor.c \
+ qemu-timer.c \
+ user-events-qemu.c \
+ vl-android.c \
+ android/cmdline-option.c \
+ android/console.c \
+ android/display.c \
+ android/display-core.c \
+ android/help.c \
+ android/main-common.c \
+ android/main.c \
+ android/protocol/core-commands-qemu.c \
+ android/protocol/ui-commands-qemu.c \
+ android/
+
+$(call gen-hx-header,qemu-monitor.hx,monitor.c)
+$(call gen-hx-header,qemu-options.hx,vl-android.c)
+
+# The following files cannot be in static libraries because they contain
+# constructor functions that are otherwise stripped by the final linker
+LOCAL_SRC_FILES += $(HW_OBJ_SOURCES)
+LOCAL_CFLAGS += $(HW_OBJ_CFLAGS)
+
+LOCAL_SRC_FILES += $(BLOCK_SOURCES)
+LOCAL_CFLAGS += $(BLOCK_CFLAGS)
+
+LOCAL_SRC_FILES += $(SDLMAIN_SOURCES)
+
+# Generate a completely static executable if needed.
+# Note that this means no sound and graphics on Linux.
+#
+ifeq ($(CONFIG_STATIC_EXECUTABLE),true)
+ LOCAL_SRC_FILES += dynlink-static.c
+ LOCAL_LDLIBS += -static
+endif
+
+LOCAL_STATIC_LIBRARIES += $(SDL_STATIC_LIBRARIES)
+
+$(call end-emulator-program)