blob: c688088baffc61c13a399c36fbd7381179c6ba8f [file] [log] [blame]
Ying Wang75e8fcb2014-10-07 13:03:29 -07001#############################################################
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
Dan Albert93e8cf72014-10-16 21:18:15 -070017 my_cxx_stl := libstdc++
Ying Wang75e8fcb2014-10-07 13:03:29 -070018 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
39 endif
40else ifneq ($(filter $(my_cxx_stl),stlport stlport_static),)
Dan Albertb49987e2014-10-16 09:53:51 -070041 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
Ying Wang75e8fcb2014-10-07 13:03:29 -070049 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
Dan Albert93e8cf72014-10-16 21:18:15 -070055else ifeq ($(my_cxx_stl),libstdc++)
Ying Wang75e8fcb2014-10-07 13:03:29 -070056 # 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