blob: 13898ec44eca47e9f3df4a3c84fa7edb7471f840 [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 \
47 libgccdemangle \
Christopher Ferris17e91d42013-10-21 13:30:52 -070048
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080049libbacktrace_src_files += \
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_c_includes := \
Christopher Ferris7fb22872013-09-27 12:43:15 -070055 external/libunwind/include \
56
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 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
73include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -070074
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080075#-------------------------------------------------------------------------
Dan Albert40a46dd2014-05-19 10:10:37 -070076# The libbacktrace library (libc++)
77#-------------------------------------------------------------------------
78libbacktrace_libc++_src_files := \
79 BacktraceImpl.cpp \
80 BacktraceMap.cpp \
81 BacktraceThread.cpp \
82 thread_utils.c \
83
84libbacktrace_libc++_shared_libraries_target := \
85 libcutils \
86 libgccdemangle \
87
88libbacktrace_libc++_src_files += \
89 UnwindCurrent.cpp \
90 UnwindMap.cpp \
91 UnwindPtrace.cpp \
92
93libbacktrace_libc++_c_includes := \
94 external/libunwind/include \
95
96libbacktrace_libc++_shared_libraries := \
97 libunwind \
98 libunwind-ptrace \
99
100libbacktrace_libc++_shared_libraries_host := \
101 liblog \
102
103libbacktrace_libc++_static_libraries_host := \
104 libcutils \
105
106libbacktrace_libc++_libc++ := true
107
108module := libbacktrace_libc++
109module_tag := optional
110build_type := target
111build_target := SHARED_LIBRARY
112include $(LOCAL_PATH)/Android.build.mk
113build_type := host
114include $(LOCAL_PATH)/Android.build.mk
115
116#-------------------------------------------------------------------------
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800117# The libbacktrace_test library needed by backtrace_test.
118#-------------------------------------------------------------------------
119libbacktrace_test_cflags := \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700120 -O0 \
121
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800122libbacktrace_test_src_files := \
123 backtrace_testlib.c \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700124
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800125module := libbacktrace_test
126module_tag := debug
127build_type := target
128build_target := SHARED_LIBRARY
129include $(LOCAL_PATH)/Android.build.mk
130build_type := host
131include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris7fb22872013-09-27 12:43:15 -0700132
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800133#-------------------------------------------------------------------------
134# The backtrace_test executable.
135#-------------------------------------------------------------------------
136backtrace_test_cflags := \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700137 -fno-builtin \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700138 -O0 \
139 -g \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800140
141backtrace_test_cflags_target := \
Christopher Ferrise2960912014-03-07 19:42:19 -0800142 -DENABLE_PSS_TESTS \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800143
144backtrace_test_src_files := \
145 backtrace_test.cpp \
Christopher Ferrise2960912014-03-07 19:42:19 -0800146 GetPss.cpp \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800147 thread_utils.c \
148
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800149backtrace_test_ldlibs_host := \
Ying Wang9f437d72014-05-07 15:36:05 -0700150 -lpthread \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800151 -lrt \
152
153backtrace_test_shared_libraries := \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700154 libbacktrace_test \
155 libbacktrace \
156
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800157backtrace_test_shared_libraries_target := \
158 libcutils \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700159
Christopher Ferrisa2efd3a2014-05-06 15:23:59 -0700160backtrace_test_static_libraries_host := \
161 libcutils \
162
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800163module := backtrace_test
164module_tag := debug
165build_type := target
166build_target := NATIVE_TEST
167include $(LOCAL_PATH)/Android.build.mk
168build_type := host
169include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris17e91d42013-10-21 13:30:52 -0700170
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800171#----------------------------------------------------------------------------
172# Special truncated libbacktrace library for mac.
173#----------------------------------------------------------------------------
174ifeq ($(HOST_OS),darwin)
Christopher Ferris7fb22872013-09-27 12:43:15 -0700175
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800176include $(CLEAR_VARS)
Christopher Ferrisf67c6412014-01-10 00:43:54 -0800177
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800178LOCAL_MODULE := libbacktrace
179LOCAL_MODULE_TAGS := optional
180
181LOCAL_SRC_FILES := \
182 BacktraceMap.cpp \
183
184include $(BUILD_HOST_SHARED_LIBRARY)
185
186endif # HOST_OS-darwin