Convert more of art to Android.bp

Relanding I1b10f140e17dd5e12a9d7f6a29d47cf61f5bf6ef, with fixes to
compile dalvikvm32 and dalvikvm64, and add them as dependencies of
tests.  Also fixes HOST_PREFER_32_BIT by moving the override from the
defaults, which are not used by everything in art, to the art_cc_binary
module type.

Test: rm -rf out/host; m -j HOST_PREFER_32_BIT test-art-host; m -j test-art-host
Change-Id: I64d3eef5080e128103d052497760c3521cc253c6
diff --git a/oatdump/Android.bp b/oatdump/Android.bp
new file mode 100644
index 0000000..169822c
--- /dev/null
+++ b/oatdump/Android.bp
@@ -0,0 +1,79 @@
+//
+// Copyright (C) 2011 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.
+//
+
+cc_defaults {
+    name: "oatdump-defaults",
+    defaults: ["art_defaults"],
+    host_supported: true,
+    srcs: ["oatdump.cc"],
+    target: {
+        android: {
+            shared_libs: ["libcutils"],
+        },
+    },
+    include_dirs: ["art/cmdline"],
+}
+
+art_cc_binary {
+    name: "oatdump",
+    defaults: ["oatdump-defaults"],
+    shared_libs: [
+        "libart",
+        "libart-compiler",
+        "libart-disassembler",
+    ],
+}
+
+art_cc_binary {
+    name: "oatdumpd",
+    defaults: [
+        "art_debug_defaults",
+        "oatdump-defaults",
+    ],
+    shared_libs: [
+        "libartd",
+        "libartd-compiler",
+        "libartd-disassembler",
+    ],
+}
+
+art_cc_binary {
+    name: "oatdumps",
+    defaults: ["oatdump-defaults"],
+    static_libs: [
+        "libart",
+        "libart-compiler",
+        "libart-disassembler",
+        "libvixl-arm",
+        "libvixl-arm64",
+    ] + art_static_dependencies,
+}
+
+art_cc_binary {
+    name: "oatdumpds",
+    defaults: [
+        "art_debug_defaults",
+        "oatdump-defaults",
+    ],
+    static_libs: [
+        "libartd",
+        "libartd-compiler",
+        "libartd-disassembler",
+        "libvixld-arm",
+        "libvixld-arm64",
+    ] + art_static_dependencies,
+}
+
diff --git a/oatdump/Android.mk b/oatdump/Android.mk
index 4b37c6a..7be8a8d 100644
--- a/oatdump/Android.mk
+++ b/oatdump/Android.mk
@@ -16,41 +16,6 @@
 
 LOCAL_PATH := $(call my-dir)
 
-include art/build/Android.executable.mk
-
-OATDUMP_SRC_FILES := \
-	oatdump.cc
-
-# Build variants {target,host} x {debug,ndebug}
-$(eval $(call build-art-multi-executable,oatdump,$(OATDUMP_SRC_FILES),libart-compiler libart-disassembler,libcutils,,art/compiler art/disassembler))
-
-# Static variants (only for host).
-ifeq ($(ART_BUILD_HOST_STATIC),true)
-  ifeq ($(HOST_PREFER_32_BIT),true)
-    # We need to explicitly restrict the host arch to 32-bit only, as
-    # giving 'both' would make build-art-executable generate a build
-    # rule for a 64-bit oatdump executable too.
-    oatdump_host_arch := 32
-  else
-    oatdump_host_arch := both
-  endif
-
-  ifeq ($(ART_BUILD_HOST_NDEBUG),true)
-    $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),libart libart-compiler libart-disassembler libvixl-arm64 $(ART_STATIC_DEPENDENCIES),art/compiler art/disassembler,host,ndebug,$(oatdump_host_arch),static))
-  endif
-  ifeq ($(ART_BUILD_HOST_DEBUG),true)
-    $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),libartd libartd-compiler libartd-disassembler libvixld-arm64 $(ART_STATIC_DEPENDENCIES),art/compiler art/disassembler,host,debug,$(oatdump_host_arch),static))
-  endif
-
-  # Clear locals now they've served their purpose.
-  oatdump_host_arch :=
-endif
-
-########################################################################
-# oatdump targets
-
-ART_DUMP_OAT_PATH ?= $(OUT_DIR)
-
 OATDUMP := $(HOST_OUT_EXECUTABLES)/oatdump$(HOST_EXECUTABLE_SUFFIX)
 OATDUMPD := $(HOST_OUT_EXECUTABLES)/oatdumpd$(HOST_EXECUTABLE_SUFFIX)
 # TODO: for now, override with debug version for better error reporting