From aff94b88c4ec057f20950d5e7a88b90cc4d97dce Mon Sep 17 00:00:00 2001 From: David 'Digit' Turner Date: Mon, 7 Feb 2011 18:10:54 +0100 Subject: 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 --- Makefile.common | 613 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 613 insertions(+) create mode 100644 Makefile.common (limited to 'Makefile.common') diff --git a/Makefile.common b/Makefile.common new file mode 100644 index 0000000..e872734 --- /dev/null +++ b/Makefile.common @@ -0,0 +1,613 @@ +# When building this project, we actually generate several components which +# are the following: +# +# - the emulator-ui program (which is target-agnostic) +# - the target-specific qemu-android-$ARCH programs (headless emulation engines) +# - the "standalone" emulator programs (embed both UI and engine in a single +# binary and process), i.e. "emulator" for ARM and "emulator-x86" for x86. +# +# This file defines static host libraries that will be used by at least two +# of these components. +# + +############################################################################## +############################################################################## +### +### emulator-common: LIBRARY OF COMMON FUNCTIONS +### +### THESE ARE POTENTIALLY USED BY ALL COMPONENTS +### + +$(call start-emulator-library, emulator-common) + +EMULATOR_COMMON_CFLAGS := + +# Needed by everything about the host +EMULATOR_COMMON_CFLAGS += \ + -I$(LOCAL_PATH)/android/config/$(QEMU_HOST_TAG) + +# add the build ID to the default macro definitions +ifeq ($(BUILD_STANDALONE_EMULATOR),) +EMULATOR_COMMON_CFLAGS += -DANDROID_BUILD_ID="$(strip $(BUILD_ID))-$(strip $(BUILD_NUMBER))" +endif + +# For non-standalone builds, extract the major version number from the Android SDK +# tools revision number. +ifneq ($(BUILD_STANDALONE_EMULATOR),true) + ANDROID_SDK_TOOLS_REVISION := $(shell awk -F= '/Pkg.Revision/ { print $$2; }' sdk/files/tools_source.properties) +endif + +ANDROID_SDK_TOOLS_REVISION := $(strip $(ANDROID_SDK_TOOLS_REVISION)) +ifdef ANDROID_SDK_TOOLS_REVISION + EMULATOR_COMMON_CFLAGS += -DANDROID_SDK_TOOLS_REVISION=$(ANDROID_SDK_TOOLS_REVISION) +endif + +# Enable large-file support (i.e. make off_t a 64-bit value) +ifeq ($(HOST_OS),linux) +EMULATOR_COMMON_CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE +endif + +########################################################### +# Zlib sources +# +ZLIB_DIR := distrib/zlib-1.2.3 +include $(LOCAL_PATH)/$(ZLIB_DIR)/sources.make +EMULATOR_COMMON_CFLAGS += -I$(LOCAL_PATH)/$(ZLIB_DIR) + +LOCAL_SRC_FILES += $(ZLIB_SOURCES) + +########################################################### +# Android utility functions +# +LOCAL_SRC_FILES += \ + sockets.c \ + iolooper-select.c \ + android/async-console.c \ + android/async-utils.c \ + android/charmap.c \ + android/framebuffer.c \ + android/keycode-array.c \ + android/avd/hw-config.c \ + android/avd/info.c \ + android/sync-utils.c \ + android/utils/assert.c \ + android/utils/bufprint.c \ + android/utils/debug.c \ + android/utils/dirscanner.c \ + android/utils/filelock.c \ + android/utils/ini.c \ + android/utils/mapfile.c \ + android/utils/misc.c \ + android/utils/panic.c \ + android/utils/path.c \ + android/utils/reflist.c \ + android/utils/refset.c \ + android/utils/stralloc.c \ + android/utils/system.c \ + android/utils/tempfile.c \ + android/utils/vector.c \ + +LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS) + +$(call end-emulator-library) + +############################################################################## +############################################################################## +### +### emulator-libui: LIBRARY OF UI-RELATED FUNCTIONS +### +### THESE ARE USED BY 'emulator-ui' AND THE STANDALONE PROGRAMS +### + +$(call start-emulator-library, emulator-libui) + +EMULATOR_LIBUI_CFLAGS := + +LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS) + +########################################################### +# Libpng configuration +# +LIBPNG_DIR := distrib/libpng-1.2.19 +include $(LOCAL_PATH)/$(LIBPNG_DIR)/sources.make + +EMULATOR_LIBUI_CFLAGS += \ + $(LIBPNG_CFLAGS) \ + -I$(LOCAL_PATH)/$(LIBPNG_DIR) + +LOCAL_SRC_FILES += $(LIBPNG_SOURCES) loadpng.c + +############################################################################## +# SDL-related definitions +# + +# Build SDL from sources except in certain cases where we use +# prebuilt libraries instead. +# +BUILD_SDL_FROM_SOURCES := true + +# On linux-x86, using the prebuilts avoid installing all the X11 +# development packages on our build servers. +# +ifeq ($(QEMU_HOST_TAG),linux-x86) + BUILD_SDL_FROM_SOURCES := false +endif + +# On darwin-x86, a bug in the Android build system prevents the compilation +# of Objective-C sources. Fixed recently in AOSP, but we still use the +# prebuilts for the benefit of older platform branches. +# +ifeq ($(QEMU_HOST_TAG),darwin-x86) + BUILD_SDL_FROM_SOURCES := false +endif + +# If we're building with android-configure.sh && make, always build from +# sources to catch regressions as soon as they happen. +# +ifeq ($(BUILD_STANDALONE_EMULATOR),true) + BUILD_SDL_FROM_SOURCES := true +endif + +# Except if we used android-configure.sh --sdl-config=