Only apply aarch64 clang WAR to the target.

Note that the ART_TARGET_CLANG_CFLAGS_$(arch) was actually broken over a
year ago. This patch fixes that and drops the no longer needed
-DNVALGRIND for clang aarch64.

Bug: http://b/23256622
Change-Id: I749db286c0fd533aeb50744b323c1faddf951d79
diff --git a/build/Android.common_build.mk b/build/Android.common_build.mk
index 9f15294..7550f50 100644
--- a/build/Android.common_build.mk
+++ b/build/Android.common_build.mk
@@ -133,10 +133,6 @@
 ART_TARGET_CLANG_CFLAGS_x86 :=
 ART_TARGET_CLANG_CFLAGS_x86_64 :=
 
-# These are necessary for Clang ARM64 ART builds. TODO: remove.
-ART_TARGET_CLANG_CFLAGS_arm64  += \
-  -DNVALGRIND
-
 # Warn about thread safety violations with clang.
 art_clang_cflags := -Wthread-safety -Wthread-safety-negative
 
@@ -275,16 +271,6 @@
   -DVIXL_DEBUG \
   -UNDEBUG
 
-# The latest clang update trips over many of the files in art and never finishes
-# compiling for aarch64 with -O3 (or -O2). Drop back to -O1 while we investigate
-# to stop punishing the build server.
-ifeq ($(TARGET_ARCH),arm64)
-  ifeq ($(USE_CLANG_PLATFORM_BUILD),true)
-    art_debug_cflags += -O1
-    art_non_debug_cflags += -O1
-  endif
-endif
-
 art_host_non_debug_cflags := $(art_non_debug_cflags)
 art_target_non_debug_cflags := $(art_non_debug_cflags)
 
@@ -319,6 +305,12 @@
 endif
 ART_TARGET_CLANG_CFLAGS += -Wno-pessimizing-move
 
+# The latest clang update trips over many of the files in art and never finishes
+# compiling for aarch64 with -O3 (or -O2). Drop back to -O1 while we investigate
+# to stop punishing the build server.
+# Bug: http://b/23256622
+ART_TARGET_CLANG_CFLAGS_arm64 += -O1
+
 ifndef LIBART_IMG_TARGET_BASE_ADDRESS
   $(error LIBART_IMG_TARGET_BASE_ADDRESS unset)
 endif
@@ -383,7 +375,7 @@
   endif
 
   LOCAL_CLANG_CFLAGS := $(ART_TARGET_CLANG_CFLAGS)
-  $(foreach arch,$(ART_SUPPORTED_ARCH),
+  $(foreach arch,$(ART_TARGET_SUPPORTED_ARCH),
     LOCAL_CLANG_CFLAGS_$(arch) += $$(ART_TARGET_CLANG_CFLAGS_$(arch)))
 
   # Clear locally used variables.