blob: ee25e08f1f750fdb9810a1ee9bce26c2897f6905 [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 \
Yabin Cui9e402bb2015-09-22 04:46:57 +000028 -I external/libunwind/include/tdep \
Christopher Ferris17e91d42013-10-21 13:30:52 -070029
Stephen Hines035e9ba2015-03-31 09:39:20 -070030# The latest clang (r230699) does not allow SP/PC to be declared in inline asm lists.
31libbacktrace_common_clang_cflags += \
32 -Wno-inline-asm
33
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080034build_host := false
35ifeq ($(HOST_OS),linux)
36ifeq ($(HOST_ARCH),$(filter $(HOST_ARCH),x86 x86_64))
37build_host := true
38endif
39endif
40
Yabin Cui9e402bb2015-09-22 04:46:57 +000041LLVM_ROOT_PATH := external/llvm
42include $(LLVM_ROOT_PATH)/llvm.mk
43
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080044#-------------------------------------------------------------------------
45# The libbacktrace library.
46#-------------------------------------------------------------------------
47libbacktrace_src_files := \
Christopher Ferris2c43cff2015-03-26 19:18:36 -070048 Backtrace.cpp \
49 BacktraceCurrent.cpp \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080050 BacktraceMap.cpp \
Christopher Ferris2c43cff2015-03-26 19:18:36 -070051 BacktracePtrace.cpp \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080052 thread_utils.c \
Christopher Ferris2c43cff2015-03-26 19:18:36 -070053 ThreadEntry.cpp \
Christopher Ferris17e91d42013-10-21 13:30:52 -070054 UnwindCurrent.cpp \
Christopher Ferrisdf290612014-01-22 19:21:07 -080055 UnwindMap.cpp \
Christopher Ferris17e91d42013-10-21 13:30:52 -070056 UnwindPtrace.cpp \
Christopher Ferris7fb22872013-09-27 12:43:15 -070057
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080058libbacktrace_shared_libraries := \
Christopher Ferris2c43cff2015-03-26 19:18:36 -070059 libbase \
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -070060 liblog \
Colin Crossdb134ca2015-04-28 17:49:42 -070061 libunwind \
Christopher Ferrisf67c6412014-01-10 00:43:54 -080062
Than McIntosh1e0fea22016-02-01 10:17:45 -050063libbacktrace_static_libraries := \
64 libcutils
65
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080066module := libbacktrace
67module_tag := optional
68build_type := target
69build_target := SHARED_LIBRARY
70include $(LOCAL_PATH)/Android.build.mk
71build_type := host
Dan Albert0d7164d2014-11-11 15:15:21 -080072libbacktrace_multilib := both
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080073include $(LOCAL_PATH)/Android.build.mk
Calin Juravle28042b52015-06-08 14:30:52 +010074libbacktrace_static_libraries := \
75 libbase \
76 liblog \
77 libunwind \
78
79build_target := STATIC_LIBRARY
80include $(LOCAL_PATH)/Android.build.mk
81libbacktrace_static_libraries :=
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -070082
Dan Albert40a46dd2014-05-19 10:10:37 -070083#-------------------------------------------------------------------------
Christopher Ferris85402162016-01-25 16:17:48 -080084# The libbacktrace_offline shared library.
85#-------------------------------------------------------------------------
86libbacktrace_offline_src_files := \
87 BacktraceOffline.cpp \
88
Yabin Cui02092b32016-03-18 18:46:08 -070089# Use shared llvm library on device to save space.
Yabin Cui578bc032016-04-13 21:21:47 -070090libbacktrace_offline_shared_libraries_target := \
Christopher Ferris85402162016-01-25 16:17:48 -080091 libbacktrace \
Yabin Cui02092b32016-03-18 18:46:08 -070092 libbase \
Christopher Ferris85402162016-01-25 16:17:48 -080093 liblog \
94 libunwind \
Yabin Cui02092b32016-03-18 18:46:08 -070095 libutils \
Christopher Ferris85402162016-01-25 16:17:48 -080096 libLLVM \
97
Yabin Cui578bc032016-04-13 21:21:47 -070098libbacktrace_offline_static_libraries_target := \
Yabin Cui02092b32016-03-18 18:46:08 -070099 libziparchive \
100 libz \
101
Christopher Ferris85402162016-01-25 16:17:48 -0800102# Use static llvm libraries on host to remove dependency on 32-bit llvm shared library
103# which is not included in the prebuilt.
Yabin Cui578bc032016-04-13 21:21:47 -0700104libbacktrace_offline_static_libraries_host := \
105 libbacktrace \
106 libunwind \
107 libziparchive-host \
108 libz \
109 libbase \
110 liblog \
111 libutils \
Christopher Ferris85402162016-01-25 16:17:48 -0800112 libLLVMObject \
113 libLLVMBitReader \
114 libLLVMMC \
115 libLLVMMCParser \
116 libLLVMCore \
117 libLLVMSupport \
118
119module := libbacktrace_offline
Yabin Cui578bc032016-04-13 21:21:47 -0700120build_type := target
121build_target := STATIC_LIBRARY
122libbacktrace_offline_multilib := both
123include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris85402162016-01-25 16:17:48 -0800124build_type := host
Christopher Ferris85402162016-01-25 16:17:48 -0800125include $(LOCAL_PATH)/Android.build.mk
126
127#-------------------------------------------------------------------------
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800128# The libbacktrace_test library needed by backtrace_test.
129#-------------------------------------------------------------------------
130libbacktrace_test_cflags := \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700131 -O0 \
132
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800133libbacktrace_test_src_files := \
134 backtrace_testlib.c \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700135
Yabin Cui9e402bb2015-09-22 04:46:57 +0000136libbacktrace_test_strip_module := false
137
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800138module := libbacktrace_test
139module_tag := debug
140build_type := target
141build_target := SHARED_LIBRARY
Christopher Ferris2c43cff2015-03-26 19:18:36 -0700142libbacktrace_test_multilib := both
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800143include $(LOCAL_PATH)/Android.build.mk
144build_type := host
145include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris7fb22872013-09-27 12:43:15 -0700146
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800147#-------------------------------------------------------------------------
148# The backtrace_test executable.
149#-------------------------------------------------------------------------
150backtrace_test_cflags := \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700151 -fno-builtin \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700152 -O0 \
153 -g \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800154
155backtrace_test_cflags_target := \
Christopher Ferrise2960912014-03-07 19:42:19 -0800156 -DENABLE_PSS_TESTS \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800157
158backtrace_test_src_files := \
Yabin Cui9e402bb2015-09-22 04:46:57 +0000159 backtrace_offline_test.cpp \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800160 backtrace_test.cpp \
Christopher Ferrise2960912014-03-07 19:42:19 -0800161 GetPss.cpp \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800162 thread_utils.c \
163
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800164backtrace_test_ldlibs_host := \
Ying Wang9f437d72014-05-07 15:36:05 -0700165 -lpthread \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800166 -lrt \
167
168backtrace_test_shared_libraries := \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700169 libbacktrace_test \
170 libbacktrace \
Christopher Ferris67aba682015-05-08 15:44:46 -0700171 libbase \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800172 libcutils \
Yabin Cui578bc032016-04-13 21:21:47 -0700173 liblog \
Yabin Cui9e402bb2015-09-22 04:46:57 +0000174 libunwind \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700175
Christopher Ferris67aba682015-05-08 15:44:46 -0700176backtrace_test_shared_libraries_target += \
177 libdl \
Yabin Cui578bc032016-04-13 21:21:47 -0700178 libutils \
179 libLLVM \
180
181backtrace_test_static_libraries := \
182 libbacktrace_offline \
183
184backtrace_test_static_libraries_target := \
185 libziparchive \
186 libz \
187
188backtrace_test_static_libraries_host := \
189 libziparchive-host \
190 libz \
191 libutils \
192 libLLVMObject \
193 libLLVMBitReader \
194 libLLVMMC \
195 libLLVMMCParser \
196 libLLVMCore \
197 libLLVMSupport \
Christopher Ferris67aba682015-05-08 15:44:46 -0700198
199backtrace_test_ldlibs_host += \
200 -ldl \
Christopher Ferrisa2efd3a2014-05-06 15:23:59 -0700201
Yabin Cui9e402bb2015-09-22 04:46:57 +0000202backtrace_test_strip_module := false
203
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800204module := backtrace_test
205module_tag := debug
206build_type := target
207build_target := NATIVE_TEST
Christopher Ferris2c43cff2015-03-26 19:18:36 -0700208backtrace_test_multilib := both
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800209include $(LOCAL_PATH)/Android.build.mk
210build_type := host
211include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris17e91d42013-10-21 13:30:52 -0700212
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800213#----------------------------------------------------------------------------
214# Special truncated libbacktrace library for mac.
215#----------------------------------------------------------------------------
216ifeq ($(HOST_OS),darwin)
Christopher Ferris7fb22872013-09-27 12:43:15 -0700217
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800218include $(CLEAR_VARS)
Christopher Ferrisf67c6412014-01-10 00:43:54 -0800219
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800220LOCAL_MODULE := libbacktrace
221LOCAL_MODULE_TAGS := optional
222
223LOCAL_SRC_FILES := \
224 BacktraceMap.cpp \
225
Dan Albert5570c9b2014-11-13 14:54:10 -0800226LOCAL_MULTILIB := both
227
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800228include $(BUILD_HOST_SHARED_LIBRARY)
229
230endif # HOST_OS-darwin