cxx_stl_setup.mk revision 93766b28ce8ad81bd5a1dd39d7ddd80b65e2a424
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        else
14            # libc++ is not supported on mingw.
15            my_cxx_stl := libstdc++
16        endif
17    else
18        my_cxx_stl := ndk
19    endif
20else
21    my_cxx_stl := $(strip $(LOCAL_CXX_STL))
22endif
23
24ifneq ($(filter $(my_cxx_stl),libc++ libc++_static),)
25    my_cflags += -D_USING_LIBCXX
26    my_c_includes += external/libcxx/include
27    ifeq ($(my_cxx_stl),libc++)
28        my_shared_libraries += libc++
29    else
30        my_static_libraries += libc++_static
31    endif
32
33    ifdef LOCAL_IS_HOST_MODULE
34        my_cppflags += -nostdinc++
35        my_ldflags += -nodefaultlibs
36        my_ldlibs += -lc -lm -lpthread
37    endif
38else ifneq ($(filter $(my_cxx_stl),stlport stlport_static),)
39    ifndef LOCAL_IS_HOST_MODULE
40        my_c_includes += external/stlport/stlport bionic/libstdc++/include \
41                         bionic
42        ifeq ($(my_cxx_stl),stlport)
43            my_shared_libraries += libstdc++ libstlport
44        else
45            my_static_libraries += libstdc++ libstlport_static
46        endif
47    endif
48else ifeq ($(my_cxx_stl),ndk)
49    # Using an NDK STL. Handled farther up in this file.
50    ifndef LOCAL_IS_HOST_MODULE
51        my_system_shared_libraries += libstdc++
52    endif
53else ifeq ($(my_cxx_stl),libstdc++)
54    # Using bionic's basic libstdc++. Not actually an STL. Only around until the
55    # tree is in good enough shape to not need it.
56    ifndef LOCAL_IS_HOST_MODULE
57        my_c_includes += bionic/libstdc++/include
58        my_system_shared_libraries += libstdc++
59    endif
60    # Host builds will use GNU libstdc++.
61else ifeq ($(my_cxx_stl),none)
62    ifdef LOCAL_IS_HOST_MODULE
63        my_cppflags += -nostdinc++
64        my_ldflags += -nodefaultlibs -lc -lm
65    endif
66else
67    $(error $(my_cxx_stl) is not a supported STL.)
68endif
69