blob: c1ce6e1cdafcadf37401d1b2057b0c6b57b26a8d [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++
Dan Albert8bf4cc92015-03-03 14:10:27 -080013 ifdef LOCAL_IS_HOST_MODULE
14 ifneq (,$(BUILD_HOST_static))
15 my_cxx_stl := libc++_static
16 endif
17 endif
Ying Wang75e8fcb2014-10-07 13:03:29 -070018 else
Dan Albert93766b22014-10-16 19:07:41 -070019 # libc++ is not supported on mingw.
Dan Albert93e8cf72014-10-16 21:18:15 -070020 my_cxx_stl := libstdc++
Ying Wang75e8fcb2014-10-07 13:03:29 -070021 endif
22 else
23 my_cxx_stl := ndk
24 endif
25else
26 my_cxx_stl := $(strip $(LOCAL_CXX_STL))
27endif
28
29ifneq ($(filter $(my_cxx_stl),libc++ libc++_static),)
30 my_cflags += -D_USING_LIBCXX
31 my_c_includes += external/libcxx/include
32 ifeq ($(my_cxx_stl),libc++)
33 my_shared_libraries += libc++
34 else
35 my_static_libraries += libc++_static
36 endif
37
38 ifdef LOCAL_IS_HOST_MODULE
39 my_cppflags += -nostdinc++
40 my_ldflags += -nodefaultlibs
Dan Albert8bf4cc92015-03-03 14:10:27 -080041 my_ldlibs += -lpthread -lm
42 my_ldlibs += -Wl,--start-group -lgcc -lgcc_eh -lc -Wl,--end-group
Ying Wang75e8fcb2014-10-07 13:03:29 -070043 endif
44else ifneq ($(filter $(my_cxx_stl),stlport stlport_static),)
Dan Albertb49987e2014-10-16 09:53:51 -070045 ifndef LOCAL_IS_HOST_MODULE
46 my_c_includes += external/stlport/stlport bionic/libstdc++/include \
47 bionic
48 ifeq ($(my_cxx_stl),stlport)
49 my_shared_libraries += libstdc++ libstlport
50 else
51 my_static_libraries += libstdc++ libstlport_static
52 endif
Ying Wang75e8fcb2014-10-07 13:03:29 -070053 endif
54else ifeq ($(my_cxx_stl),ndk)
55 # Using an NDK STL. Handled farther up in this file.
56 ifndef LOCAL_IS_HOST_MODULE
57 my_system_shared_libraries += libstdc++
58 endif
Dan Albert93e8cf72014-10-16 21:18:15 -070059else ifeq ($(my_cxx_stl),libstdc++)
Ying Wang75e8fcb2014-10-07 13:03:29 -070060 # Using bionic's basic libstdc++. Not actually an STL. Only around until the
61 # tree is in good enough shape to not need it.
62 ifndef LOCAL_IS_HOST_MODULE
63 my_c_includes += bionic/libstdc++/include
64 my_system_shared_libraries += libstdc++
65 endif
66 # Host builds will use GNU libstdc++.
67else ifeq ($(my_cxx_stl),none)
68 ifdef LOCAL_IS_HOST_MODULE
69 my_cppflags += -nostdinc++
Dan Albert8bf4cc92015-03-03 14:10:27 -080070 my_ldflags += -nodefaultlibs
71 my_ldlibs += -lm -Wl,--start-group -lgcc -lgcc_eh -lc -Wl,--end-group
Ying Wang75e8fcb2014-10-07 13:03:29 -070072 endif
73else
74 $(error $(my_cxx_stl) is not a supported STL.)
75endif