blob: f3b28dd4bef399f301ea2a5d1661d3e5caeead05 [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
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080029build_host := false
30ifeq ($(HOST_OS),linux)
31ifeq ($(HOST_ARCH),$(filter $(HOST_ARCH),x86 x86_64))
32build_host := true
33endif
34endif
35
36#-------------------------------------------------------------------------
37# The libbacktrace library.
38#-------------------------------------------------------------------------
39libbacktrace_src_files := \
40 BacktraceImpl.cpp \
41 BacktraceMap.cpp \
42 BacktraceThread.cpp \
43 thread_utils.c \
44
45libbacktrace_shared_libraries_target := \
Christopher Ferris17e91d42013-10-21 13:30:52 -070046 libcutils \
Christopher Ferris17e91d42013-10-21 13:30:52 -070047
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080048libbacktrace_src_files += \
Christopher Ferris17e91d42013-10-21 13:30:52 -070049 UnwindCurrent.cpp \
Christopher Ferrisdf290612014-01-22 19:21:07 -080050 UnwindMap.cpp \
Christopher Ferris17e91d42013-10-21 13:30:52 -070051 UnwindPtrace.cpp \
Christopher Ferris7fb22872013-09-27 12:43:15 -070052
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080053libbacktrace_shared_libraries := \
Christopher Ferris17e91d42013-10-21 13:30:52 -070054 libunwind \
55 libunwind-ptrace \
56
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080057libbacktrace_shared_libraries_host := \
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -070058 liblog \
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -070059
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080060libbacktrace_static_libraries_host := \
61 libcutils \
Christopher Ferrisf67c6412014-01-10 00:43:54 -080062
Christopher Ferris3cdbfdc2014-11-08 15:57:11 -080063libbacktrace_ldlibs_host := \
64 -lpthread \
65 -lrt \
66
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080067module := libbacktrace
68module_tag := optional
69build_type := target
70build_target := SHARED_LIBRARY
71include $(LOCAL_PATH)/Android.build.mk
72build_type := host
Dan Albert0d7164d2014-11-11 15:15:21 -080073libbacktrace_multilib := both
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080074include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -070075
Dan Albert40a46dd2014-05-19 10:10:37 -070076#-------------------------------------------------------------------------
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080077# The libbacktrace_test library needed by backtrace_test.
78#-------------------------------------------------------------------------
79libbacktrace_test_cflags := \
Christopher Ferris7fb22872013-09-27 12:43:15 -070080 -O0 \
81
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080082libbacktrace_test_src_files := \
83 backtrace_testlib.c \
Christopher Ferris17e91d42013-10-21 13:30:52 -070084
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080085module := libbacktrace_test
86module_tag := debug
87build_type := target
88build_target := SHARED_LIBRARY
89include $(LOCAL_PATH)/Android.build.mk
90build_type := host
91include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris7fb22872013-09-27 12:43:15 -070092
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080093#-------------------------------------------------------------------------
94# The backtrace_test executable.
95#-------------------------------------------------------------------------
96backtrace_test_cflags := \
Christopher Ferris17e91d42013-10-21 13:30:52 -070097 -fno-builtin \
Christopher Ferris17e91d42013-10-21 13:30:52 -070098 -O0 \
99 -g \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800100
101backtrace_test_cflags_target := \
Christopher Ferrise2960912014-03-07 19:42:19 -0800102 -DENABLE_PSS_TESTS \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800103
104backtrace_test_src_files := \
105 backtrace_test.cpp \
Christopher Ferrise2960912014-03-07 19:42:19 -0800106 GetPss.cpp \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800107 thread_utils.c \
108
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800109backtrace_test_ldlibs_host := \
Ying Wang9f437d72014-05-07 15:36:05 -0700110 -lpthread \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800111 -lrt \
112
113backtrace_test_shared_libraries := \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700114 libbacktrace_test \
115 libbacktrace \
116
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800117backtrace_test_shared_libraries_target := \
118 libcutils \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700119
Christopher Ferrisa2efd3a2014-05-06 15:23:59 -0700120backtrace_test_static_libraries_host := \
121 libcutils \
122
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800123module := backtrace_test
124module_tag := debug
125build_type := target
126build_target := NATIVE_TEST
127include $(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