Add dependency from dex2oat to supporting libart-compiler-* libraries

Also make .art the primary build rule, not the .oat. The
build/core/dex_preopt.mk rules depend on the .art files, and without
this, unnecessary rebuilds can happen when the .art file is
regenerated.

Change-Id: I0b116d6975916b9140e7ef095f8b0ec994c8e50f
diff --git a/build/Android.libart-compiler.mk b/build/Android.libart-compiler.mk
index 01d9c12..7673588 100644
--- a/build/Android.libart-compiler.mk
+++ b/build/Android.libart-compiler.mk
@@ -122,6 +122,21 @@
     LOCAL_IS_HOST_MODULE := true
     include $(BUILD_HOST_SHARED_LIBRARY)
   endif
+
+  ifeq ($$(art_target_or_host),target)
+    ifeq ($$(art_ndebug_or_debug),debug)
+      $(TARGET_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
+    else
+      $(TARGET_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
+    endif
+  else # host
+    ifeq ($$(art_ndebug_or_debug),debug)
+      $(HOST_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
+    else
+      $(HOST_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
+    endif
+  endif
+
 endef
 
 # $(1): target or host