1 # This file is dual licensed under the MIT and the University of Illinois Open 2 # Source Licenses. See LICENSE.TXT for details. 3 4 LOCAL_PATH := $(call my-dir) 5 6 llvm_libc++_includes := $(LOCAL_PATH)/libcxx/include 7 llvm_libc++_export_includes := $(llvm_libc++_includes) 8 llvm_libc++_sources := \ 9 algorithm.cpp \ 10 bind.cpp \ 11 chrono.cpp \ 12 condition_variable.cpp \ 13 debug.cpp \ 14 exception.cpp \ 15 future.cpp \ 16 hash.cpp \ 17 ios.cpp \ 18 iostream.cpp \ 19 locale.cpp \ 20 memory.cpp \ 21 mutex.cpp \ 22 new.cpp \ 23 random.cpp \ 24 regex.cpp \ 25 stdexcept.cpp \ 26 string.cpp \ 27 strstream.cpp \ 28 system_error.cpp \ 29 thread.cpp \ 30 typeinfo.cpp \ 31 utility.cpp \ 32 valarray.cpp \ 33 support/android/locale_android.cpp 34 35 llvm_libc++_sources := $(llvm_libc++_sources:%=libcxx/src/%) 36 37 # For now, this library can only be used to build C++11 binaries. 38 llvm_libc++_export_cxxflags := -std=c++11 39 40 llvm_libc++_cxxflags := $(llvm_libc++_export_cxxflags) 41 42 # Building this library with -fno-rtti is not supported, though using it 43 # without RTTI is ok. 44 # 45 llvm_libc++_cxxflags += -fno-rtti 46 47 # LIBCXXRT tells the library to support building against the libcxxrt 48 # C++ runtime, instead of GNU libsupc++. 49 # 50 llvm_libc++_cxxflags += -DLIBCXXRT=1 51 52 # Since libcxxrt seems to hard to port to Android, use GAbi++ instead. 53 # The GAbi++ sources are compiled with the GABIXX_LIBCXX macro defined 54 # to tell them they'll be part of libc++. 55 # 56 # This is also used in a couple of places inside of libc++ to deal with 57 # a few cases where GAbi++ doesn't support the libcxxrt ABI perfectly 58 # yet. 59 # 60 llvm_libc++_cxxflags += -DGABIXX_LIBCXX 61 62 # Find the GAbi++ sources to include them here. 63 # The voodoo below is to allow building libc++ out of the NDK source 64 # tree. This can make it easier to experiment / update / debug it. 65 # 66 libgabi++_sources_dir := $(strip $(wildcard $(LOCAL_PATH)/../gabi++)) 67 ifdef libgabi++_sources_dir 68 libgabi++_sources_prefix := ../gabi++ 69 else 70 libgabi++_sources_dir := $(strip $(wildcard $(NDK_ROOT)/sources/cxx-stl/gabi++)) 71 ifndef libgabi++_sources_dir 72 $(error Can't find GAbi++ sources directory!!) 73 endif 74 libgabi++_sources_prefix := $(libgabi++_sources_dir) 75 endif 76 77 include $(libgabi++_sources_dir)/sources.mk 78 llvm_libc++_sources += $(addprefix $(libgabi++_sources_prefix:%/=%)/,$(libgabi++_src_files)) 79 llvm_libc++_includes += $(libgabi++_c_includes) 80 llvm_libc++_export_includes += $(libgabi++_c_includes) 81 82 include $(CLEAR_VARS) 83 LOCAL_MODULE := libc++_static 84 LOCAL_SRC_FILES := $(llvm_libc++_sources) 85 LOCAL_C_INCLUDES := $(llvm_libc++_includes) 86 LOCAL_CPPFLAGS := $(llvm_libc++_cxxflags) 87 LOCAL_CPP_FEATURES := rtti exceptions 88 LOCAL_EXPORT_C_INCLUDES := $(llvm_libc++_export_includes) 89 LOCAL_EXPORT_CPPFLAGS := $(llvm_libc++_export_cxxflags) 90 LOCAL_STATIC_LIBRARIES := android_support 91 include $(BUILD_STATIC_LIBRARY) 92 93 include $(CLEAR_VARS) 94 LOCAL_MODULE := libc++_shared 95 LOCAL_SRC_FILES := $(llvm_libc++_sources) 96 LOCAL_C_INCLUDES := $(llvm_libc++_includes) 97 LOCAL_CPPFLAGS := $(llvm_libc++_cxxflags) 98 LOCAL_CPP_FEATURES := rtti exceptions 99 LOCAL_EXPORT_C_INCLUDES := $(llvm_libc++_export_includes) 100 LOCAL_EXPORT_CPPFLAGS := $(llvm_libc++_export_cxxflags) 101 LOCAL_STATIC_LIBRARIES := android_support 102 include $(BUILD_SHARED_LIBRARY) 103 104 $(call import-module, android/support) 105