cxx_stl_setup.mk revision 5cab04ffd2c29e2a03ab0706d5542b9b18c289ff
1############################################################# 2## Set up flags based on LOCAL_CXX_STL. 3## Input variables: LOCAL_CXX_STL 4## Output variables: My_cflags, my_c_includes, my_shared_libraries, etc. 5############################################################# 6 7# Only around for development purposes. Will be removed soon. 8my_libcxx_is_default := false 9 10# Select the appropriate C++ STL 11ifeq ($(strip $(LOCAL_CXX_STL)),default) 12 ifndef LOCAL_SDK_VERSION 13 ifeq ($(strip $(my_libcxx_is_default)),true) 14 # Platform code. Select the appropriate STL. 15 my_cxx_stl := libc++ 16 else 17 my_cxx_stl := libstdc++ 18 endif 19 else 20 my_cxx_stl := ndk 21 endif 22else 23 my_cxx_stl := $(strip $(LOCAL_CXX_STL)) 24endif 25 26ifneq ($(filter $(my_cxx_stl),libc++ libc++_static),) 27 my_cflags += -D_USING_LIBCXX 28 my_c_includes += external/libcxx/include 29 ifeq ($(my_cxx_stl),libc++) 30 my_shared_libraries += libc++ 31 else 32 my_static_libraries += libc++_static 33 endif 34 35 ifdef LOCAL_IS_HOST_MODULE 36 my_cppflags += -nostdinc++ 37 my_ldflags += -nodefaultlibs 38 my_ldlibs += -lc -lm -lpthread 39 endif 40else ifneq ($(filter $(my_cxx_stl),stlport stlport_static),) 41 ifndef LOCAL_IS_HOST_MODULE 42 my_c_includes += external/stlport/stlport bionic/libstdc++/include \ 43 bionic 44 ifeq ($(my_cxx_stl),stlport) 45 my_shared_libraries += libstdc++ libstlport 46 else 47 my_static_libraries += libstdc++ libstlport_static 48 endif 49 endif 50else ifeq ($(my_cxx_stl),ndk) 51 # Using an NDK STL. Handled farther up in this file. 52 ifndef LOCAL_IS_HOST_MODULE 53 my_system_shared_libraries += libstdc++ 54 endif 55else ifeq ($(my_cxx_stl),libstdc++) 56 # Using bionic's basic libstdc++. Not actually an STL. Only around until the 57 # tree is in good enough shape to not need it. 58 ifndef LOCAL_IS_HOST_MODULE 59 my_c_includes += bionic/libstdc++/include 60 my_system_shared_libraries += libstdc++ 61 endif 62 # Host builds will use GNU libstdc++. 63else ifeq ($(my_cxx_stl),none) 64 ifdef LOCAL_IS_HOST_MODULE 65 my_cppflags += -nostdinc++ 66 my_ldflags += -nodefaultlibs -lc -lm 67 endif 68else 69 $(error $(my_cxx_stl) is not a supported STL.) 70endif 71