blob: 5abdf7023d70051433f3604763979c5dac4c442d [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
17 my_cxx_stl := bionic
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
39 endif
40else ifneq ($(filter $(my_cxx_stl),stlport stlport_static),)
41 my_c_includes += external/stlport/stlport bionic/libstdc++/include bionic
42 ifeq ($(my_cxx_stl),stlport)
43 my_shared_libraries += libstdc++ libstlport
44 else
45 my_static_libraries += libstdc++ libstlport_static
46 endif
47else ifeq ($(my_cxx_stl),ndk)
48 # Using an NDK STL. Handled farther up in this file.
49 ifndef LOCAL_IS_HOST_MODULE
50 my_system_shared_libraries += libstdc++
51 endif
52else ifeq ($(my_cxx_stl),bionic)
53 # Using bionic's basic libstdc++. Not actually an STL. Only around until the
54 # tree is in good enough shape to not need it.
55 ifndef LOCAL_IS_HOST_MODULE
56 my_c_includes += bionic/libstdc++/include
57 my_system_shared_libraries += libstdc++
58 endif
59 # Host builds will use GNU libstdc++.
60else ifeq ($(my_cxx_stl),none)
61 ifdef LOCAL_IS_HOST_MODULE
62 my_cppflags += -nostdinc++
63 my_ldflags += -nodefaultlibs -lc -lm
64 endif
65else
66 $(error $(my_cxx_stl) is not a supported STL.)
67endif