blob: 6a689a61d8d88c5e785e826b45923f186b220371 [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 Ferris2c43cff2015-03-26 19:18:36 -070054libbacktrace_shared_libraries_target := \
55 libcutils \
56
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080057libbacktrace_shared_libraries := \
Christopher Ferris2c43cff2015-03-26 19:18:36 -070058 libbase \
Christopher Ferris17e91d42013-10-21 13:30:52 -070059 libunwind \
Christopher Ferris17e91d42013-10-21 13:30:52 -070060
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080061libbacktrace_shared_libraries_host := \
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -070062 liblog \
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -070063
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080064libbacktrace_static_libraries_host := \
65 libcutils \
Christopher Ferrisf67c6412014-01-10 00:43:54 -080066
Christopher Ferris3cdbfdc2014-11-08 15:57:11 -080067libbacktrace_ldlibs_host := \
68 -lpthread \
69 -lrt \
70
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080071module := libbacktrace
72module_tag := optional
73build_type := target
74build_target := SHARED_LIBRARY
75include $(LOCAL_PATH)/Android.build.mk
76build_type := host
Dan Albert0d7164d2014-11-11 15:15:21 -080077libbacktrace_multilib := both
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080078include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -070079
Dan Albert40a46dd2014-05-19 10:10:37 -070080#-------------------------------------------------------------------------
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080081# The libbacktrace_test library needed by backtrace_test.
82#-------------------------------------------------------------------------
83libbacktrace_test_cflags := \
Christopher Ferris7fb22872013-09-27 12:43:15 -070084 -O0 \
85
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080086libbacktrace_test_src_files := \
87 backtrace_testlib.c \
Christopher Ferris17e91d42013-10-21 13:30:52 -070088
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080089module := libbacktrace_test
90module_tag := debug
91build_type := target
92build_target := SHARED_LIBRARY
Christopher Ferris2c43cff2015-03-26 19:18:36 -070093libbacktrace_test_multilib := both
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080094include $(LOCAL_PATH)/Android.build.mk
95build_type := host
96include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris7fb22872013-09-27 12:43:15 -070097
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080098#-------------------------------------------------------------------------
99# The backtrace_test executable.
100#-------------------------------------------------------------------------
101backtrace_test_cflags := \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700102 -fno-builtin \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700103 -O0 \
104 -g \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800105
106backtrace_test_cflags_target := \
Christopher Ferrise2960912014-03-07 19:42:19 -0800107 -DENABLE_PSS_TESTS \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800108
109backtrace_test_src_files := \
110 backtrace_test.cpp \
Christopher Ferrise2960912014-03-07 19:42:19 -0800111 GetPss.cpp \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800112 thread_utils.c \
113
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800114backtrace_test_ldlibs_host := \
Ying Wang9f437d72014-05-07 15:36:05 -0700115 -lpthread \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800116 -lrt \
117
118backtrace_test_shared_libraries := \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700119 libbacktrace_test \
120 libbacktrace \
Christopher Ferris684fb772015-05-08 15:44:46 -0700121 libbase \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800122 libcutils \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700123
Christopher Ferris684fb772015-05-08 15:44:46 -0700124backtrace_test_shared_libraries_target += \
125 libdl \
126
127backtrace_test_ldlibs_host += \
128 -ldl \
Christopher Ferrisa2efd3a2014-05-06 15:23:59 -0700129
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800130module := backtrace_test
131module_tag := debug
132build_type := target
133build_target := NATIVE_TEST
Christopher Ferris2c43cff2015-03-26 19:18:36 -0700134backtrace_test_multilib := both
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800135include $(LOCAL_PATH)/Android.build.mk
136build_type := host
137include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris17e91d42013-10-21 13:30:52 -0700138
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800139#----------------------------------------------------------------------------
140# Special truncated libbacktrace library for mac.
141#----------------------------------------------------------------------------
142ifeq ($(HOST_OS),darwin)
Christopher Ferris7fb22872013-09-27 12:43:15 -0700143
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800144include $(CLEAR_VARS)
Christopher Ferrisf67c6412014-01-10 00:43:54 -0800145
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800146LOCAL_MODULE := libbacktrace
147LOCAL_MODULE_TAGS := optional
148
149LOCAL_SRC_FILES := \
150 BacktraceMap.cpp \
151
Dan Albert5570c9b2014-11-13 14:54:10 -0800152LOCAL_MULTILIB := both
153
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800154include $(BUILD_HOST_SHARED_LIBRARY)
155
156endif # HOST_OS-darwin