blob: be8b80379c56debfa3be8d3be6a24b3a44c56438 [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 \
28
Stephen Hines035e9ba2015-03-31 09:39:20 -070029# The latest clang (r230699) does not allow SP/PC to be declared in inline asm lists.
30libbacktrace_common_clang_cflags += \
31 -Wno-inline-asm
32
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080033build_host := false
34ifeq ($(HOST_OS),linux)
35ifeq ($(HOST_ARCH),$(filter $(HOST_ARCH),x86 x86_64))
36build_host := true
37endif
38endif
39
40#-------------------------------------------------------------------------
41# The libbacktrace library.
42#-------------------------------------------------------------------------
43libbacktrace_src_files := \
Christopher Ferris2c43cff2015-03-26 19:18:36 -070044 Backtrace.cpp \
45 BacktraceCurrent.cpp \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080046 BacktraceMap.cpp \
Christopher Ferris2c43cff2015-03-26 19:18:36 -070047 BacktracePtrace.cpp \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080048 thread_utils.c \
Christopher Ferris2c43cff2015-03-26 19:18:36 -070049 ThreadEntry.cpp \
Christopher Ferris17e91d42013-10-21 13:30:52 -070050 UnwindCurrent.cpp \
Christopher Ferrisdf290612014-01-22 19:21:07 -080051 UnwindMap.cpp \
Christopher Ferris17e91d42013-10-21 13:30:52 -070052 UnwindPtrace.cpp \
Christopher Ferris7fb22872013-09-27 12:43:15 -070053
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080054libbacktrace_shared_libraries := \
Christopher Ferris2c43cff2015-03-26 19:18:36 -070055 libbase \
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -070056 liblog \
Colin Crossdb134ca2015-04-28 17:49:42 -070057 libunwind \
Christopher Ferrisf67c6412014-01-10 00:43:54 -080058
Christopher Ferris3cdbfdc2014-11-08 15:57:11 -080059libbacktrace_ldlibs_host := \
60 -lpthread \
61 -lrt \
62
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
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -070071
Dan Albert40a46dd2014-05-19 10:10:37 -070072#-------------------------------------------------------------------------
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080073# The libbacktrace_test library needed by backtrace_test.
74#-------------------------------------------------------------------------
75libbacktrace_test_cflags := \
Christopher Ferris7fb22872013-09-27 12:43:15 -070076 -O0 \
77
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080078libbacktrace_test_src_files := \
79 backtrace_testlib.c \
Christopher Ferris17e91d42013-10-21 13:30:52 -070080
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080081module := libbacktrace_test
82module_tag := debug
83build_type := target
84build_target := SHARED_LIBRARY
Christopher Ferris2c43cff2015-03-26 19:18:36 -070085libbacktrace_test_multilib := both
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080086include $(LOCAL_PATH)/Android.build.mk
87build_type := host
88include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris7fb22872013-09-27 12:43:15 -070089
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080090#-------------------------------------------------------------------------
91# The backtrace_test executable.
92#-------------------------------------------------------------------------
93backtrace_test_cflags := \
Christopher Ferris17e91d42013-10-21 13:30:52 -070094 -fno-builtin \
Christopher Ferris17e91d42013-10-21 13:30:52 -070095 -O0 \
96 -g \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080097
98backtrace_test_cflags_target := \
Christopher Ferrise2960912014-03-07 19:42:19 -080099 -DENABLE_PSS_TESTS \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800100
101backtrace_test_src_files := \
102 backtrace_test.cpp \
Christopher Ferrise2960912014-03-07 19:42:19 -0800103 GetPss.cpp \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800104 thread_utils.c \
105
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800106backtrace_test_ldlibs_host := \
Ying Wang9f437d72014-05-07 15:36:05 -0700107 -lpthread \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800108 -lrt \
109
110backtrace_test_shared_libraries := \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700111 libbacktrace_test \
112 libbacktrace \
Christopher Ferris67aba682015-05-08 15:44:46 -0700113 libbase \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800114 libcutils \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700115
Christopher Ferris67aba682015-05-08 15:44:46 -0700116backtrace_test_shared_libraries_target += \
117 libdl \
118
119backtrace_test_ldlibs_host += \
120 -ldl \
Christopher Ferrisa2efd3a2014-05-06 15:23:59 -0700121
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800122module := backtrace_test
123module_tag := debug
124build_type := target
125build_target := NATIVE_TEST
Christopher Ferris2c43cff2015-03-26 19:18:36 -0700126backtrace_test_multilib := both
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800127include $(LOCAL_PATH)/Android.build.mk
128build_type := host
129include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris17e91d42013-10-21 13:30:52 -0700130
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800131#----------------------------------------------------------------------------
132# Special truncated libbacktrace library for mac.
133#----------------------------------------------------------------------------
134ifeq ($(HOST_OS),darwin)
Christopher Ferris7fb22872013-09-27 12:43:15 -0700135
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800136include $(CLEAR_VARS)
Christopher Ferrisf67c6412014-01-10 00:43:54 -0800137
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800138LOCAL_MODULE := libbacktrace
139LOCAL_MODULE_TAGS := optional
140
141LOCAL_SRC_FILES := \
142 BacktraceMap.cpp \
143
Dan Albert5570c9b2014-11-13 14:54:10 -0800144LOCAL_MULTILIB := both
145
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800146include $(BUILD_HOST_SHARED_LIBRARY)
147
148endif # HOST_OS-darwin