blob: f72d6670d77062b013f7da4928e899e2ce659dfc [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
19common_cflags := \
20 -Wall \
Christopher Ferris17e91d42013-10-21 13:30:52 -070021 -Werror \
22
23common_conlyflags := \
24 -std=gnu99 \
25
26common_cppflags := \
27 -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 := \
44 BacktraceImpl.cpp \
45 BacktraceMap.cpp \
46 BacktraceThread.cpp \
47 thread_utils.c \
48
49libbacktrace_shared_libraries_target := \
Christopher Ferris17e91d42013-10-21 13:30:52 -070050 libcutils \
Christopher Ferris17e91d42013-10-21 13:30:52 -070051
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080052libbacktrace_src_files += \
Christopher Ferris17e91d42013-10-21 13:30:52 -070053 UnwindCurrent.cpp \
Christopher Ferrisdf290612014-01-22 19:21:07 -080054 UnwindMap.cpp \
Christopher Ferris17e91d42013-10-21 13:30:52 -070055 UnwindPtrace.cpp \
Christopher Ferris7fb22872013-09-27 12:43:15 -070056
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080057libbacktrace_shared_libraries := \
Christopher Ferris17e91d42013-10-21 13:30:52 -070058 libunwind \
59 libunwind-ptrace \
60
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
93include $(LOCAL_PATH)/Android.build.mk
94build_type := host
95include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris7fb22872013-09-27 12:43:15 -070096
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080097#-------------------------------------------------------------------------
98# The backtrace_test executable.
99#-------------------------------------------------------------------------
100backtrace_test_cflags := \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700101 -fno-builtin \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700102 -O0 \
103 -g \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800104
105backtrace_test_cflags_target := \
Christopher Ferrise2960912014-03-07 19:42:19 -0800106 -DENABLE_PSS_TESTS \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800107
108backtrace_test_src_files := \
109 backtrace_test.cpp \
Christopher Ferrise2960912014-03-07 19:42:19 -0800110 GetPss.cpp \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800111 thread_utils.c \
112
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800113backtrace_test_ldlibs_host := \
Ying Wang9f437d72014-05-07 15:36:05 -0700114 -lpthread \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800115 -lrt \
116
117backtrace_test_shared_libraries := \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700118 libbacktrace_test \
119 libbacktrace \
120
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800121backtrace_test_shared_libraries_target := \
122 libcutils \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700123
Christopher Ferrisa2efd3a2014-05-06 15:23:59 -0700124backtrace_test_static_libraries_host := \
125 libcutils \
126
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800127module := backtrace_test
128module_tag := debug
129build_type := target
130build_target := NATIVE_TEST
131include $(LOCAL_PATH)/Android.build.mk
132build_type := host
133include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris17e91d42013-10-21 13:30:52 -0700134
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800135#----------------------------------------------------------------------------
136# Special truncated libbacktrace library for mac.
137#----------------------------------------------------------------------------
138ifeq ($(HOST_OS),darwin)
Christopher Ferris7fb22872013-09-27 12:43:15 -0700139
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800140include $(CLEAR_VARS)
Christopher Ferrisf67c6412014-01-10 00:43:54 -0800141
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800142LOCAL_MODULE := libbacktrace
143LOCAL_MODULE_TAGS := optional
144
145LOCAL_SRC_FILES := \
146 BacktraceMap.cpp \
147
Dan Albert5570c9b2014-11-13 14:54:10 -0800148LOCAL_MULTILIB := both
149
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800150include $(BUILD_HOST_SHARED_LIBRARY)
151
152endif # HOST_OS-darwin