1 # 2 # Copyright (C) 2016 The Android Open Source Project 3 # 4 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # you may not use this file except in compliance with the License. 6 # You may obtain a copy of the License at 7 # 8 # http://www.apache.org/licenses/LICENSE-2.0 9 # 10 # Unless required by applicable law or agreed to in writing, software 11 # distributed under the License is distributed on an "AS IS" BASIS, 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 # 16 17 LOCAL_PATH := $(call my-dir) 18 19 libcxxabi_src_files := \ 20 libcxxabi/src/abort_message.cpp \ 21 libcxxabi/src/cxa_aux_runtime.cpp \ 22 libcxxabi/src/cxa_default_handlers.cpp \ 23 libcxxabi/src/cxa_demangle.cpp \ 24 libcxxabi/src/cxa_exception.cpp \ 25 libcxxabi/src/cxa_exception_storage.cpp \ 26 libcxxabi/src/cxa_guard.cpp \ 27 libcxxabi/src/cxa_handlers.cpp \ 28 libcxxabi/src/cxa_new_delete.cpp \ 29 libcxxabi/src/cxa_personality.cpp \ 30 libcxxabi/src/cxa_thread_atexit.cpp \ 31 libcxxabi/src/cxa_unexpected.cpp \ 32 libcxxabi/src/cxa_vector.cpp \ 33 libcxxabi/src/cxa_virtual.cpp \ 34 libcxxabi/src/exception.cpp \ 35 libcxxabi/src/private_typeinfo.cpp \ 36 libcxxabi/src/stdexcept.cpp \ 37 libcxxabi/src/typeinfo.cpp 38 39 libunwind_src_files := \ 40 libcxxabi/src/Unwind/libunwind.cpp \ 41 libcxxabi/src/Unwind/Unwind-EHABI.cpp \ 42 libcxxabi/src/Unwind/Unwind-sjlj.c \ 43 libcxxabi/src/Unwind/UnwindLevel1.c \ 44 libcxxabi/src/Unwind/UnwindLevel1-gcc-ext.c \ 45 libcxxabi/src/Unwind/UnwindRegistersRestore.S \ 46 libcxxabi/src/Unwind/UnwindRegistersSave.S 47 48 libcxxabi_includes := \ 49 $(LOCAL_PATH)/libcxxabi/include \ 50 $(LOCAL_PATH)/../llvm-libc++/libcxx/include \ 51 52 libcxxabi_cflags := -D__STDC_FORMAT_MACROS 53 libcxxabi_cppflags := -std=c++11 54 55 ifneq (,$(filter armeabi%,$(TARGET_ARCH_ABI))) 56 use_llvm_unwinder := true 57 libcxxabi_cppflags += -DLIBCXXABI_USE_LLVM_UNWINDER=1 58 else 59 use_llvm_unwinder := false 60 libcxxabi_cppflags += -DLIBCXXABI_USE_LLVM_UNWINDER=0 61 endif 62 63 ifneq ($(LIBCXX_FORCE_REBUILD),true) # Using prebuilt 64 65 ifeq ($(use_llvm_unwinder),true) 66 include $(CLEAR_VARS) 67 LOCAL_MODULE := libunwind 68 LOCAL_SRC_FILES := ../llvm-libc++/libs/$(TARGET_ARCH_ABI)/$(LOCAL_MODULE)$(TARGET_LIB_EXTENSION) 69 LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/libcxxabi/include 70 include $(PREBUILT_STATIC_LIBRARY) 71 endif 72 73 include $(CLEAR_VARS) 74 LOCAL_MODULE := libc++abi 75 LOCAL_SRC_FILES := ../llvm-libc++/libs/$(TARGET_ARCH_ABI)/$(LOCAL_MODULE)$(TARGET_LIB_EXTENSION) 76 LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/libcxxabi/include 77 include $(PREBUILT_STATIC_LIBRARY) 78 79 else # Building 80 81 include $(CLEAR_VARS) 82 LOCAL_MODULE := libunwind 83 LOCAL_SRC_FILES := $(libunwind_src_files) 84 LOCAL_C_INCLUDES := $(libcxxabi_includes) 85 LOCAL_CFLAGS := $(libcxxabi_cflags) -fvisibility=hidden 86 LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/libcxxabi/include 87 include $(BUILD_STATIC_LIBRARY) 88 89 include $(CLEAR_VARS) 90 LOCAL_MODULE := libc++abi 91 LOCAL_SRC_FILES := $(libcxxabi_src_files) 92 LOCAL_C_INCLUDES := $(libcxxabi_includes) 93 LOCAL_CPPFLAGS := $(libcxxabi_cppflags) 94 LOCAL_CPP_FEATURES := rtti exceptions 95 LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/libcxxabi/include 96 LOCAL_STATIC_LIBRARIES := android_support 97 98 # Unlike the platform build, ndk-build will actually perform dependency checking 99 # on static libraries and topologically sort them to determine link order. 100 # Though there is no link step, without this we may link libunwind before 101 # libc++abi, which won't succeed. 102 ifeq ($(use_llvm_unwinder),true) 103 LOCAL_STATIC_LIBRARIES += libunwind 104 endif 105 include $(BUILD_STATIC_LIBRARY) 106 107 endif # Prebuilt/building 108 109 $(call import-module, android/support) 110