blob: 356ab8bccf6a3a48538a74ef320cf5d7013d401d [file] [log] [blame]
Christopher Ferris04b1e8c2014-01-30 01:13:33 -08001#
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#
Christopher Ferris7fb22872013-09-27 12:43:15 -070016
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080017LOCAL_PATH:= $(call my-dir)
Christopher Ferris17e91d42013-10-21 13:30:52 -070018
Christopher Ferris2c43cff2015-03-26 19:18:36 -070019libbacktrace_common_cflags := \
Christopher Ferris17e91d42013-10-21 13:30:52 -070020 -Wall \
Christopher Ferris17e91d42013-10-21 13:30:52 -070021 -Werror \
22
Christopher Ferris2c43cff2015-03-26 19:18:36 -070023libbacktrace_common_conlyflags := \
Christopher Ferris17e91d42013-10-21 13:30:52 -070024 -std=gnu99 \
25
Christopher Ferris2c43cff2015-03-26 19:18:36 -070026libbacktrace_common_cppflags := \
Christopher Ferris17e91d42013-10-21 13:30:52 -070027 -std=gnu++11 \
Dan Willemsenee2da032016-05-25 13:19:49 -070028
29libbacktrace_common_c_includes := \
30 external/libunwind/include/tdep \
Christopher Ferris17e91d42013-10-21 13:30:52 -070031
Stephen Hines035e9ba2015-03-31 09:39:20 -070032# The latest clang (r230699) does not allow SP/PC to be declared in inline asm lists.
33libbacktrace_common_clang_cflags += \
34 -Wno-inline-asm
35
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080036build_host := false
37ifeq ($(HOST_OS),linux)
38ifeq ($(HOST_ARCH),$(filter $(HOST_ARCH),x86 x86_64))
39build_host := true
40endif
41endif
42
Yabin Cui9e402bb2015-09-22 04:46:57 +000043LLVM_ROOT_PATH := external/llvm
44include $(LLVM_ROOT_PATH)/llvm.mk
45
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080046#-------------------------------------------------------------------------
47# The libbacktrace library.
48#-------------------------------------------------------------------------
49libbacktrace_src_files := \
Christopher Ferris2c43cff2015-03-26 19:18:36 -070050 Backtrace.cpp \
51 BacktraceCurrent.cpp \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080052 BacktraceMap.cpp \
Christopher Ferris2c43cff2015-03-26 19:18:36 -070053 BacktracePtrace.cpp \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080054 thread_utils.c \
Christopher Ferris2c43cff2015-03-26 19:18:36 -070055 ThreadEntry.cpp \
Christopher Ferris17e91d42013-10-21 13:30:52 -070056 UnwindCurrent.cpp \
Christopher Ferrisdf290612014-01-22 19:21:07 -080057 UnwindMap.cpp \
Christopher Ferris17e91d42013-10-21 13:30:52 -070058 UnwindPtrace.cpp \
Christopher Ferris7fb22872013-09-27 12:43:15 -070059
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080060libbacktrace_shared_libraries := \
Christopher Ferris2c43cff2015-03-26 19:18:36 -070061 libbase \
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -070062 liblog \
Colin Crossdb134ca2015-04-28 17:49:42 -070063 libunwind \
Christopher Ferrisf67c6412014-01-10 00:43:54 -080064
Than McIntosh1e0fea22016-02-01 10:17:45 -050065libbacktrace_static_libraries := \
66 libcutils
67
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080068module := libbacktrace
69module_tag := optional
70build_type := target
71build_target := SHARED_LIBRARY
72include $(LOCAL_PATH)/Android.build.mk
73build_type := host
Dan Albert0d7164d2014-11-11 15:15:21 -080074libbacktrace_multilib := both
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080075include $(LOCAL_PATH)/Android.build.mk
Yabin Cui9946a8f2016-02-10 13:46:06 -080076
77libbacktrace_shared_libraries :=
78
Calin Juravle28042b52015-06-08 14:30:52 +010079libbacktrace_static_libraries := \
80 libbase \
81 liblog \
82 libunwind \
Yabin Cui9946a8f2016-02-10 13:46:06 -080083 liblzma \
Calin Juravle28042b52015-06-08 14:30:52 +010084
Yabin Cui9946a8f2016-02-10 13:46:06 -080085module := libbacktrace
86build_type := target
Calin Juravle28042b52015-06-08 14:30:52 +010087build_target := STATIC_LIBRARY
88include $(LOCAL_PATH)/Android.build.mk
Yabin Cui9946a8f2016-02-10 13:46:06 -080089build_type := host
90libbacktrace_multilib := both
91include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -070092
Dan Albert40a46dd2014-05-19 10:10:37 -070093#-------------------------------------------------------------------------
Christopher Ferris85402162016-01-25 16:17:48 -080094# The libbacktrace_offline shared library.
95#-------------------------------------------------------------------------
96libbacktrace_offline_src_files := \
97 BacktraceOffline.cpp \
98
Yabin Cuib791a762016-03-18 18:46:08 -070099# Use shared llvm library on device to save space.
Yabin Cui51e60702016-04-13 21:21:47 -0700100libbacktrace_offline_shared_libraries_target := \
Christopher Ferris85402162016-01-25 16:17:48 -0800101 libbacktrace \
Yabin Cuib791a762016-03-18 18:46:08 -0700102 libbase \
Christopher Ferris85402162016-01-25 16:17:48 -0800103 liblog \
104 libunwind \
Yabin Cuib791a762016-03-18 18:46:08 -0700105 libutils \
Christopher Ferris85402162016-01-25 16:17:48 -0800106 libLLVM \
107
Yabin Cui51e60702016-04-13 21:21:47 -0700108libbacktrace_offline_static_libraries_target := \
Yabin Cuib791a762016-03-18 18:46:08 -0700109 libziparchive \
110 libz \
111
Christopher Ferris85402162016-01-25 16:17:48 -0800112# Use static llvm libraries on host to remove dependency on 32-bit llvm shared library
113# which is not included in the prebuilt.
Yabin Cui51e60702016-04-13 21:21:47 -0700114libbacktrace_offline_static_libraries_host := \
Yabin Cui9946a8f2016-02-10 13:46:06 -0800115 libbacktrace \
Yabin Cui9946a8f2016-02-10 13:46:06 -0800116 libunwind \
Yabin Cui51e60702016-04-13 21:21:47 -0700117 libziparchive-host \
Yabin Cuib791a762016-03-18 18:46:08 -0700118 libz \
Yabin Cui51e60702016-04-13 21:21:47 -0700119 libbase \
120 liblog \
121 libutils \
Yabin Cui9946a8f2016-02-10 13:46:06 -0800122 libLLVMObject \
123 libLLVMBitReader \
124 libLLVMMC \
125 libLLVMMCParser \
126 libLLVMCore \
127 libLLVMSupport \
128
129module := libbacktrace_offline
130build_type := target
131build_target := STATIC_LIBRARY
Yabin Cui51e60702016-04-13 21:21:47 -0700132libbacktrace_offline_multilib := both
133include $(LOCAL_PATH)/Android.build.mk
134build_type := host
Yabin Cui9946a8f2016-02-10 13:46:06 -0800135include $(LOCAL_PATH)/Android.build.mk
136
Christopher Ferris85402162016-01-25 16:17:48 -0800137#-------------------------------------------------------------------------
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800138# The libbacktrace_test library needed by backtrace_test.
139#-------------------------------------------------------------------------
140libbacktrace_test_cflags := \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700141 -O0 \
142
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800143libbacktrace_test_src_files := \
144 backtrace_testlib.c \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700145
Yabin Cui9e402bb2015-09-22 04:46:57 +0000146libbacktrace_test_strip_module := false
147
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800148module := libbacktrace_test
149module_tag := debug
150build_type := target
151build_target := SHARED_LIBRARY
Christopher Ferris2c43cff2015-03-26 19:18:36 -0700152libbacktrace_test_multilib := both
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800153include $(LOCAL_PATH)/Android.build.mk
154build_type := host
155include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris7fb22872013-09-27 12:43:15 -0700156
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800157#-------------------------------------------------------------------------
158# The backtrace_test executable.
159#-------------------------------------------------------------------------
160backtrace_test_cflags := \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700161 -fno-builtin \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700162 -O0 \
163 -g \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800164
165backtrace_test_cflags_target := \
Christopher Ferrise2960912014-03-07 19:42:19 -0800166 -DENABLE_PSS_TESTS \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800167
168backtrace_test_src_files := \
Yabin Cui9e402bb2015-09-22 04:46:57 +0000169 backtrace_offline_test.cpp \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800170 backtrace_test.cpp \
Christopher Ferrise2960912014-03-07 19:42:19 -0800171 GetPss.cpp \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800172 thread_utils.c \
173
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800174backtrace_test_ldlibs_host := \
Ying Wang9f437d72014-05-07 15:36:05 -0700175 -lpthread \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800176 -lrt \
177
178backtrace_test_shared_libraries := \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700179 libbacktrace_test \
180 libbacktrace \
Christopher Ferris67aba682015-05-08 15:44:46 -0700181 libbase \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800182 libcutils \
Yabin Cui51e60702016-04-13 21:21:47 -0700183 liblog \
Yabin Cui9e402bb2015-09-22 04:46:57 +0000184 libunwind \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700185
Christopher Ferris67aba682015-05-08 15:44:46 -0700186backtrace_test_shared_libraries_target += \
187 libdl \
Yabin Cui51e60702016-04-13 21:21:47 -0700188 libutils \
189 libLLVM \
190
191backtrace_test_static_libraries := \
192 libbacktrace_offline \
193
194backtrace_test_static_libraries_target := \
195 libziparchive \
196 libz \
197
198backtrace_test_static_libraries_host := \
199 libziparchive-host \
200 libz \
201 libutils \
202 libLLVMObject \
203 libLLVMBitReader \
204 libLLVMMC \
205 libLLVMMCParser \
206 libLLVMCore \
207 libLLVMSupport \
Christopher Ferris67aba682015-05-08 15:44:46 -0700208
209backtrace_test_ldlibs_host += \
210 -ldl \
Christopher Ferrisa2efd3a2014-05-06 15:23:59 -0700211
Yabin Cui9e402bb2015-09-22 04:46:57 +0000212backtrace_test_strip_module := false
213
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800214module := backtrace_test
215module_tag := debug
216build_type := target
217build_target := NATIVE_TEST
Christopher Ferris2c43cff2015-03-26 19:18:36 -0700218backtrace_test_multilib := both
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800219include $(LOCAL_PATH)/Android.build.mk
220build_type := host
221include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris17e91d42013-10-21 13:30:52 -0700222
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800223#----------------------------------------------------------------------------
224# Special truncated libbacktrace library for mac.
225#----------------------------------------------------------------------------
226ifeq ($(HOST_OS),darwin)
Christopher Ferris7fb22872013-09-27 12:43:15 -0700227
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800228include $(CLEAR_VARS)
Christopher Ferrisf67c6412014-01-10 00:43:54 -0800229
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800230LOCAL_MODULE := libbacktrace
231LOCAL_MODULE_TAGS := optional
232
233LOCAL_SRC_FILES := \
234 BacktraceMap.cpp \
235
Dan Albert5570c9b2014-11-13 14:54:10 -0800236LOCAL_MULTILIB := both
237
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800238include $(BUILD_HOST_SHARED_LIBRARY)
239
240endif # HOST_OS-darwin