blob: 6cffb1139935b14251c901d96f6bd1743d5e47d7 [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
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080063module := libbacktrace
64module_tag := optional
65build_type := target
66build_target := SHARED_LIBRARY
67include $(LOCAL_PATH)/Android.build.mk
68build_type := host
Dan Albert0d7164d2014-11-11 15:15:21 -080069libbacktrace_multilib := both
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080070include $(LOCAL_PATH)/Android.build.mk
Calin Juravle28042b52015-06-08 14:30:52 +010071libbacktrace_static_libraries := \
72 libbase \
73 liblog \
74 libunwind \
75
76build_target := STATIC_LIBRARY
77include $(LOCAL_PATH)/Android.build.mk
78libbacktrace_static_libraries :=
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -070079
Dan Albert40a46dd2014-05-19 10:10:37 -070080#-------------------------------------------------------------------------
Christopher Ferris85402162016-01-25 16:17:48 -080081# The libbacktrace_offline shared library.
82#-------------------------------------------------------------------------
83libbacktrace_offline_src_files := \
84 BacktraceOffline.cpp \
85
86libbacktrace_offline_shared_libraries := \
87 libbacktrace \
88 liblog \
89 libunwind \
90
91# Use shared llvm library on device to save space.
92libbacktrace_offline_shared_libraries_target := \
93 libLLVM \
94
95# Use static llvm libraries on host to remove dependency on 32-bit llvm shared library
96# which is not included in the prebuilt.
97libbacktrace_offline_static_libraries_host := \
98 libLLVMObject \
99 libLLVMBitReader \
100 libLLVMMC \
101 libLLVMMCParser \
102 libLLVMCore \
103 libLLVMSupport \
104
105module := libbacktrace_offline
106module_tag := optional
107build_type := target
108build_target := SHARED_LIBRARY
109include $(LOCAL_PATH)/Android.build.mk
110build_type := host
111libbacktrace_multilib := both
112include $(LOCAL_PATH)/Android.build.mk
113
114#-------------------------------------------------------------------------
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800115# The libbacktrace_test library needed by backtrace_test.
116#-------------------------------------------------------------------------
117libbacktrace_test_cflags := \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700118 -O0 \
119
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800120libbacktrace_test_src_files := \
121 backtrace_testlib.c \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700122
Yabin Cui9e402bb2015-09-22 04:46:57 +0000123libbacktrace_test_strip_module := false
124
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800125module := libbacktrace_test
126module_tag := debug
127build_type := target
128build_target := SHARED_LIBRARY
Christopher Ferris2c43cff2015-03-26 19:18:36 -0700129libbacktrace_test_multilib := both
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800130include $(LOCAL_PATH)/Android.build.mk
131build_type := host
132include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris7fb22872013-09-27 12:43:15 -0700133
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800134#-------------------------------------------------------------------------
135# The backtrace_test executable.
136#-------------------------------------------------------------------------
137backtrace_test_cflags := \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700138 -fno-builtin \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700139 -O0 \
140 -g \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800141
142backtrace_test_cflags_target := \
Christopher Ferrise2960912014-03-07 19:42:19 -0800143 -DENABLE_PSS_TESTS \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800144
145backtrace_test_src_files := \
Yabin Cui9e402bb2015-09-22 04:46:57 +0000146 backtrace_offline_test.cpp \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800147 backtrace_test.cpp \
Christopher Ferrise2960912014-03-07 19:42:19 -0800148 GetPss.cpp \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800149 thread_utils.c \
150
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800151backtrace_test_ldlibs_host := \
Ying Wang9f437d72014-05-07 15:36:05 -0700152 -lpthread \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800153 -lrt \
154
155backtrace_test_shared_libraries := \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700156 libbacktrace_test \
157 libbacktrace \
Christopher Ferris85402162016-01-25 16:17:48 -0800158 libbacktrace_offline \
Christopher Ferris67aba682015-05-08 15:44:46 -0700159 libbase \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800160 libcutils \
Yabin Cui9e402bb2015-09-22 04:46:57 +0000161 libunwind \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700162
Christopher Ferris67aba682015-05-08 15:44:46 -0700163backtrace_test_shared_libraries_target += \
164 libdl \
165
166backtrace_test_ldlibs_host += \
167 -ldl \
Christopher Ferrisa2efd3a2014-05-06 15:23:59 -0700168
Yabin Cui9e402bb2015-09-22 04:46:57 +0000169backtrace_test_strip_module := false
170
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800171module := backtrace_test
172module_tag := debug
173build_type := target
174build_target := NATIVE_TEST
Christopher Ferris2c43cff2015-03-26 19:18:36 -0700175backtrace_test_multilib := both
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800176include $(LOCAL_PATH)/Android.build.mk
177build_type := host
178include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris17e91d42013-10-21 13:30:52 -0700179
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800180#----------------------------------------------------------------------------
181# Special truncated libbacktrace library for mac.
182#----------------------------------------------------------------------------
183ifeq ($(HOST_OS),darwin)
Christopher Ferris7fb22872013-09-27 12:43:15 -0700184
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800185include $(CLEAR_VARS)
Christopher Ferrisf67c6412014-01-10 00:43:54 -0800186
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800187LOCAL_MODULE := libbacktrace
188LOCAL_MODULE_TAGS := optional
189
190LOCAL_SRC_FILES := \
191 BacktraceMap.cpp \
192
Dan Albert5570c9b2014-11-13 14:54:10 -0800193LOCAL_MULTILIB := both
194
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800195include $(BUILD_HOST_SHARED_LIBRARY)
196
197endif # HOST_OS-darwin