Home | History | Annotate | Download | only in libunwind
      1 #
      2 # Copyright (C) 2014 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 include $(CLEAR_VARS)
     18 
     19 ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),mips mips64 x86_64))
     20 # Many init services failed to start with clang for x86_64, mips, mips64
     21 LOCAL_CLANG := false
     22 endif
     23 
     24 LOCAL_MODULE := $(libunwind_module)
     25 LOCAL_MODULE_TAGS := $(libunwind_module_tag)
     26 ifeq ($(libunwind_build_type),host)
     27 # Always make host multilib, and always use clang.
     28 LOCAL_MULTILIB := both
     29 LOCAL_CLANG := true
     30 else
     31 LOCAL_MULTILIB := $($(libunwind_module)_multilib)
     32 endif
     33 
     34 ifneq ($(findstring LIBRARY, $(libunwind_build_target)),LIBRARY)
     35 ifeq ($(LOCAL_MULTILIB),both)
     36     LOCAL_MODULE_STEM_32 := $(libunwind_module)32
     37     LOCAL_MODULE_STEM_64 := $(libunwind_module)64
     38 endif
     39 endif
     40 
     41 LOCAL_ADDITIONAL_DEPENDENCIES := \
     42     $(LOCAL_PATH)/Android.mk \
     43     $(LOCAL_PATH)/Android.build.mk \
     44 
     45 LOCAL_CFLAGS += \
     46     $(libunwind_common_cflags) \
     47     $(libunwind_common_cflags_$(libunwind_build_type)) \
     48     $($(libunwind_module)_cflags) \
     49     $($(libunwind_module)_cflags_$(libunwind_build_type)) \
     50 
     51 LOCAL_CLANG_CFLAGS += \
     52     $(libunwind_common_clang_cflags) \
     53     $(libunwind_common_clang_cflags_$(libunwind_build_type)) \
     54     $($(libunwind_module)_clang_cflags) \
     55     $($(libunwind_module)_clang_cflags_$(libunwind_build_type)) \
     56 
     57 LOCAL_CONLYFLAGS += \
     58     $(libunwind_common_conlyflags) \
     59     $(libunwind_common_conlyflags_$(libunwind_build_type)) \
     60     $($(libunwind_module)_conlyflags) \
     61     $($(libunwind_module)_conlyflags_$(libunwind_build_type)) \
     62 
     63 LOCAL_CPPFLAGS += \
     64     $(libunwind_common_cppflags) \
     65     $($(libunwind_module)_cppflags) \
     66     $($(libunwind_module)_cppflags_$(libunwind_build_type)) \
     67 
     68 LOCAL_C_INCLUDES := \
     69     $(libunwind_common_c_includes) \
     70     $($(libunwind_module)_c_includes) \
     71     $($(libunwind_module)_c_includes_$(libunwind_build_type)) \
     72 
     73 LOCAL_EXPORT_C_INCLUDE_DIRS := \
     74     $($(libunwind_module)_export_c_include_dirs)
     75 
     76 $(foreach arch,$(libunwind_arches), \
     77     $(eval LOCAL_C_INCLUDES_$(arch) := $(libunwind_common_c_includes_$(arch))))
     78 
     79 LOCAL_SRC_FILES := \
     80     $($(libunwind_module)_src_files) \
     81     $($(libunwind_module)_src_files_$(build_type)) \
     82 
     83 $(foreach arch,$(libunwind_arches), \
     84     $(eval LOCAL_SRC_FILES_$(arch) := $($(libunwind_module)_src_files_$(arch))))
     85 
     86 LOCAL_SRC_FILES_32 := $($(libunwind_module)_src_files_32)
     87 LOCAL_SRC_FILES_64 := $($(libunwind_module)_src_files_64)
     88 
     89 LOCAL_STATIC_LIBRARIES := \
     90     $($(libunwind_module)_static_libraries) \
     91     $($(libunwind_module)_static_libraries_$(libunwind_build_type)) \
     92 
     93 LOCAL_WHOLE_STATIC_LIBRARIES := \
     94     $($(libunwind_module)_whole_static_libraries) \
     95     $($(libunwind_module)_whole_static_libraries_$(libunwind_build_type)) \
     96 
     97 LOCAL_SHARED_LIBRARIES := \
     98     $($(libunwind_module)_shared_libraries) \
     99     $($(libunwind_module)_shared_libraries_$(libunwind_build_type)) \
    100 
    101 LOCAL_LDLIBS := \
    102     $($(libunwind_module)_ldlibs) \
    103     $($(libunwind_module)_ldlibs_$(libunwind_build_type)) \
    104 
    105 LOCAL_LDFLAGS := \
    106     $($(libunwind_module)_ldflags) \
    107     $($(libunwind_module)_ldflags_$(libunwind_build_type)) \
    108 
    109 # Translate arm64 to aarch64 in c includes and src files.
    110 LOCAL_C_INCLUDES_arm64 := \
    111     $(subst tdep-arm64,tdep-aarch64,$(LOCAL_C_INCLUDES_arm64))
    112 
    113 LOCAL_SRC_FILES_arm64 := \
    114     $(subst src/arm64,src/aarch64,$(LOCAL_SRC_FILES_arm64))
    115 
    116 LOCAL_SANITIZE := never
    117 
    118 ifeq ($(libunwind_build_type),target)
    119   include $(BUILD_$(libunwind_build_target))
    120 endif
    121 
    122 ifeq ($(libunwind_build_type),host)
    123   # Only build if host builds are supported.
    124   ifeq ($(libunwind_build_host),true)
    125     include $(BUILD_HOST_$(libunwind_build_target))
    126   endif
    127 endif
    128