summaryrefslogtreecommitdiffstats
path: root/core/binary.mk
diff options
context:
space:
mode:
Diffstat (limited to 'core/binary.mk')
-rw-r--r--core/binary.mk66
1 files changed, 61 insertions, 5 deletions
diff --git a/core/binary.mk b/core/binary.mk
index 60cd4c6..936b429 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -107,6 +107,7 @@ my_shared_libraries := $(LOCAL_SHARED_LIBRARIES)
my_cflags := $(LOCAL_CFLAGS)
my_cppflags := $(LOCAL_CPPFLAGS)
my_ldflags := $(LOCAL_LDFLAGS)
+my_ldlibs := $(LOCAL_LDLIBS)
my_asflags := $(LOCAL_ASFLAGS)
my_cc := $(LOCAL_CC)
my_cxx := $(LOCAL_CXX)
@@ -164,11 +165,66 @@ my_whole_static_libraries := $(LOCAL_WHOLE_STATIC_LIBRARIES_$($(my_prefix)$(LOCA
my_cflags := $(filter-out $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_UNSUPPORTED_CFLAGS),$(my_cflags))
+# Only around for development purposes. Will be removed soon.
+my_libcxx_is_default := false
+
+# Select the appropriate C++ STL
+ifeq ($(strip $(LOCAL_CXX_STL)),default)
+ ifndef LOCAL_SDK_VERSION
+ ifeq ($(strip $(my_libcxx_is_default)),true)
+ # Platform code. Select the appropriate STL.
+ my_cxx_stl := libc++
+ else
+ my_cxx_stl := bionic
+ endif
+ else
+ my_cxx_stl := ndk
+ endif
+else
+ my_cxx_stl := $(strip $(LOCAL_CXX_STL))
+endif
+
+ifneq ($(filter $(my_cxx_stl),libc++ libc++_static),)
+ my_cflags += -D_USING_LIBCXX
+ my_c_includes += external/libcxx/include
+ ifeq ($(my_cxx_stl),libc++)
+ my_shared_libraries += libc++
+ else
+ my_static_libraries += libc++_static
+ endif
-# Replace libstdc++ with libc++ if it's seen
-my_libcxx := $(filter libc++, $(my_shared_libraries))
-ifdef my_libcxx
-my_system_shared_libraries := $(filter-out libstdc++, $(my_system_shared_libraries))
+ ifdef LOCAL_IS_HOST_MODULE
+ my_cppflags += -nostdinc++
+ my_ldflags += -nodefaultlibs
+ my_ldlibs += -lc -lm
+ endif
+else ifneq ($(filter $(my_cxx_stl),stlport stlport_static),)
+ my_c_includes += external/stlport/stlport bionic/libstdc++/include bionic
+ ifeq ($(my_cxx_stl),stlport)
+ my_shared_libraries += libstdc++ libstlport
+ else
+ my_static_libraries += libstdc++ libstlport_static
+ endif
+else ifeq ($(my_cxx_stl),ndk)
+ # Using an NDK STL. Handled farther up in this file.
+ ifndef LOCAL_IS_HOST_MODULE
+ my_system_shared_libraries += libstdc++
+ endif
+else ifeq ($(my_cxx_stl),bionic)
+ # Using bionic's basic libstdc++. Not actually an STL. Only around until the
+ # tree is in good enough shape to not need it.
+ ifndef LOCAL_IS_HOST_MODULE
+ my_c_includes += bionic/libstdc++/include
+ my_system_shared_libraries += libstdc++
+ endif
+ # Host builds will use GNU libstdc++.
+else ifeq ($(my_cxx_stl),none)
+ ifdef LOCAL_IS_HOST_MODULE
+ my_cppflags += -nostdinc++
+ my_ldflags += -nodefaultlibs -lc -lm
+ endif
+else
+ $(error $(my_cxx_stl) is not a supported STL.)
endif
# Add static HAL libraries
@@ -947,7 +1003,7 @@ $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEBUG_CFLAGS := $(debug_cflags)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_C_INCLUDES := $(my_c_includes)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_IMPORT_INCLUDES := $(import_includes)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDFLAGS := $(my_ldflags)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDLIBS := $(LOCAL_LDLIBS)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDLIBS := $(my_ldlibs)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_CRT := $(strip $(LOCAL_NO_CRT) $(LOCAL_NO_CRT_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)))
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LIBCXX := $(my_libcxx)