Get rid of $(combo_target)

The only OS-ARCH combo that would have benefited from it
is linux-x86, but it explicitly used separate configurations
for the HOST_ and TARGET_ side of things.

This makes is clear which files are related to the HOST_
configuration and which ones are related to the TARGET_
configuration, and expands $(combo_target) to the only
possible/reasonable value that it could have had in every
file.

This also cleans up the simulator, by moving it in a single
place in TARGET_linux_x86 (since the only part that's special
is to use HOST_ settings even when building TARGET_ modules).

Change-Id: I2420eeb8cfe539f5807ec99cb3177ffb9f2476d5
diff --git a/core/combo/HOST_darwin-x86.mk b/core/combo/HOST_darwin-x86.mk
new file mode 100644
index 0000000..bbd78ba
--- /dev/null
+++ b/core/combo/HOST_darwin-x86.mk
@@ -0,0 +1,68 @@
+#
+# Copyright (C) 2006 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Configuration for Darwin (Mac OS X) on x86.
+# Included by combo/select.mk
+
+HOST_GLOBAL_CFLAGS += -fPIC
+HOST_NO_UNDEFINED_LDFLAGS := -Wl,-undefined,error
+
+HOST_CC := $(CC)
+HOST_CXX := $(CXX)
+HOST_AR := $(AR)
+
+HOST_SHLIB_SUFFIX := .dylib
+HOST_JNILIB_SUFFIX := .jnilib
+
+HOST_GLOBAL_CFLAGS += \
+	-include $(call select-android-config-h,darwin-x86)
+HOST_RUN_RANLIB_AFTER_COPYING := true
+HOST_GLOBAL_ARFLAGS := cqs
+
+HOST_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) \
+        $(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
+        $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
+        $(PRIVATE_LDFLAGS) \
+        $(PRIVATE_LDLIBS) \
+        $(HOST_LIBGCC)
+endef
+
+# $(1): The file to check
+define get-file-size
+stat -f "%z" $(1)
+endef
diff --git a/core/combo/HOST_linux-x86.mk b/core/combo/HOST_linux-x86.mk
new file mode 100644
index 0000000..ec443ae
--- /dev/null
+++ b/core/combo/HOST_linux-x86.mk
@@ -0,0 +1,37 @@
+#
+# Copyright (C) 2006 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Configuration for builds hosted on linux-x86.
+# Included by combo/select.mk
+
+# $(1): The file to check
+define get-file-size
+stat --format "%s" "$(1)" | tr -d '\n'
+endef
+
+# The emulator is 32-bit-only. Force host tools to be built
+# in 32-bit when the emulator is involved.
+# Why we don't also force simulator builds to be 32-bit is a mystery.
+ifneq ($(TARGET_SIMULATOR),true)
+HOST_GLOBAL_CFLAGS += -m32
+HOST_GLOBAL_LDFLAGS += -m32
+endif
+
+HOST_GLOBAL_CFLAGS += -fPIC
+HOST_GLOBAL_CFLAGS += \
+	-include $(call select-android-config-h,linux-x86)
+
+HOST_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
diff --git a/core/combo/HOST_windows-x86.mk b/core/combo/HOST_windows-x86.mk
new file mode 100644
index 0000000..9870998
--- /dev/null
+++ b/core/combo/HOST_windows-x86.mk
@@ -0,0 +1,67 @@
+#
+# Copyright (C) 2006 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# 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 :=
+HOST_GLOBAL_CFLAGS += -DUSE_MINGW
+HOST_C_INCLUDES += /usr/lib/gcc/i586-mingw32msvc/3.4.4/include
+HOST_GLOBAL_LD_DIRS += -L/usr/i586-mingw32msvc/lib
+endif
+endif
+
+HOST_CC := $(TOOLS_PREFIX)gcc$(TOOLS_EXE_SUFFIX)
+HOST_CXX := $(TOOLS_PREFIX)g++$(TOOLS_EXE_SUFFIX)
+HOST_AR := $(TOOLS_PREFIX)ar$(TOOLS_EXE_SUFFIX)
+
+HOST_GLOBAL_CFLAGS += -include $(call select-android-config-h,windows)
+HOST_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)),)
+HOST_GLOBAL_CFLAGS += -mno-cygwin
+HOST_GLOBAL_LDFLAGS += -mno-cygwin -mconsole
+endif
+endif
+
+HOST_SHLIB_SUFFIX := .dll
+HOST_EXECUTABLE_SUFFIX := .exe
+
+# $(1): The file to check
+# TODO: find out what format cygwin's stat(1) uses
+define get-file-size
+999999999
+endef
diff --git a/core/combo/linux-arm.mk b/core/combo/TARGET_linux-arm.mk
similarity index 82%
rename from core/combo/linux-arm.mk
rename to core/combo/TARGET_linux-arm.mk
index d2d7ea9..972b10c 100644
--- a/core/combo/linux-arm.mk
+++ b/core/combo/TARGET_linux-arm.mk
@@ -1,5 +1,21 @@
+#
+# Copyright (C) 2006 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
 # Configuration for Linux on ARM.
-# Included by combo/select.make
+# Included by combo/select.mk
 
 # You can set TARGET_ARCH_VARIANT to use an arch version other
 # than ARMv5TE. Each value should correspond to a file named
@@ -14,21 +30,9 @@
 # include defines, and compiler settings for the given architecture
 # version.
 #
-ifeq ($(TARGET_ARCH),arm)
 ifeq ($(strip $(TARGET_ARCH_VARIANT)),)
 TARGET_ARCH_VARIANT := armv5te
 endif
-endif
-
-# TARGET_ARCH_VARIANT used to be called TARGET_ARCH_VERSION
-# to avoid any weirdness, issue an error message if the latter
-# is defined.
-#
-ifneq ($(strip $(TARGET_ARCH_VERSION)),)
-$(info Definition for TARGET_ARCH_VERSION encountered !)
-$(info This variable has been renamed TARGET_ARCH_VARIANT, please update your build files !!)
-$(error Aborting the build.)
-endif
 
 TARGET_ARCH_SPECIFIC_MAKEFILE := $(BUILD_COMBOS)/arch/$(TARGET_ARCH)/$(TARGET_ARCH_VARIANT).mk
 ifeq ($(strip $(wildcard $(TARGET_ARCH_SPECIFIC_MAKEFILE))),)
@@ -38,18 +42,18 @@
 include $(TARGET_ARCH_SPECIFIC_MAKEFILE)
 
 # You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else
-ifeq ($(strip $($(combo_target)TOOLS_PREFIX)),)
-$(combo_target)TOOLS_PREFIX := \
+ifeq ($(strip $(TARGET_TOOLS_PREFIX)),)
+TARGET_TOOLS_PREFIX := \
 	prebuilt/$(HOST_PREBUILT_TAG)/toolchain/arm-eabi-4.4.0/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)
+TARGET_CC := $(TARGET_TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)
+TARGET_CXX := $(TARGET_TOOLS_PREFIX)g++$(HOST_EXECUTABLE_SUFFIX)
+TARGET_AR := $(TARGET_TOOLS_PREFIX)ar$(HOST_EXECUTABLE_SUFFIX)
+TARGET_OBJCOPY := $(TARGET_TOOLS_PREFIX)objcopy$(HOST_EXECUTABLE_SUFFIX)
+TARGET_LD := $(TARGET_TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX)
 
-$(combo_target)NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
+TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
 
 TARGET_arm_CFLAGS :=    -O2 \
                         -fomit-frame-pointer \
@@ -88,7 +92,7 @@
 android_config_h := $(call select-android-config-h,linux-arm)
 arch_include_dir := $(dir $(android_config_h))
 
-$(combo_target)GLOBAL_CFLAGS += \
+TARGET_GLOBAL_CFLAGS += \
 			-msoft-float -fpic \
 			-ffunction-sections \
 			-funwind-tables \
@@ -98,7 +102,7 @@
 			-include $(android_config_h) \
 			-I $(arch_include_dir)
 
-$(combo_target)GLOBAL_LDFLAGS += \
+TARGET_GLOBAL_LDFLAGS += \
 			$(arch_variant_ldflags)
 
 # We only need thumb interworking in cases where thumb support
@@ -106,14 +110,14 @@
 # since sometimes thumb-interwork appears to be default), we
 # specifically disable when thumb support is unavailable.
 ifeq ($(ARCH_ARM_HAVE_THUMB_SUPPORT),true)
-$(combo_target)GLOBAL_CFLAGS +=	-mthumb-interwork
+TARGET_GLOBAL_CFLAGS +=	-mthumb-interwork
 else
-$(combo_target)GLOBAL_CFLAGS +=	-mno-thumb-interwork
+TARGET_GLOBAL_CFLAGS +=	-mno-thumb-interwork
 endif
 
-$(combo_target)GLOBAL_CPPFLAGS += -fvisibility-inlines-hidden
+TARGET_GLOBAL_CPPFLAGS += -fvisibility-inlines-hidden
 
-$(combo_target)RELEASE_CFLAGS := \
+TARGET_RELEASE_CFLAGS := \
 			-DNDEBUG \
 			-g \
 			-Wstrict-aliasing=2 \
@@ -130,11 +134,11 @@
 
 
 ## on some hosts, the target cross-compiler is not available so do not run this command
-ifneq ($(wildcard $($(combo_target)CC)),)
+ifneq ($(wildcard $(TARGET_CC)),)
 # We compile with the global cflags to ensure that
 # any flags which affect libgcc are correctly taken
 # into account.
-$(combo_target)LIBGCC := $(shell $($(combo_target)CC) $($(combo_target)GLOBAL_CFLAGS) -print-libgcc-file-name)
+TARGET_LIBGCC := $(shell $(TARGET_CC) $(TARGET_GLOBAL_CFLAGS) -print-libgcc-file-name)
 endif
 
 # Define FDO (Feedback Directed Optimization) options.
@@ -142,7 +146,7 @@
 TARGET_FDO_CFLAGS:=
 TARGET_FDO_LIB:=
 
-target_libgcov := $(shell $($(combo_target)CC) $($(combo_target)GLOBAL_CFLAGS) \
+target_libgcov := $(shell $(TARGET_CC) $(TARGET_GLOBAL_CFLAGS) \
         --print-file-name=libgcov.a)
 ifneq ($(strip $(BUILD_FDO_INSTRUMENT)),)
   # Set BUILD_FDO_INSTRUMENT=true to turn on FDO instrumentation.
@@ -181,7 +185,7 @@
 endif
 KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH)
 
-$(combo_target)C_INCLUDES := \
+TARGET_C_INCLUDES := \
 	$(libc_root)/arch-arm/include \
 	$(libc_root)/include \
 	$(libstdc++_root)/include \
@@ -196,9 +200,9 @@
 
 TARGET_STRIP_MODULE:=true
 
-$(combo_target)DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm
+TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm
 
-$(combo_target)CUSTOM_LD_COMMAND := true
+TARGET_CUSTOM_LD_COMMAND := true
 
 # Enable the Dalvik JIT compiler if not already specified.
 ifeq ($(strip $(WITH_JIT)),)
diff --git a/core/combo/linux-sh.mk b/core/combo/TARGET_linux-sh.mk
similarity index 74%
rename from core/combo/linux-sh.mk
rename to core/combo/TARGET_linux-sh.mk
index 79cf49d..361fe2e 100644
--- a/core/combo/linux-sh.mk
+++ b/core/combo/TARGET_linux-sh.mk
@@ -1,19 +1,35 @@
+#
+# Copyright (C) 2006 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
 # Configuration for Linux on SuperH.
 # 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 := \
+ifeq ($(strip $(TARGET_TOOLS_PREFIX)),)
+TARGET_TOOLS_PREFIX := \
 	prebuilt/$(HOST_PREBUILT_TAG)/toolchain/sh-4.3.3/bin/sh-linux-gnu-
 endif
 
-$(combo_target)CC := $($(combo_target)TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)
-$(combo_target)CXX := $($(combo_target)TOOLS_PREFIX)c++$(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)
+TARGET_CC := $(TARGET_TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)
+TARGET_CXX := $(TARGET_TOOLS_PREFIX)c++$(HOST_EXECUTABLE_SUFFIX)
+TARGET_AR := $(TARGET_TOOLS_PREFIX)ar$(HOST_EXECUTABLE_SUFFIX)
+TARGET_OBJCOPY := $(TARGET_TOOLS_PREFIX)objcopy$(HOST_EXECUTABLE_SUFFIX)
+TARGET_LD := $(TARGET_TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX)
 
-$(combo_target)NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
+TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
 
 TARGET_sh_release_CFLAGS :=     -O2 \
                                 -fomit-frame-pointer \
@@ -24,18 +40,18 @@
 # When building for debug, compile everything as superh.
 TARGET_sh_debug_CFLAGS := $(TARGET_sh_release_CFLAGS) -fno-omit-frame-pointer -fno-strict-aliasing
 
-$(combo_target)GLOBAL_CFLAGS += \
+TARGET_GLOBAL_CFLAGS += \
 			-fpic \
 			-ffunction-sections \
 			-funwind-tables \
 			-fstack-protector \
 			-include $(call select-android-config-h,linux-sh)
 
-$(combo_target)GLOBAL_CPPFLAGS += \
+TARGET_GLOBAL_CPPFLAGS += \
 			-fno-use-cxa-atexit \
 			-fvisibility-inlines-hidden
 
-$(combo_target)RELEASE_CFLAGS := \
+TARGET_RELEASE_CFLAGS := \
 			-DSK_RELEASE -DNDEBUG \
 			-O2 -g \
 			-Wstrict-aliasing=2 \
@@ -53,13 +69,13 @@
 
 
 ## on some hosts, the target cross-compiler is not available so do not run this command
-ifneq ($(wildcard $($(combo_target)CC)),)
+ifneq ($(wildcard $(TARGET_CC)),)
 # We compile with the global cflags to ensure that
 # any flags which affect libgcc are correctly taken
 # into account.
-LIBGCC_FILENAME := $(shell $($(combo_target)CC) $($(combo_target)GLOBAL_CFLAGS) -print-libgcc-file-name)
+LIBGCC_FILENAME := $(shell $(TARGET_CC) $(TARGET_GLOBAL_CFLAGS) -print-libgcc-file-name)
 LIBGCC_EH_FILENAME := $(subst libgcc,libgcc_eh,$(LIBGCC_FILENAME))
-$(combo_target)LIBGCC := $(LIBGCC_EH_FILENAME) $(LIBGCC_FILENAME)
+TARGET_LIBGCC := $(LIBGCC_EH_FILENAME) $(LIBGCC_FILENAME)
 endif
 
 # unless CUSTOM_KERNEL_HEADERS is defined, we're going to use
@@ -75,7 +91,7 @@
 endif
 KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH)
 
-$(combo_target)C_INCLUDES := \
+TARGET_C_INCLUDES := \
 	$(libc_root)/arch-sh/include \
 	$(libc_root)/include \
 	$(libstdc++_root)/include \
@@ -92,9 +108,9 @@
 
 TARGET_STRIP_MODULE:=false
 
-$(combo_target)DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm
+TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm
 
-$(combo_target)CUSTOM_LD_COMMAND := true
+TARGET_CUSTOM_LD_COMMAND := true
 define transform-o-to-shared-lib-inner
 $(TARGET_CXX) \
 	-nostdlib -Wl,-soname,$(notdir $@) -Wl,-T,$(BUILD_SYSTEM)/shlelf.xsc \
diff --git a/core/combo/target_linux-x86.mk b/core/combo/TARGET_linux-x86.mk
similarity index 61%
rename from core/combo/target_linux-x86.mk
rename to core/combo/TARGET_linux-x86.mk
index 2d359ff..80adbcf 100644
--- a/core/combo/target_linux-x86.mk
+++ b/core/combo/TARGET_linux-x86.mk
@@ -1,25 +1,56 @@
+#
+# Copyright (C) 2006 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
 # Configuration for Linux on x86 as a target.
-# Included by combo/select.make
+# Included by combo/select.mk
+
+ifeq ($(TARGET_SIMULATOR),true)
+# When building for the simulator, use the HOST settings as TARGET settings
+TARGET_CC := $(HOST_CC)
+TARGET_CXX := $(HOST_CXX)
+TARGET_AR := $(HOST_AR)
+TARGET_GLOBAL_CFLAGS := $(HOST_GLOBAL_CFLAGS)
+TARGET_GLOBAL_LDFLAGS := $(HOST_GLOBAL_LDFLAGS)
+TARGET_NO_UNDEFINED_LDFLAGS := $(HOST_NO_UNDEFINED_LDFLAGS)
+else #simulator
+
+# Provide a default variant.
+ifeq ($(strip $(TARGET_ARCH_VARIANT)),)
+TARGET_ARCH_VARIANT := x86
+endif
 
 # You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else
-ifeq ($(strip $($(combo_target)TOOLS_PREFIX)),)
-$(combo_target)TOOLS_PREFIX := \
+ifeq ($(strip $(TARGET_TOOLS_PREFIX)),)
+TARGET_TOOLS_PREFIX := \
 	prebuilt/$(HOST_PREBUILT_TAG)/toolchain/i686-unknown-linux-gnu-4.2.1/bin/i686-unknown-linux-gnu-
 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)
+TARGET_CC := $(TARGET_TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)
+TARGET_CXX := $(TARGET_TOOLS_PREFIX)g++$(HOST_EXECUTABLE_SUFFIX)
+TARGET_AR := $(TARGET_TOOLS_PREFIX)ar$(HOST_EXECUTABLE_SUFFIX)
+TARGET_OBJCOPY := $(TARGET_TOOLS_PREFIX)objcopy$(HOST_EXECUTABLE_SUFFIX)
+TARGET_LD := $(TARGET_TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX)
 
-ifneq ($(wildcard $($(combo_target)CC)),)
-$(combo_target)LIBGCC := \
-	$(shell $($(combo_target)CC) -m32 -print-file-name=libgcc.a) \
-        $(shell $($(combo_target)CC) -m32 -print-file-name=libgcc_eh.a)
+ifneq ($(wildcard $(TARGET_CC)),)
+TARGET_LIBGCC := \
+	$(shell $(TARGET_CC) -m32 -print-file-name=libgcc.a) \
+        $(shell $(TARGET_CC) -m32 -print-file-name=libgcc_eh.a)
 endif
 
-$(combo_target)NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
+TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
 
 libc_root := bionic/libc
 libm_root := bionic/libm
@@ -39,16 +70,16 @@
 endif
 KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH)
 
-$(combo_target)GLOBAL_CFLAGS += \
+TARGET_GLOBAL_CFLAGS += \
 			-march=i686 \
 			-m32 \
 			-fPIC \
 			-include $(call select-android-config-h,target_linux-x86)
 
-$(combo_target)GLOBAL_CPPFLAGS += \
+TARGET_GLOBAL_CPPFLAGS += \
 			-fno-use-cxa-atexit
 
-$(combo_target)C_INCLUDES := \
+TARGET_C_INCLUDES := \
 	$(libc_root)/arch-x86/include \
 	$(libc_root)/include \
 	$(libstdc++_root)/include \
@@ -67,9 +98,9 @@
 
 # TARGET_STRIP_MODULE:=true
 
-$(combo_target)DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm
+TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm
 
-$(combo_target)CUSTOM_LD_COMMAND := true
+TARGET_CUSTOM_LD_COMMAND := true
 define transform-o-to-shared-lib-inner
 $(TARGET_CXX) \
 	$(TARGET_GLOBAL_LDFLAGS) \
@@ -125,5 +156,7 @@
 	$(TARGET_CRTEND_O)
 endef
 
-$(combo_target)GLOBAL_CFLAGS += -m32
-$(combo_target)GLOBAL_LDFLAGS += -m32
+TARGET_GLOBAL_CFLAGS += -m32
+TARGET_GLOBAL_LDFLAGS += -m32
+
+endif #simulator
diff --git a/core/combo/darwin-x86.mk b/core/combo/darwin-x86.mk
deleted file mode 100644
index 8fc48a1..0000000
--- a/core/combo/darwin-x86.mk
+++ /dev/null
@@ -1,101 +0,0 @@
-# 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
-$(combo_target)GLOBAL_ARFLAGS := cqs
-
-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_FDO_LIB) \
-        $(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_FDO_LIB) \
-        $(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_FDO_LIB) \
-        $(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) \
-        $(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
-        $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
-        $(PRIVATE_LDFLAGS) \
-        $(PRIVATE_LDLIBS) \
-        $(HOST_LIBGCC)
-endef
-
-# $(1): The file to check
-define get-file-size
-stat -f "%z" $(1)
-endef
-
-endif
diff --git a/core/combo/linux-x86.mk b/core/combo/linux-x86.mk
deleted file mode 100644
index d994902..0000000
--- a/core/combo/linux-x86.mk
+++ /dev/null
@@ -1,40 +0,0 @@
-# Configuration for Linux on x86.
-# Included by combo/select.make
-
-# Provide a default variant.
-ifeq ($(TARGET_ARCH),x86)
-ifeq ($(strip $(TARGET_ARCH_VARIANT)),)
-TARGET_ARCH_VARIANT := x86
-endif
-endif
-
-# 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)
-
-ifeq ($(combo_target),HOST_)
-# $(1): The file to check
-define get-file-size
-stat --format "%s" "$(1)" | tr -d '\n'
-endef
-endif
-
-# On the sim, we build the "host" tools in 64 bit iff the compiler
-# does it for us automatically.  In other words, that means on 64 bit
-# system, they're 64 bit and on 32 bit systems, they're 32 bits.  In
-# all other cases, we build 32 bit, since this is what we release.
-ifneq ($(combo_target)$(TARGET_SIMULATOR),HOST_true)
-$(combo_target)GLOBAL_CFLAGS := $($(combo_target)GLOBAL_CFLAGS) -m32
-$(combo_target)GLOBAL_LDFLAGS := $($(combo_target)GLOBAL_LDFLAGS) -m32
-endif
-
-
-$(combo_target)GLOBAL_CFLAGS += -fPIC
-$(combo_target)GLOBAL_CFLAGS += \
-	-include $(call select-android-config-h,linux-x86)
-
-$(combo_target)NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
-
-
diff --git a/core/combo/select.mk b/core/combo/select.mk
index ccdf1fb..916320b 100644
--- a/core/combo/select.mk
+++ b/core/combo/select.mk
@@ -1,24 +1,33 @@
+#
+# Copyright (C) 2006 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
 # 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)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.
+# Set reasonable defaults for the various variables
 
-HOST_CC ?= $(CC)
-HOST_CXX ?= $(CXX)
-HOST_AR ?= $(AR)
+$(combo_target)CC := $(CC)
+$(combo_target)CXX := $(CXX)
+$(combo_target)AR := $(AR)
 
 $(combo_target)BINDER_MINI := 0
 
@@ -36,7 +45,6 @@
 $(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)RELEASE_CFLAGS := -O2 -g -fno-strict-aliasing
 $(combo_target)GLOBAL_LDFLAGS :=
@@ -49,28 +57,8 @@
 
 $(combo_target)PRELINKER_MAP := $(BUILD_SYSTEM)/prelink-$(combo_os_arch).map
 
-# We try to find a target or host specific file for the os/arch specified, and
-# default to just looking for the os/arch one. This will allow us to define
-# things separately for targets and hosts that have the same architecture
-# but need different defines. e.g. target_linux-x86 and host_linux-x86
-
-ifneq ($(TARGET_SIMULATOR),true)
-# Convert the combo_target string to lowercase
-combo_target_lc := $(shell echo $(combo_target) | tr '[A-Z]' '[a-z]')
-
-# form combo makefile name like "<path>/target_linux-x86.make",
-# "<path>/host_darwin-x86.make", etc.
-combo_target_os_arch := $(BUILD_COMBOS)/$(combo_target_lc)$(combo_os_arch).mk
-else
-combo_target_os_arch :=
-endif
-
 # Now include the combo for this specific target.
-ifneq ($(wildcard $(combo_target_os_arch)),)
-include $(combo_target_os_arch)
-else
-include $(BUILD_COMBOS)/$(combo_os_arch).mk
-endif
+include $(BUILD_COMBOS)/$(combo_target)$(combo_os_arch).mk
 
 ifneq ($(USE_CCACHE),)
   ccache := prebuilt/$(HOST_PREBUILT_TAG)/ccache/ccache
diff --git a/core/combo/windows-x86.mk b/core/combo/windows-x86.mk
deleted file mode 100644
index e32a077..0000000
--- a/core/combo/windows-x86.mk
+++ /dev/null
@@ -1,53 +0,0 @@
-# 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