• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
17LOCAL_PATH := $(call my-dir)
18
19libcxxabi_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
39libunwind_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
48libcxxabi_includes := \
49    $(LOCAL_PATH)/libcxxabi/include \
50    $(LOCAL_PATH)/../llvm-libc++/libcxx/include \
51
52libcxxabi_cflags := -D__STDC_FORMAT_MACROS
53libcxxabi_cppflags := -std=c++11
54
55ifneq (,$(filter armeabi%,$(TARGET_ARCH_ABI)))
56    use_llvm_unwinder := true
57    libcxxabi_cppflags += -DLIBCXXABI_USE_LLVM_UNWINDER=1
58else
59    use_llvm_unwinder := false
60    libcxxabi_cppflags += -DLIBCXXABI_USE_LLVM_UNWINDER=0
61endif
62
63ifneq ($(LIBCXX_FORCE_REBUILD),true) # Using prebuilt
64
65ifeq ($(use_llvm_unwinder),true)
66include $(CLEAR_VARS)
67LOCAL_MODULE := libunwind
68LOCAL_SRC_FILES := ../llvm-libc++/libs/$(TARGET_ARCH_ABI)/$(LOCAL_MODULE)$(TARGET_LIB_EXTENSION)
69LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/libcxxabi/include
70include $(PREBUILT_STATIC_LIBRARY)
71endif
72
73include $(CLEAR_VARS)
74LOCAL_MODULE := libc++abi
75LOCAL_SRC_FILES := ../llvm-libc++/libs/$(TARGET_ARCH_ABI)/$(LOCAL_MODULE)$(TARGET_LIB_EXTENSION)
76LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/libcxxabi/include
77include $(PREBUILT_STATIC_LIBRARY)
78
79else # Building
80
81include $(CLEAR_VARS)
82LOCAL_MODULE := libunwind
83LOCAL_SRC_FILES := $(libunwind_src_files)
84LOCAL_C_INCLUDES := $(libcxxabi_includes)
85LOCAL_CFLAGS := $(libcxxabi_cflags) -fvisibility=hidden
86LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/libcxxabi/include
87include $(BUILD_STATIC_LIBRARY)
88
89include $(CLEAR_VARS)
90LOCAL_MODULE := libc++abi
91LOCAL_SRC_FILES := $(libcxxabi_src_files)
92LOCAL_C_INCLUDES := $(libcxxabi_includes)
93LOCAL_CPPFLAGS := $(libcxxabi_cppflags)
94LOCAL_CPP_FEATURES := rtti exceptions
95LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/libcxxabi/include
96LOCAL_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.
102ifeq ($(use_llvm_unwinder),true)
103    LOCAL_STATIC_LIBRARIES += libunwind
104endif
105include $(BUILD_STATIC_LIBRARY)
106
107endif # Prebuilt/building
108
109$(call import-module, android/support)
110