Only build target compiler for TARGET_ARCH

Change-Id: Iad4867a358dc273799396ec1c3a76af32b56f5b6
diff --git a/build/Android.libart-compiler-greenland.mk b/build/Android.libart-compiler-greenland.mk
index 04eec5e..1b4b5ae 100644
--- a/build/Android.libart-compiler-greenland.mk
+++ b/build/Android.libart-compiler-greenland.mk
@@ -34,15 +34,15 @@
 	src/oat/jni/arm/calling_convention_arm.cc \
 	src/oat/jni/x86/calling_convention_x86.cc
 
-LIBART_COMPILER_GREENLAND_ARM_SRC_FILES += \
+LIBART_COMPILER_GREENLAND_arm_SRC_FILES += \
   src/greenland/arm/arm_codegen_machine.cc \
 	src/greenland/arm/arm_invoke_stub_compiler.cc
 
-LIBART_COMPILER_GREENLAND_MIPS_SRC_FILES += \
+LIBART_COMPILER_GREENLAND_mips_SRC_FILES += \
   src/greenland/mips/mips_codegen_machine.cc \
   src/greenland/mips/mips_invoke_stub_compiler.cc
 
-LIBART_COMPILER_GREENLAND_X86_SRC_FILES += \
+LIBART_COMPILER_GREENLAND_x86_SRC_FILES += \
   src/greenland/x86/x86_codegen_machine.cc \
   src/greenland/x86/x86_lir_emitter.cc \
   src/greenland/x86/x86_lir_info.cc \
@@ -91,12 +91,12 @@
 
   ifeq ($$(art_target_or_host),target)
     LOCAL_SRC_FILES += \
-      $(LIBART_COMPILER_GREENLAND_ARM_SRC_FILES)
+      $(LIBART_COMPILER_GREENLAND_$(TARGET_ARCH)_SRC_FILES)
   else
     LOCAL_SRC_FILES += \
-      $(LIBART_COMPILER_GREENLAND_ARM_SRC_FILES) \
-      $(LIBART_COMPILER_GREENLAND_MIPS_SRC_FILES) \
-      $(LIBART_COMPILER_GREENLAND_X86_SRC_FILES)
+      $(LIBART_COMPILER_GREENLAND_arm_SRC_FILES) \
+      $(LIBART_COMPILER_GREENLAND_mips_SRC_FILES) \
+      $(LIBART_COMPILER_GREENLAND_x86_SRC_FILES)
   endif
 
   LOCAL_STATIC_LIBRARIES += \
diff --git a/build/Android.libart-compiler.mk b/build/Android.libart-compiler.mk
index f27ddaa..3f3c23d 100644
--- a/build/Android.libart-compiler.mk
+++ b/build/Android.libart-compiler.mk
@@ -33,7 +33,7 @@
 	src/greenland/intrinsic_helper.cc
 endif
 
-LIBART_COMPILER_ARM_SRC_FILES += \
+LIBART_COMPILER_arm_SRC_FILES += \
 	$(LIBART_COMPILER_COMMON_SRC_FILES) \
 	src/compiler/codegen/arm/ArchUtility.cc \
 	src/compiler/codegen/arm/ArmRallocUtil.cc \
@@ -41,14 +41,14 @@
 	src/compiler/codegen/arm/armv7-a/Codegen.cc \
 	src/oat/jni/arm/jni_internal_arm.cc
 
-LIBART_COMPILER_MIPS_SRC_FILES += \
+LIBART_COMPILER_mips_SRC_FILES += \
 	$(LIBART_COMPILER_COMMON_SRC_FILES) \
 	src/compiler/codegen/mips/ArchUtility.cc \
 	src/compiler/codegen/mips/MipsRallocUtil.cc \
 	src/compiler/codegen/mips/Assemble.cc \
 	src/compiler/codegen/mips/mips/Codegen.cc
 
-LIBART_COMPILER_X86_SRC_FILES += \
+LIBART_COMPILER_x86_SRC_FILES += \
 	$(LIBART_COMPILER_COMMON_SRC_FILES) \
 	src/compiler/codegen/x86/ArchUtility.cc \
 	src/compiler/codegen/x86/X86RallocUtil.cc \
@@ -59,7 +59,6 @@
 # $(1): target or host
 # $(2): ndebug or debug
 # $(3): architecture name
-# $(4): list of source files
 define build-libart-compiler
   ifneq ($(1),target)
     ifneq ($(1),host)
@@ -75,7 +74,6 @@
   art_target_or_host := $(1)
   art_ndebug_or_debug := $(2)
   libart_compiler_arch := $(3)
-  libart_compiler_src_files := $(4)
 
   include $(CLEAR_VARS)
   ifeq ($$(art_target_or_host),target)
@@ -91,7 +89,8 @@
   LOCAL_MODULE_TAGS := optional
   LOCAL_MODULE_CLASS := SHARED_LIBRARIES
 
-  LOCAL_SRC_FILES := $$(libart_compiler_src_files)
+  LOCAL_SRC_FILES := $$(LIBART_COMPILER_$$(libart_compiler_arch)_SRC_FILES)
+
   ifeq ($$(art_target_or_host),target)
     LOCAL_CFLAGS := $(ART_TARGET_CFLAGS)
   else # host
@@ -119,7 +118,7 @@
   endif
 
   # TODO: temporary hack for testing.
-  ifeq ($$(libart_compiler_arch),MIPS)
+  ifeq ($$(libart_compiler_arch),mips)
     LOCAL_CFLAGS += -D__mips_hard_float
   endif
 
@@ -178,14 +177,14 @@
 # $(1): target or host
 # $(2): ndebug or debug
 define build-libart-compilers
-  $(foreach arch,ARM MIPS X86,$(eval $(call build-libart-compiler,$(1),$(2),$(arch),$(LIBART_COMPILER_$(arch)_SRC_FILES))))
+  $(foreach arch,arm mips x86,$(eval $(call build-libart-compiler,$(1),$(2),$(arch))))
 endef
 
 ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
-  $(eval $(call build-libart-compilers,target,ndebug))
+  $(eval $(call build-libart-compiler,target,ndebug,$(TARGET_ARCH)))
 endif
 ifeq ($(ART_BUILD_TARGET_DEBUG),true)
-  $(eval $(call build-libart-compilers,target,debug))
+  $(eval $(call build-libart-compiler,target,debug,$(TARGET_ARCH)))
 endif
 ifeq ($(ART_BUILD_HOST_NDEBUG),true)
   $(eval $(call build-libart-compilers,host,ndebug))
diff --git a/src/compiler.cc b/src/compiler.cc
index 36e8d28..aad6ad3 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -245,10 +245,10 @@
     instruction_set = kArm;
   }
 
-  // Capitalize the instruction set, because that's what we do in the build system.
+  // Lower case the instruction set, because that's what we do in the build system.
   std::string instruction_set_name(ToStr<InstructionSet>(instruction_set).str());
   for (size_t i = 0; i < instruction_set_name.size(); ++i) {
-    instruction_set_name[i] = toupper(instruction_set_name[i]);
+    instruction_set_name[i] = tolower(instruction_set_name[i]);
   }
 
   // Bad things happen if we pull in the libartd-compiler to a libart dex2oat or vice versa,