2014-10-08 04:03:29 +08:00
|
|
|
#############################################################
|
|
|
|
## Set up flags based on LOCAL_CXX_STL.
|
|
|
|
## Input variables: LOCAL_CXX_STL
|
|
|
|
## Output variables: My_cflags, my_c_includes, my_shared_libraries, etc.
|
|
|
|
#############################################################
|
|
|
|
|
|
|
|
# Select the appropriate C++ STL
|
|
|
|
ifeq ($(strip $(LOCAL_CXX_STL)),default)
|
|
|
|
ifndef LOCAL_SDK_VERSION
|
2014-10-17 10:07:41 +08:00
|
|
|
# Platform code. Select the appropriate STL.
|
|
|
|
ifndef USE_MINGW
|
2014-10-08 04:03:29 +08:00
|
|
|
my_cxx_stl := libc++
|
2015-03-04 06:10:27 +08:00
|
|
|
ifdef LOCAL_IS_HOST_MODULE
|
|
|
|
ifneq (,$(BUILD_HOST_static))
|
|
|
|
my_cxx_stl := libc++_static
|
|
|
|
endif
|
|
|
|
endif
|
2014-10-08 04:03:29 +08:00
|
|
|
else
|
2014-10-17 10:07:41 +08:00
|
|
|
# libc++ is not supported on mingw.
|
2014-10-17 12:18:15 +08:00
|
|
|
my_cxx_stl := libstdc++
|
2014-10-08 04:03:29 +08:00
|
|
|
endif
|
|
|
|
else
|
|
|
|
my_cxx_stl := ndk
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
my_cxx_stl := $(strip $(LOCAL_CXX_STL))
|
|
|
|
endif
|
|
|
|
|
2015-03-04 09:42:28 +08:00
|
|
|
# Yes, this is actually what the clang driver does.
|
2015-03-04 13:47:04 +08:00
|
|
|
HOST_linux_dynamic_gcclibs := -lgcc_s -lgcc -lc -lgcc_s -lgcc
|
|
|
|
HOST_linux_static_gcclibs := -Wl,--start-group -lgcc -lgcc_eh -lc -Wl,--end-group
|
|
|
|
HOST_darwin_dynamic_gcclibs := -lc -lSystem
|
|
|
|
HOST_darwin_static_gcclibs := NO_STATIC_HOST_BINARIES_ON_DARWIN
|
2015-03-04 09:42:28 +08:00
|
|
|
|
2015-03-04 10:30:27 +08:00
|
|
|
my_link_type := dynamic
|
|
|
|
ifdef LOCAL_IS_HOST_MODULE
|
|
|
|
ifneq (,$(BUILD_HOST_static))
|
|
|
|
my_link_type := static
|
|
|
|
endif
|
|
|
|
ifeq (-static,$(filter -static,$(my_ldflags)))
|
|
|
|
my_link_type := static
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
ifeq (true,$(LOCAL_FORCE_STATIC_EXECUTABLE))
|
|
|
|
my_link_type := static
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2014-10-08 04:03:29 +08:00
|
|
|
ifneq ($(filter $(my_cxx_stl),libc++ libc++_static),)
|
|
|
|
my_cflags += -D_USING_LIBCXX
|
|
|
|
my_c_includes += external/libcxx/include
|
|
|
|
ifeq ($(my_cxx_stl),libc++)
|
|
|
|
my_shared_libraries += libc++
|
|
|
|
else
|
|
|
|
my_static_libraries += libc++_static
|
2015-03-20 04:05:13 +08:00
|
|
|
ifndef LOCAL_IS_HOST_MODULE
|
|
|
|
ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
|
|
|
|
my_static_libraries += libm libc libdl
|
|
|
|
endif
|
|
|
|
endif
|
2014-10-08 04:03:29 +08:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef LOCAL_IS_HOST_MODULE
|
|
|
|
my_cppflags += -nostdinc++
|
|
|
|
my_ldflags += -nodefaultlibs
|
2015-03-04 06:10:27 +08:00
|
|
|
my_ldlibs += -lpthread -lm
|
2015-03-04 13:47:04 +08:00
|
|
|
my_ldlibs += $($(my_prefix)$(HOST_OS)_$(my_link_type)_gcclibs)
|
2015-04-01 06:18:17 +08:00
|
|
|
else
|
|
|
|
ifeq (arm,$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
|
|
|
|
my_static_libraries += libunwind_llvm
|
2015-06-24 04:32:30 +08:00
|
|
|
my_ldflags += -Wl,--exclude-libs,libunwind_llvm.a
|
2015-04-01 06:18:17 +08:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(my_link_type),static)
|
|
|
|
my_static_libraries += libdl
|
|
|
|
else
|
|
|
|
my_shared_libraries += libdl
|
|
|
|
endif
|
2014-10-08 04:03:29 +08:00
|
|
|
endif
|
|
|
|
else ifeq ($(my_cxx_stl),ndk)
|
2015-05-07 01:08:32 +08:00
|
|
|
# Using an NDK STL. Handled in binary.mk.
|
2014-10-08 04:03:29 +08:00
|
|
|
ifndef LOCAL_IS_HOST_MODULE
|
|
|
|
my_system_shared_libraries += libstdc++
|
|
|
|
endif
|
2014-10-17 12:18:15 +08:00
|
|
|
else ifeq ($(my_cxx_stl),libstdc++)
|
2014-10-08 04:03:29 +08:00
|
|
|
# Using bionic's basic libstdc++. Not actually an STL. Only around until the
|
|
|
|
# tree is in good enough shape to not need it.
|
|
|
|
ifndef LOCAL_IS_HOST_MODULE
|
|
|
|
my_c_includes += bionic/libstdc++/include
|
|
|
|
my_system_shared_libraries += libstdc++
|
|
|
|
endif
|
|
|
|
# Host builds will use GNU libstdc++.
|
|
|
|
else ifeq ($(my_cxx_stl),none)
|
|
|
|
ifdef LOCAL_IS_HOST_MODULE
|
|
|
|
my_cppflags += -nostdinc++
|
2015-03-04 06:10:27 +08:00
|
|
|
my_ldflags += -nodefaultlibs
|
2015-03-04 13:47:04 +08:00
|
|
|
my_ldlibs += $($(my_prefix)$(HOST_OS)_$(my_link_type)_gcclibs)
|
2014-10-08 04:03:29 +08:00
|
|
|
endif
|
|
|
|
else
|
2015-05-07 01:08:32 +08:00
|
|
|
$(error $(LOCAL_PATH): $(LOCAL_MODULE): $(my_cxx_stl) is not a supported STL.)
|
2014-10-08 04:03:29 +08:00
|
|
|
endif
|