blob: 0f574d2d0c956b0f0c67c1d242bf04c1d8ddf57d [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
Ying Wang75e8fcb2014-10-07 13:03:29 -07007# Select the appropriate C++ STL
8ifeq ($(strip $(LOCAL_CXX_STL)),default)
9 ifndef LOCAL_SDK_VERSION
Dan Albert93766b22014-10-16 19:07:41 -070010 # Platform code. Select the appropriate STL.
11 ifndef USE_MINGW
Ying Wang75e8fcb2014-10-07 13:03:29 -070012 my_cxx_stl := libc++
13 else
Dan Albert93766b22014-10-16 19:07:41 -070014 # libc++ is not supported on mingw.
Dan Albert93e8cf72014-10-16 21:18:15 -070015 my_cxx_stl := libstdc++
Ying Wang75e8fcb2014-10-07 13:03:29 -070016 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
Dan Albert5cab04f2014-11-06 17:32:25 -080036 my_ldlibs += -lc -lm -lpthread
Ying Wang75e8fcb2014-10-07 13:03:29 -070037 endif
38else ifneq ($(filter $(my_cxx_stl),stlport stlport_static),)
Dan Albertb49987e2014-10-16 09:53:51 -070039 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
Ying Wang75e8fcb2014-10-07 13:03:29 -070047 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
Dan Albert93e8cf72014-10-16 21:18:15 -070053else ifeq ($(my_cxx_stl),libstdc++)
Ying Wang75e8fcb2014-10-07 13:03:29 -070054 # 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