Preparation for transition to libc++.

Move the dependency on libc++ to its own makefile so that we can switch in a
single place between libc++ and stlport.

Change-Id: Ie61e7d054dcd049e36d5e7298c27d8a4abe6edf7
diff --git a/build/Android.executable.mk b/build/Android.executable.mk
index 27d687c..6aa1c18 100644
--- a/build/Android.executable.mk
+++ b/build/Android.executable.mk
@@ -52,10 +52,6 @@
   art_multilib := $(7)
 
   include $(CLEAR_VARS)
-  ifeq ($$(art_target_or_host),target)
-    include external/stlport/libstlport.mk
-  endif
-
   LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
   LOCAL_MODULE_TAGS := optional
   LOCAL_SRC_FILES := $$(art_source)
@@ -104,9 +100,12 @@
   endif
 
   ifeq ($$(art_target_or_host),target)
+    include art/build/Android.libcxx.mk
     include $(BUILD_EXECUTABLE)
     ART_TARGET_EXECUTABLES := $(ART_TARGET_EXECUTABLES) $(TARGET_OUT_EXECUTABLES)/$$(LOCAL_MODULE)
   else # host
+    LOCAL_IS_HOST_MODULE := true
+    include art/build/Android.libcxx.mk
     include $(BUILD_HOST_EXECUTABLE)
     ART_HOST_EXECUTABLES := $(ART_HOST_EXECUTABLES) $(HOST_OUT_EXECUTABLES)/$$(LOCAL_MODULE)
   endif
diff --git a/build/Android.gtest.mk b/build/Android.gtest.mk
index 24acc56..b6e6fac 100644
--- a/build/Android.gtest.mk
+++ b/build/Android.gtest.mk
@@ -150,10 +150,6 @@
   art_gtest_name := $$(notdir $$(basename $$(art_gtest_filename)))
 
   include $(CLEAR_VARS)
-  ifeq ($$(art_target_or_host),target)
-    include external/stlport/libstlport.mk
-  endif
-
   LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
   LOCAL_MODULE := $$(art_gtest_name)
   ifeq ($$(art_target_or_host),target)
@@ -184,6 +180,7 @@
     LOCAL_MODULE_PATH_32 := $(ART_BASE_NATIVETEST_OUT)
     LOCAL_MODULE_PATH_64 := $(ART_BASE_NATIVETEST_OUT)64
     LOCAL_MULTILIB := both
+    include art/build/Android.libcxx.mk
     include $(BUILD_EXECUTABLE)
     ART_TARGET_GTEST_EXECUTABLES += $$(art_gtest_exe)
     art_gtest_target := test-art-$$(art_target_or_host)-gtest-$$(art_gtest_name)
@@ -208,6 +205,8 @@
         LOCAL_STATIC_LIBRARIES += libgtest_host
     endif
     LOCAL_LDLIBS += -lpthread -ldl
+    LOCAL_IS_HOST_MODULE := true
+    include art/build/Android.libcxx.mk
     include $(BUILD_HOST_EXECUTABLE)
     art_gtest_exe := $(HOST_OUT_EXECUTABLES)/$$(LOCAL_MODULE)
     ART_HOST_GTEST_EXECUTABLES += $$(art_gtest_exe)
diff --git a/build/Android.libarttest.mk b/build/Android.libarttest.mk
index 14d16ac..18d321a 100644
--- a/build/Android.libarttest.mk
+++ b/build/Android.libarttest.mk
@@ -31,10 +31,6 @@
   art_target_or_host := $(1)
 
   include $(CLEAR_VARS)
-  ifeq ($$(art_target_or_host),target)
-   include external/stlport/libstlport.mk
-  endif
-
   LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
   LOCAL_MODULE := libarttest
   ifeq ($$(art_target_or_host),target)
@@ -55,6 +51,7 @@
     LOCAL_MODULE_PATH_32 := $(ART_BASE_TEST_OUT)
     LOCAL_MODULE_PATH_64 := $(ART_BASE_TEST_OUT)64
     LOCAL_MODULE_TARGET_ARCH := $(ART_SUPPORTED_ARCH)
+    include art/build/Android.libcxx.mk
     include $(BUILD_SHARED_LIBRARY)
   else # host
     LOCAL_CLANG := $(ART_HOST_CLANG)
@@ -64,6 +61,8 @@
     ifeq ($(HOST_OS),linux)
       LOCAL_LDLIBS += -lrt
     endif
+    LOCAL_IS_HOST_MODULE := true
+    include art/build/Android.libcxx.mk
     include $(BUILD_HOST_SHARED_LIBRARY)
   endif
 endef
diff --git a/build/Android.libcxx.mk b/build/Android.libcxx.mk
new file mode 100644
index 0000000..3dd1eb7
--- /dev/null
+++ b/build/Android.libcxx.mk
@@ -0,0 +1,20 @@
+#
+# Copyright (C) 2014 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.
+#
+
+ifneq ($(LOCAL_IS_HOST_MODULE),true)
+  include external/stlport/libstlport.mk
+  # include external/libcxx/libcxx.mk
+endif