Home | History | Annotate | Download | only in llvm-libc++abi
      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     src/abort_message.cpp \
     21     src/cxa_aux_runtime.cpp \
     22     src/cxa_default_handlers.cpp \
     23     src/cxa_demangle.cpp \
     24     src/cxa_exception.cpp \
     25     src/cxa_exception_storage.cpp \
     26     src/cxa_guard.cpp \
     27     src/cxa_handlers.cpp \
     28     src/cxa_new_delete.cpp \
     29     src/cxa_personality.cpp \
     30     src/cxa_thread_atexit.cpp \
     31     src/cxa_unexpected.cpp \
     32     src/cxa_vector.cpp \
     33     src/cxa_virtual.cpp \
     34     src/exception.cpp \
     35     src/private_typeinfo.cpp \
     36     src/stdexcept.cpp \
     37     src/typeinfo.cpp
     38 
     39 libcxxabi_includes := \
     40     $(LOCAL_PATH)/include \
     41     $(LOCAL_PATH)/../libunwind_llvm/include \
     42     $(LOCAL_PATH)/../libcxx/include \
     43     $(LOCAL_PATH)/../../ndk/sources/android/support/include
     44 
     45 libcxxabi_cflags := -D__STDC_FORMAT_MACROS
     46 libcxxabi_cppflags := -std=c++11
     47 
     48 ifneq (,$(filter armeabi%,$(TARGET_ARCH_ABI)))
     49     use_llvm_unwinder := true
     50     libcxxabi_cppflags += -DLIBCXXABI_USE_LLVM_UNWINDER=1
     51 else
     52     use_llvm_unwinder := false
     53     libcxxabi_cppflags += -DLIBCXXABI_USE_LLVM_UNWINDER=0
     54 endif
     55 
     56 ifneq ($(LIBCXX_FORCE_REBUILD),true) # Using prebuilt
     57 
     58 include $(CLEAR_VARS)
     59 LOCAL_MODULE := libc++abi
     60 LOCAL_SRC_FILES := ../llvm-libc++/libs/$(TARGET_ARCH_ABI)/$(LOCAL_MODULE)$(TARGET_LIB_EXTENSION)
     61 LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
     62 include $(PREBUILT_STATIC_LIBRARY)
     63 
     64 else # Building
     65 
     66 include $(CLEAR_VARS)
     67 LOCAL_MODULE := libc++abi
     68 LOCAL_SRC_FILES := $(libcxxabi_src_files)
     69 LOCAL_C_INCLUDES := $(libcxxabi_includes)
     70 LOCAL_CPPFLAGS := $(libcxxabi_cppflags)
     71 LOCAL_CPP_FEATURES := rtti exceptions
     72 LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
     73 LOCAL_STATIC_LIBRARIES := android_support
     74 
     75 # Unlike the platform build, ndk-build will actually perform dependency checking
     76 # on static libraries and topologically sort them to determine link order.
     77 # Though there is no link step, without this we may link libunwind before
     78 # libc++abi, which won't succeed.
     79 ifeq ($(use_llvm_unwinder),true)
     80     LOCAL_STATIC_LIBRARIES += libunwind
     81 endif
     82 include $(BUILD_STATIC_LIBRARY)
     83 
     84 $(call import-add-path, $(LOCAL_PATH)/../..)
     85 $(call import-module, external/libunwind_llvm)
     86 
     87 endif # Prebuilt/building
     88 
     89 $(call import-module, android/support)
     90