Initial Contribution
diff --git a/core/combo/darwin-x86.mk b/core/combo/darwin-x86.mk
new file mode 100644
index 0000000..cc6a895
--- /dev/null
+++ b/core/combo/darwin-x86.mk
@@ -0,0 +1,101 @@
+# Configuration for Darwin (Mac OS X) on PPC.
+# Included by combo/select.make
+
+$(combo_target)GLOBAL_CFLAGS += -fPIC
+$(combo_target)NO_UNDEFINED_LDFLAGS := -Wl,-undefined,error
+
+$(combo_target)CC := $(CC)
+$(combo_target)CXX := $(CXX)
+$(combo_target)AR := $(AR)
+
+$(combo_target)SHLIB_SUFFIX := .dylib
+$(combo_target)JNILIB_SUFFIX := .jnilib
+
+$(combo_target)GLOBAL_CFLAGS += \
+ -include $(call select-android-config-h,darwin-x86)
+$(combo_target)RUN_RANLIB_AFTER_COPYING := true
+
+ifeq ($(combo_target),TARGET_)
+$(combo_target)CUSTOM_LD_COMMAND := true
+define transform-o-to-shared-lib-inner
+ $(TARGET_CXX) \
+ -dynamiclib -single_module -read_only_relocs suppress \
+ $(TARGET_GLOBAL_LD_DIRS) \
+ $(PRIVATE_ALL_OBJECTS) \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
+ $(PRIVATE_LDLIBS) \
+ -o $@ \
+ $(PRIVATE_LDFLAGS) \
+ $(if $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES),-all_load) \
+ $(TARGET_LIBGCC)
+endef
+
+define transform-o-to-executable-inner
+ $(TARGET_CXX) \
+ -o $@ \
+ -Wl,-dynamic -headerpad_max_install_names \
+ $(TARGET_GLOBAL_LD_DIRS) \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
+ $(PRIVATE_ALL_OBJECTS) \
+ $(PRIVATE_LDLIBS) \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
+ $(TARGET_LIBGCC)
+endef
+
+define transform-o-to-static-executable-inner
+ $(TARGET_CXX) \
+ -static \
+ -o $@ \
+ $(TARGET_GLOBAL_LD_DIRS) \
+ $(PRIVATE_LDFLAGS) \
+ $(PRIVATE_ALL_OBJECTS) \
+ $(PRIVATE_LDLIBS) \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
+ $(TARGET_LIBGCC)
+endef
+
+else
+$(combo_target)CUSTOM_LD_COMMAND := true
+
+define transform-host-o-to-shared-lib-inner
+ $(HOST_CXX) \
+ -dynamiclib -single_module -read_only_relocs suppress \
+ $(HOST_GLOBAL_LD_DIRS) \
+ $(PRIVATE_ALL_OBJECTS) \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
+ $(PRIVATE_LDLIBS) \
+ -o $@ \
+ $(PRIVATE_LDFLAGS) \
+ $(HOST_LIBGCC)
+endef
+
+define transform-host-o-to-executable-inner
+$(HOST_CXX) \
+ -o $@ \
+ -Wl,-dynamic -headerpad_max_install_names \
+ $(HOST_GLOBAL_LD_DIRS) \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
+ $(PRIVATE_ALL_OBJECTS) \
+ $(PRIVATE_LDLIBS) \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
+ $(HOST_LIBGCC)
+endef
+
+# $(1): The file to check
+define get-file-size
+stat -f "%z" $(1)
+endef
+
+# Which gcc to use to build qemu, which doesn't work right when
+# built with 4.2.1 or later.
+GCCQEMU := prebuilt/darwin-x86/toolchain/i686-apple-darwin8-4.0.1/bin/gcc
+
+endif
+
diff --git a/core/combo/javac.mk b/core/combo/javac.mk
new file mode 100644
index 0000000..2ce5593
--- /dev/null
+++ b/core/combo/javac.mk
@@ -0,0 +1,37 @@
+# Selects a Java compiler.
+#
+# Inputs:
+# CUSTOM_JAVA_COMPILER -- "eclipse", "openjdk". or nothing for the system
+# default
+#
+# Outputs:
+# COMMON_JAVAC -- Java compiler command with common arguments
+
+# Whatever compiler is on this system.
+ifeq ($(HOST_OS), windows)
+ COMMON_JAVAC := prebuilt/windows/host/bin/javawrap.exe -J-Xmx256m \
+ -target 1.5 -Xmaxerrs 9999999
+else
+ COMMON_JAVAC := javac -J-Xmx256m -target 1.5 -Xmaxerrs 9999999
+endif
+
+# Eclipse.
+ifeq ($(CUSTOM_JAVA_COMPILER), eclipse)
+ COMMON_JAVAC := java -Xmx256m -jar prebuilt/common/ecj/ecj.jar -5 \
+ -maxProblems 9999999 -nowarn
+ $(info CUSTOM_JAVA_COMPILER=eclipse)
+endif
+
+# OpenJDK.
+ifeq ($(CUSTOM_JAVA_COMPILER), openjdk)
+ # We set the VM options (like -Xmx) in the javac script.
+ COMMON_JAVAC := prebuilt/common/openjdk/bin/javac -target 1.5 \
+ -Xmaxerrs 9999999
+ $(info CUSTOM_JAVA_COMPILER=openjdk)
+endif
+
+HOST_JAVAC ?= $(COMMON_JAVAC)
+TARGET_JAVAC ?= $(COMMON_JAVAC)
+
+#$(info HOST_JAVAC=$(HOST_JAVAC))
+#$(info TARGET_JAVAC=$(TARGET_JAVAC))
diff --git a/core/combo/linux-arm.mk b/core/combo/linux-arm.mk
new file mode 100644
index 0000000..adb82d3
--- /dev/null
+++ b/core/combo/linux-arm.mk
@@ -0,0 +1,153 @@
+# Configuration for Linux on ARM.
+# Included by combo/select.make
+
+# You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else
+ifeq ($(strip $($(combo_target)TOOLS_PREFIX)),)
+$(combo_target)TOOLS_PREFIX := \
+ prebuilt/$(HOST_PREBUILT_TAG)/toolchain/arm-eabi-4.2.1/bin/arm-eabi-
+endif
+
+$(combo_target)CC := $($(combo_target)TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)
+$(combo_target)CXX := $($(combo_target)TOOLS_PREFIX)g++$(HOST_EXECUTABLE_SUFFIX)
+$(combo_target)AR := $($(combo_target)TOOLS_PREFIX)ar$(HOST_EXECUTABLE_SUFFIX)
+$(combo_target)OBJCOPY := $($(combo_target)TOOLS_PREFIX)objcopy$(HOST_EXECUTABLE_SUFFIX)
+$(combo_target)LD := $($(combo_target)TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX)
+
+$(combo_target)NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
+
+TARGET_arm_release_CFLAGS := -fomit-frame-pointer \
+ -fstrict-aliasing \
+ -funswitch-loops \
+ -finline-limit=300
+
+TARGET_thumb_release_CFLAGS := -mthumb \
+ -Os \
+ -fomit-frame-pointer \
+ -fno-strict-aliasing \
+ -finline-limit=64
+
+# When building for debug, compile everything as arm.
+TARGET_arm_debug_CFLAGS := $(TARGET_arm_release_CFLAGS) -fno-omit-frame-pointer -fno-strict-aliasing
+TARGET_thumb_debug_CFLAGS := $(TARGET_thumb_release_CFLAGS) -marm -fno-omit-frame-pointer
+
+# NOTE: if you try to build a debug build with thumb, several
+# of the libraries (libpv, libwebcore, libkjs) need to be built
+# with -mlong-calls. When built at -O0, those libraries are
+# too big for a thumb "BL <label>" to go from one end to the other.
+
+## As hopefully a temporary hack,
+## use this to force a full ARM build (for easier debugging in gdb)
+## (don't forget to do a clean build)
+##TARGET_arm_release_CFLAGS := $(TARGET_arm_release_CFLAGS) -fno-omit-frame-pointer
+##TARGET_thumb_release_CFLAGS := $(TARGET_thumb_release_CFLAGS) -marm -fno-omit-frame-pointer
+
+## on some hosts, the target cross-compiler is not available so do not run this command
+ifneq ($(wildcard $($(combo_target)CC)),)
+$(combo_target)LIBGCC := $(shell $($(combo_target)CC) -mthumb-interwork -print-libgcc-file-name)
+endif
+
+$(combo_target)GLOBAL_CFLAGS += \
+ -march=armv5te -mtune=xscale \
+ -msoft-float -fpic \
+ -mthumb-interwork \
+ -ffunction-sections \
+ -funwind-tables \
+ -fstack-protector \
+ -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ \
+ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ \
+ -include $(call select-android-config-h,linux-arm)
+
+$(combo_target)GLOBAL_CPPFLAGS += -fvisibility-inlines-hidden
+
+$(combo_target)RELEASE_CFLAGS := \
+ -DSK_RELEASE -DNDEBUG \
+ -O2 -g \
+ -Wstrict-aliasing=2 \
+ -finline-functions \
+ -fno-inline-functions-called-once \
+ -fgcse-after-reload \
+ -frerun-cse-after-loop \
+ -frename-registers
+
+libc_root := bionic/libc
+libm_root := bionic/libm
+libstdc++_root := bionic/libstdc++
+libthread_db_root := bionic/libthread_db
+
+# unless CUSTOM_KERNEL_HEADERS is defined, we're going to use
+# symlinks located in out/ to point to the appropriate kernel
+# headers. see 'config/kernel_headers.make' for more details
+#
+ifneq ($(CUSTOM_KERNEL_HEADERS),)
+ KERNEL_HEADERS_COMMON := $(CUSTOM_KERNEL_HEADERS)
+ KERNEL_HEADERS_ARCH := $(CUSTOM_KERNEL_HEADERS)
+else
+ KERNEL_HEADERS_COMMON := $(libc_root)/kernel/common
+ KERNEL_HEADERS_ARCH := $(libc_root)/kernel/arch-$(TARGET_ARCH)
+endif
+KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH)
+
+$(combo_target)C_INCLUDES := \
+ $(libc_root)/arch-arm/include \
+ $(libc_root)/include \
+ $(libstdc++_root)/include \
+ $(KERNEL_HEADERS) \
+ $(libm_root)/include \
+ $(libm_root)/include/arch/arm \
+ $(libthread_db_root)/include
+
+TARGET_CRTBEGIN_STATIC_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_static.o
+TARGET_CRTBEGIN_DYNAMIC_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_dynamic.o
+TARGET_CRTEND_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_android.o
+
+TARGET_STRIP_MODULE:=true
+
+$(combo_target)DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm
+
+$(combo_target)CUSTOM_LD_COMMAND := true
+define transform-o-to-shared-lib-inner
+$(TARGET_CXX) \
+ -nostdlib -Wl,-soname,$(notdir $@) -Wl,-T,$(BUILD_SYSTEM)/armelf.xsc \
+ -Wl,--gc-sections \
+ -Wl,-shared,-Bsymbolic \
+ $(TARGET_GLOBAL_LD_DIRS) \
+ $(PRIVATE_ALL_OBJECTS) \
+ -Wl,--whole-archive \
+ $(call normalize-host-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
+ -Wl,--no-whole-archive \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
+ -o $@ \
+ $(PRIVATE_LDFLAGS) \
+ $(TARGET_LIBGCC)
+endef
+
+define transform-o-to-executable-inner
+$(TARGET_CXX) -nostdlib -Bdynamic -Wl,-T,$(BUILD_SYSTEM)/armelf.x \
+ -Wl,-dynamic-linker,/system/bin/linker \
+ -Wl,--gc-sections \
+ -Wl,-z,nocopyreloc \
+ -o $@ \
+ $(TARGET_GLOBAL_LD_DIRS) \
+ -Wl,-rpath-link=$(TARGET_OUT_INTERMEDIATE_LIBRARIES) \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
+ $(TARGET_CRTBEGIN_DYNAMIC_O) \
+ $(PRIVATE_ALL_OBJECTS) \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
+ $(PRIVATE_LDFLAGS) \
+ $(TARGET_LIBGCC) \
+ $(TARGET_CRTEND_O)
+endef
+
+define transform-o-to-static-executable-inner
+$(TARGET_CXX) -nostdlib -Bstatic -Wl,-T,$(BUILD_SYSTEM)/armelf.x \
+ -Wl,--gc-sections \
+ -o $@ \
+ $(TARGET_GLOBAL_LD_DIRS) \
+ $(TARGET_CRTBEGIN_STATIC_O) \
+ $(PRIVATE_LDFLAGS) \
+ $(PRIVATE_ALL_OBJECTS) \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
+ $(TARGET_LIBGCC) \
+ $(TARGET_CRTEND_O)
+endef
diff --git a/core/combo/linux-x86.mk b/core/combo/linux-x86.mk
new file mode 100644
index 0000000..d3ad566
--- /dev/null
+++ b/core/combo/linux-x86.mk
@@ -0,0 +1,27 @@
+# Configuration for Linux on x86.
+# Included by combo/select.make
+
+# right now we get these from the environment, but we should
+# pick them from the tree somewhere
+$(combo_target)CC := $(CC)
+$(combo_target)CXX := $(CXX)
+$(combo_target)AR := $(AR)
+
+$(combo_target)GLOBAL_CFLAGS += -fPIC -m32
+$(combo_target)GLOBAL_CFLAGS += \
+ -include $(call select-android-config-h,linux-x86)
+$(combo_target)GLOBAL_LDFLAGS += -m32
+
+$(combo_target)NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
+
+ifeq ($(combo_target),HOST_)
+# $(1): The file to check
+define get-file-size
+stat --format "%s" "$(1)"
+endef
+
+# Which gcc to use to build qemu, which doesn't work right when
+# built with 4.2.1 or later.
+GCCQEMU := prebuilt/linux-x86/toolchain/i686-linux-gnu-3.4.6/bin/gcc
+
+endif # HOST
diff --git a/core/combo/select.mk b/core/combo/select.mk
new file mode 100644
index 0000000..ff56f62
--- /dev/null
+++ b/core/combo/select.mk
@@ -0,0 +1,61 @@
+# Select a combo based on the compiler being used.
+#
+# Inputs:
+# combo_target -- prefix for final variables (HOST_ or TARGET_)
+#
+# Outputs:
+# $(combo_target)OS -- standard name for this host (LINUX, DARWIN, etc.)
+# $(combo_target)ARCH -- standard name for process architecture (powerpc, x86, etc.)
+# $(combo_target)GLOBAL_CFLAGS -- C compiler flags to use for everything
+# $(combo_target)DEBUG_CFLAGS -- additional C compiler flags for debug builds
+# $(combo_target)RELEASE_CFLAGS -- additional C compiler flags for release builds
+# $(combo_target)GLOBAL_ARFLAGS -- flags to use for static linking everything
+# $(combo_target)SHLIB_SUFFIX -- suffix of shared libraries
+
+# Build a target string like "linux-arm" or "darwin-x86".
+combo_os_arch := $($(combo_target)OS)-$($(combo_target)ARCH)
+
+# Set the defaults.
+
+HOST_CC ?= $(CC)
+HOST_CXX ?= $(CXX)
+HOST_AR ?= $(AR)
+
+$(combo_target)BINDER_MINI := 0
+
+$(combo_target)HAVE_EXCEPTIONS := 0
+$(combo_target)HAVE_UNIX_FILE_PATH := 1
+$(combo_target)HAVE_WINDOWS_FILE_PATH := 0
+$(combo_target)HAVE_RTTI := 1
+$(combo_target)HAVE_CALL_STACKS := 1
+$(combo_target)HAVE_64BIT_IO := 1
+$(combo_target)HAVE_CLOCK_TIMERS := 1
+$(combo_target)HAVE_PTHREAD_RWLOCK := 1
+$(combo_target)HAVE_STRNLEN := 1
+$(combo_target)HAVE_STRERROR_R_STRRET := 1
+$(combo_target)HAVE_STRLCPY := 0
+$(combo_target)HAVE_STRLCAT := 0
+$(combo_target)HAVE_KERNEL_MODULES := 0
+
+# These flags might (will) be overridden by the target makefiles
+$(combo_target)GLOBAL_CFLAGS := -fno-exceptions -Wno-multichar
+$(combo_target)DEBUG_CFLAGS := -O0 -g
+$(combo_target)RELEASE_CFLAGS := -O2 -g -fno-strict-aliasing
+$(combo_target)GLOBAL_ARFLAGS := crs
+
+$(combo_target)EXECUTABLE_SUFFIX :=
+$(combo_target)SHLIB_SUFFIX := .so
+$(combo_target)JNILIB_SUFFIX := $($(combo_target)SHLIB_SUFFIX)
+$(combo_target)STATIC_LIB_SUFFIX := .a
+
+$(combo_target)PRELINKER_MAP := $(BUILD_SYSTEM)/prelink-$(combo_os_arch).map
+
+# Now include the combo for this specific target.
+include $(BUILD_COMBOS)/$(combo_os_arch).mk
+
+ifneq ($(USE_CCACHE),)
+ ccache := prebuilt/$(HOST_PREBUILT_TAG)/ccache/ccache
+ $(combo_target)CC := $(ccache) $($(combo_target)CC)
+ $(combo_target)CXX := $(ccache) $($(combo_target)CXX)
+ ccache =
+endif
diff --git a/core/combo/windows-x86.mk b/core/combo/windows-x86.mk
new file mode 100644
index 0000000..e32a077
--- /dev/null
+++ b/core/combo/windows-x86.mk
@@ -0,0 +1,53 @@
+# Configuration for Linux on x86.
+# Included by combo/select.make
+
+# right now we get these from the environment, but we should
+# pick them from the tree somewhere
+TOOLS_PREFIX := #prebuilt/windows/host/bin/
+TOOLS_EXE_SUFFIX := .exe
+
+# Settings to use MinGW has a cross-compiler under Linux
+ifneq ($(findstring Linux,$(UNAME)),)
+ifneq ($(strip $(USE_MINGW)),)
+HOST_ACP_UNAVAILABLE := true
+TOOLS_PREFIX := /usr/bin/i586-mingw32msvc-
+TOOLS_EXE_SUFFIX :=
+$(combo_target)GLOBAL_CFLAGS += -DUSE_MINGW
+$(combo_target)C_INCLUDES += /usr/lib/gcc/i586-mingw32msvc/3.4.4/include
+$(combo_target)GLOBAL_LD_DIRS += -L/usr/i586-mingw32msvc/lib
+endif
+endif
+
+$(combo_target)CC := $(TOOLS_PREFIX)gcc$(TOOLS_EXE_SUFFIX)
+$(combo_target)CXX := $(TOOLS_PREFIX)g++$(TOOLS_EXE_SUFFIX)
+$(combo_target)AR := $(TOOLS_PREFIX)ar$(TOOLS_EXE_SUFFIX)
+
+$(combo_target)GLOBAL_CFLAGS += -include $(call select-android-config-h,windows)
+$(combo_target)GLOBAL_LDFLAGS += --enable-stdcall-fixup
+
+# when building under Cygwin, ensure that we use Mingw compilation by default.
+# you can disable this (i.e. to generate Cygwin executables) by defining the
+# USE_CYGWIN variable in your environment, e.g.:
+#
+# export USE_CYGWIN=1
+#
+# note that the -mno-cygwin flags are not needed when cross-compiling the
+# Windows host tools on Linux
+#
+ifneq ($(findstring CYGWIN,$(UNAME)),)
+ifeq ($(strip $(USE_CYGWIN)),)
+$(combo_target)GLOBAL_CFLAGS += -mno-cygwin
+$(combo_target)GLOBAL_LDFLAGS += -mno-cygwin -mconsole
+endif
+endif
+
+$(combo_target)SHLIB_SUFFIX := .dll
+$(combo_target)EXECUTABLE_SUFFIX := .exe
+
+ifeq ($(combo_target),HOST_)
+# $(1): The file to check
+# TODO: find out what format cygwin's stat(1) uses
+define get-file-size
+999999999
+endef
+endif