Home | History | Annotate | Download | only in libbacktrace
      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 LOCAL_PATH:= $(call my-dir)
     18 
     19 common_cflags := \
     20 	-Wall \
     21 	-Werror \
     22 
     23 common_conlyflags := \
     24 	-std=gnu99 \
     25 
     26 common_cppflags := \
     27 	-std=gnu++11 \
     28 
     29 build_host := false
     30 ifeq ($(HOST_OS),linux)
     31 ifeq ($(HOST_ARCH),$(filter $(HOST_ARCH),x86 x86_64))
     32 build_host := true
     33 endif
     34 endif
     35 
     36 #-------------------------------------------------------------------------
     37 # The libbacktrace library.
     38 #-------------------------------------------------------------------------
     39 libbacktrace_src_files := \
     40 	BacktraceImpl.cpp \
     41 	BacktraceMap.cpp \
     42 	BacktraceThread.cpp \
     43 	thread_utils.c \
     44 
     45 libbacktrace_shared_libraries_target := \
     46 	libcutils \
     47 	libgccdemangle \
     48 
     49 libbacktrace_src_files += \
     50 	UnwindCurrent.cpp \
     51 	UnwindMap.cpp \
     52 	UnwindPtrace.cpp \
     53 
     54 libbacktrace_c_includes := \
     55 	external/libunwind/include \
     56 
     57 libbacktrace_shared_libraries := \
     58 	libunwind \
     59 	libunwind-ptrace \
     60 
     61 libbacktrace_shared_libraries_host := \
     62 	liblog \
     63 
     64 libbacktrace_static_libraries_host := \
     65 	libcutils \
     66 
     67 module := libbacktrace
     68 module_tag := optional
     69 build_type := target
     70 build_target := SHARED_LIBRARY
     71 include $(LOCAL_PATH)/Android.build.mk
     72 build_type := host
     73 include $(LOCAL_PATH)/Android.build.mk
     74 
     75 # Don't build for unbundled branches
     76 ifeq (,$(TARGET_BUILD_APPS))
     77 #-------------------------------------------------------------------------
     78 # The libbacktrace library (libc++)
     79 #-------------------------------------------------------------------------
     80 libbacktrace_libc++_src_files := \
     81 	BacktraceImpl.cpp \
     82 	BacktraceMap.cpp \
     83 	BacktraceThread.cpp \
     84 	thread_utils.c \
     85 
     86 libbacktrace_libc++_shared_libraries_target := \
     87 	libcutils \
     88 	libgccdemangle \
     89 
     90 libbacktrace_libc++_src_files += \
     91 	UnwindCurrent.cpp \
     92 	UnwindMap.cpp \
     93 	UnwindPtrace.cpp \
     94 
     95 libbacktrace_libc++_c_includes := \
     96 	external/libunwind/include \
     97 
     98 libbacktrace_libc++_shared_libraries := \
     99 	libunwind \
    100 	libunwind-ptrace \
    101 
    102 libbacktrace_libc++_shared_libraries_host := \
    103 	liblog \
    104 
    105 libbacktrace_libc++_static_libraries_host := \
    106 	libcutils \
    107 
    108 libbacktrace_libc++_libc++ := true
    109 
    110 module := libbacktrace_libc++
    111 module_tag := optional
    112 build_type := target
    113 build_target := SHARED_LIBRARY
    114 include $(LOCAL_PATH)/Android.build.mk
    115 build_type := host
    116 libbacktrace_libc++_multilib := both
    117 include $(LOCAL_PATH)/Android.build.mk
    118 libbacktrace_libc++_multilib :=
    119 endif
    120 
    121 #-------------------------------------------------------------------------
    122 # The libbacktrace_test library needed by backtrace_test.
    123 #-------------------------------------------------------------------------
    124 libbacktrace_test_cflags := \
    125 	-O0 \
    126 
    127 libbacktrace_test_src_files := \
    128 	backtrace_testlib.c \
    129 
    130 module := libbacktrace_test
    131 module_tag := debug
    132 build_type := target
    133 build_target := SHARED_LIBRARY
    134 include $(LOCAL_PATH)/Android.build.mk
    135 build_type := host
    136 include $(LOCAL_PATH)/Android.build.mk
    137 
    138 #-------------------------------------------------------------------------
    139 # The backtrace_test executable.
    140 #-------------------------------------------------------------------------
    141 backtrace_test_cflags := \
    142 	-fno-builtin \
    143 	-O0 \
    144 	-g \
    145 
    146 backtrace_test_cflags_target := \
    147 	-DENABLE_PSS_TESTS \
    148 
    149 backtrace_test_src_files := \
    150 	backtrace_test.cpp \
    151 	GetPss.cpp \
    152 	thread_utils.c \
    153 
    154 backtrace_test_ldlibs_host := \
    155 	-lpthread \
    156 	-lrt \
    157 
    158 backtrace_test_shared_libraries := \
    159 	libbacktrace_test \
    160 	libbacktrace \
    161 
    162 backtrace_test_shared_libraries_target := \
    163 	libcutils \
    164 
    165 backtrace_test_static_libraries_host := \
    166 	libcutils \
    167 
    168 module := backtrace_test
    169 module_tag := debug
    170 build_type := target
    171 build_target := NATIVE_TEST
    172 include $(LOCAL_PATH)/Android.build.mk
    173 build_type := host
    174 include $(LOCAL_PATH)/Android.build.mk
    175 
    176 #----------------------------------------------------------------------------
    177 # Special truncated libbacktrace library for mac.
    178 #----------------------------------------------------------------------------
    179 ifeq ($(HOST_OS),darwin)
    180 
    181 include $(CLEAR_VARS)
    182 
    183 LOCAL_MODULE := libbacktrace
    184 LOCAL_MODULE_TAGS := optional
    185 
    186 LOCAL_SRC_FILES := \
    187 	BacktraceMap.cpp \
    188 
    189 include $(BUILD_HOST_SHARED_LIBRARY)
    190 
    191 # Don't build for unbundled branches
    192 ifeq (,$(TARGET_BUILD_APPS))
    193 #-------------------------------------------------------------------------
    194 # The libbacktrace library (libc++)
    195 #-------------------------------------------------------------------------
    196 include $(CLEAR_VARS)
    197 
    198 LOCAL_MODULE := libbacktrace_libc++
    199 LOCAL_MODULE_TAGS := optional
    200 
    201 LOCAL_SRC_FILES := \
    202 	BacktraceMap.cpp \
    203 
    204 LOCAL_MULTILIB := both
    205 
    206 include $(BUILD_HOST_SHARED_LIBRARY)
    207 
    208 endif # TARGET_BUILD_APPS
    209 
    210 endif # HOST_OS-darwin
    211