Remove auto-generated executable list

Keep a list of the useful executables, and use the -host and -target
phony targets to depend on them for build-art-host and build-art-target.

Relanding I8ff4da32a03c219924be7990963e0c3ba90ef316 with fixes to build
the debug versions of executables, which are needed by the tests.

Change-Id: Id941cf5d1a638763cf4cf2bc0412b0782ae21694
diff --git a/build/Android.common_path.mk b/build/Android.common_path.mk
index 86bb475..3f25ae1 100644
--- a/build/Android.common_path.mk
+++ b/build/Android.common_path.mk
@@ -18,6 +18,7 @@
 ART_ANDROID_COMMON_PATH_MK := true
 
 include art/build/Android.common.mk
+include art/build/Android.common_build.mk
 
 # Directory used for dalvik-cache on device.
 ART_TARGET_DALVIK_CACHE_DIR := /data/dalvik-cache
@@ -113,4 +114,29 @@
 ART_TARGET_SHARED_LIBRARY_DEPENDENCIES += $(foreach lib,$(ART_CORE_SHARED_LIBRARIES), $(2ND_TARGET_OUT_SHARED_LIBRARIES)/$(lib).so)
 endif
 
+ART_CORE_EXECUTABLES := \
+    dex2oat \
+    imgdiag \
+    oatdump \
+    patchoat \
+    profman \
+
+# Depend on the -target or -host phony targets generated by the build system
+# for each module
+ART_TARGET_EXECUTABLES :=
+ifneq ($(ART_BUILD_TARGET_NDEBUG),false)
+ART_TARGET_EXECUTABLES += $(foreach name,$(ART_CORE_EXECUTABLES),$(name)-target)
+endif
+ifneq ($(ART_BUILD_TARGET_DEBUG),false)
+ART_TARGET_EXECUTABLES += $(foreach name,$(ART_CORE_EXECUTABLES),$(name)d-target)
+endif
+
+ART_HOST_EXECUTABLES :=
+ifneq ($(ART_BUILD_HOST_NDEBUG),false)
+ART_HOST_EXECUTABLES += $(foreach name,$(ART_CORE_EXECUTABLES),$(name)-host)
+endif
+ifneq ($(ART_BUILD_HOST_DEBUG),false)
+ART_HOST_EXECUTABLES += $(foreach name,$(ART_CORE_EXECUTABLES),$(name)d-host)
+endif
+
 endif # ART_ANDROID_COMMON_PATH_MK
diff --git a/build/Android.executable.mk b/build/Android.executable.mk
index 2db16af..e66b30c 100644
--- a/build/Android.executable.mk
+++ b/build/Android.executable.mk
@@ -16,9 +16,6 @@
 
 include art/build/Android.common_build.mk
 
-ART_HOST_EXECUTABLES ?=
-ART_TARGET_EXECUTABLES ?=
-
 ART_EXECUTABLES_CFLAGS :=
 
 # $(1): executable ("d" will be appended for debug version)
@@ -169,11 +166,9 @@
 
   ifeq ($$(art_target_or_host),target)
     include $(BUILD_EXECUTABLE)
-    ART_TARGET_EXECUTABLES := $(ART_TARGET_EXECUTABLES) $$(foreach name,$$(art_out_binary_name),$(TARGET_OUT_EXECUTABLES)/$$(name))
   else # host
     LOCAL_IS_HOST_MODULE := true
     include $(BUILD_HOST_EXECUTABLE)
-    ART_HOST_EXECUTABLES := $(ART_HOST_EXECUTABLES) $$(foreach name,$$(art_out_binary_name),$(HOST_OUT_EXECUTABLES)/$$(name))
   endif
 
   # Clear out local variables now that we're done with them.