cxx_stl_setup.mk revision 4f2afde2528c6870eef470436842eabdd76953c3
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# Select the appropriate C++ STL 8ifeq ($(strip $(LOCAL_CXX_STL)),default) 9 ifndef LOCAL_SDK_VERSION 10 # Platform code. Select the appropriate STL. 11 ifndef USE_MINGW 12 my_cxx_stl := libc++ 13 ifdef LOCAL_IS_HOST_MODULE 14 ifneq (,$(BUILD_HOST_static)) 15 my_cxx_stl := libc++_static 16 endif 17 endif 18 else 19 # libc++ is not supported on mingw. 20 my_cxx_stl := libstdc++ 21 endif 22 else 23 my_cxx_stl := ndk 24 endif 25else 26 my_cxx_stl := $(strip $(LOCAL_CXX_STL)) 27endif 28 29# Yes, this is actually what the clang driver does. 30HOST_dynamic_gcclibs := -lgcc_s -lgcc -lc -lgcc_s -lgcc 31HOST_static_gcclibs := -Wl,--start-group -lgcc -lgcc_eh -lc -Wl,--end-group 32 33ifneq ($(filter $(my_cxx_stl),libc++ libc++_static),) 34 my_cflags += -D_USING_LIBCXX 35 my_c_includes += external/libcxx/include 36 ifeq ($(my_cxx_stl),libc++) 37 my_shared_libraries += libc++ 38 else 39 my_static_libraries += libc++_static 40 endif 41 42 ifdef LOCAL_IS_HOST_MODULE 43 my_cppflags += -nostdinc++ 44 my_ldflags += -nodefaultlibs 45 my_ldlibs += -lpthread -lm 46 ifeq (,$(BUILD_HOST_static)) 47 my_ldlibs += $(HOST_dynamic_gcclibs) 48 else 49 my_ldlibs += $(HOST_static_gcclibs) 50 endif 51 endif 52else ifneq ($(filter $(my_cxx_stl),stlport stlport_static),) 53 ifndef LOCAL_IS_HOST_MODULE 54 my_c_includes += external/stlport/stlport bionic/libstdc++/include \ 55 bionic 56 ifeq ($(my_cxx_stl),stlport) 57 my_shared_libraries += libstdc++ libstlport 58 else 59 my_static_libraries += libstdc++ libstlport_static 60 endif 61 endif 62else ifeq ($(my_cxx_stl),ndk) 63 # Using an NDK STL. Handled farther up in this file. 64 ifndef LOCAL_IS_HOST_MODULE 65 my_system_shared_libraries += libstdc++ 66 endif 67else ifeq ($(my_cxx_stl),libstdc++) 68 # Using bionic's basic libstdc++. Not actually an STL. Only around until the 69 # tree is in good enough shape to not need it. 70 ifndef LOCAL_IS_HOST_MODULE 71 my_c_includes += bionic/libstdc++/include 72 my_system_shared_libraries += libstdc++ 73 endif 74 # Host builds will use GNU libstdc++. 75else ifeq ($(my_cxx_stl),none) 76 ifdef LOCAL_IS_HOST_MODULE 77 my_cppflags += -nostdinc++ 78 my_ldflags += -nodefaultlibs 79 ifeq (,$(BUILD_HOST_static)) 80 my_ldlibs += $(HOST_dynamic_gcclibs) 81 else 82 my_ldlibs += $(HOST_static_gcclibs) 83 endif 84 endif 85else 86 $(error $(my_cxx_stl) is not a supported STL.) 87endif 88