blob: b875efdc64f58e1a2ce6a0ed4d44637e04f3b976 [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 \
60 libunwind-ptrace \
61
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080062libbacktrace_shared_libraries_host := \
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -070063 liblog \
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -070064
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080065libbacktrace_static_libraries_host := \
66 libcutils \
Christopher Ferrisf67c6412014-01-10 00:43:54 -080067
Christopher Ferris3cdbfdc2014-11-08 15:57:11 -080068libbacktrace_ldlibs_host := \
69 -lpthread \
70 -lrt \
71
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080072module := libbacktrace
73module_tag := optional
74build_type := target
75build_target := SHARED_LIBRARY
76include $(LOCAL_PATH)/Android.build.mk
77build_type := host
Dan Albert0d7164d2014-11-11 15:15:21 -080078libbacktrace_multilib := both
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080079include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -070080
Dan Albert40a46dd2014-05-19 10:10:37 -070081#-------------------------------------------------------------------------
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080082# The libbacktrace_test library needed by backtrace_test.
83#-------------------------------------------------------------------------
84libbacktrace_test_cflags := \
Christopher Ferris7fb22872013-09-27 12:43:15 -070085 -O0 \
86
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080087libbacktrace_test_src_files := \
88 backtrace_testlib.c \
Christopher Ferris17e91d42013-10-21 13:30:52 -070089
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080090module := libbacktrace_test
91module_tag := debug
92build_type := target
93build_target := SHARED_LIBRARY
Christopher Ferris2c43cff2015-03-26 19:18:36 -070094libbacktrace_test_multilib := both
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080095include $(LOCAL_PATH)/Android.build.mk
96build_type := host
97include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris7fb22872013-09-27 12:43:15 -070098
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080099#-------------------------------------------------------------------------
100# The backtrace_test executable.
101#-------------------------------------------------------------------------
102backtrace_test_cflags := \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700103 -fno-builtin \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700104 -O0 \
105 -g \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800106
107backtrace_test_cflags_target := \
Christopher Ferrise2960912014-03-07 19:42:19 -0800108 -DENABLE_PSS_TESTS \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800109
110backtrace_test_src_files := \
111 backtrace_test.cpp \
Christopher Ferrise2960912014-03-07 19:42:19 -0800112 GetPss.cpp \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800113 thread_utils.c \
114
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800115backtrace_test_ldlibs_host := \
Ying Wang9f437d72014-05-07 15:36:05 -0700116 -lpthread \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800117 -lrt \
118
119backtrace_test_shared_libraries := \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700120 libbacktrace_test \
121 libbacktrace \
122
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800123backtrace_test_shared_libraries_target := \
124 libcutils \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700125
Christopher Ferrisa2efd3a2014-05-06 15:23:59 -0700126backtrace_test_static_libraries_host := \
127 libcutils \
128
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800129module := backtrace_test
130module_tag := debug
131build_type := target
132build_target := NATIVE_TEST
Christopher Ferris2c43cff2015-03-26 19:18:36 -0700133backtrace_test_multilib := both
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800134include $(LOCAL_PATH)/Android.build.mk
135build_type := host
136include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris17e91d42013-10-21 13:30:52 -0700137
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800138#----------------------------------------------------------------------------
139# Special truncated libbacktrace library for mac.
140#----------------------------------------------------------------------------
141ifeq ($(HOST_OS),darwin)
Christopher Ferris7fb22872013-09-27 12:43:15 -0700142
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800143include $(CLEAR_VARS)
Christopher Ferrisf67c6412014-01-10 00:43:54 -0800144
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800145LOCAL_MODULE := libbacktrace
146LOCAL_MODULE_TAGS := optional
147
148LOCAL_SRC_FILES := \
149 BacktraceMap.cpp \
150
Dan Albert5570c9b2014-11-13 14:54:10 -0800151LOCAL_MULTILIB := both
152
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800153include $(BUILD_HOST_SHARED_LIBRARY)
154
155endif # HOST_OS-darwin