blob: 9588dd6d7d1cdce1fa489f97defcb4c9c9f26cc3 [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 Ferrisdb445382014-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
77include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -070078
Dan Alberta8b84602014-05-19 11:40:27 -070079# Don't build for unbundled branches
80ifeq (,$(TARGET_BUILD_APPS))
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080081#-------------------------------------------------------------------------
Dan Albert40a46dd2014-05-19 10:10:37 -070082# The libbacktrace library (libc++)
83#-------------------------------------------------------------------------
84libbacktrace_libc++_src_files := \
85 BacktraceImpl.cpp \
86 BacktraceMap.cpp \
87 BacktraceThread.cpp \
88 thread_utils.c \
89
90libbacktrace_libc++_shared_libraries_target := \
91 libcutils \
92 libgccdemangle \
93
94libbacktrace_libc++_src_files += \
95 UnwindCurrent.cpp \
96 UnwindMap.cpp \
97 UnwindPtrace.cpp \
98
99libbacktrace_libc++_c_includes := \
100 external/libunwind/include \
101
102libbacktrace_libc++_shared_libraries := \
103 libunwind \
104 libunwind-ptrace \
105
106libbacktrace_libc++_shared_libraries_host := \
107 liblog \
108
109libbacktrace_libc++_static_libraries_host := \
110 libcutils \
111
Christopher Ferrisdb445382014-11-08 15:57:11 -0800112libbacktrace_libc++_ldlibs_host := \
113 -lpthread \
114 -lrt \
115
Dan Albert40a46dd2014-05-19 10:10:37 -0700116libbacktrace_libc++_libc++ := true
117
118module := libbacktrace_libc++
119module_tag := optional
120build_type := target
121build_target := SHARED_LIBRARY
122include $(LOCAL_PATH)/Android.build.mk
123build_type := host
Ian Rogers5af80aa2014-06-17 01:50:25 -0700124libbacktrace_libc++_multilib := both
Dan Albert40a46dd2014-05-19 10:10:37 -0700125include $(LOCAL_PATH)/Android.build.mk
Ian Rogers5af80aa2014-06-17 01:50:25 -0700126libbacktrace_libc++_multilib :=
Dan Alberta8b84602014-05-19 11:40:27 -0700127endif
Dan Albert40a46dd2014-05-19 10:10:37 -0700128
129#-------------------------------------------------------------------------
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800130# The libbacktrace_test library needed by backtrace_test.
131#-------------------------------------------------------------------------
132libbacktrace_test_cflags := \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700133 -O0 \
134
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800135libbacktrace_test_src_files := \
136 backtrace_testlib.c \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700137
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800138module := libbacktrace_test
139module_tag := debug
140build_type := target
141build_target := SHARED_LIBRARY
142include $(LOCAL_PATH)/Android.build.mk
143build_type := host
144include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris7fb22872013-09-27 12:43:15 -0700145
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800146#-------------------------------------------------------------------------
147# The backtrace_test executable.
148#-------------------------------------------------------------------------
149backtrace_test_cflags := \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700150 -fno-builtin \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700151 -O0 \
152 -g \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800153
154backtrace_test_cflags_target := \
Christopher Ferrise2960912014-03-07 19:42:19 -0800155 -DENABLE_PSS_TESTS \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800156
157backtrace_test_src_files := \
158 backtrace_test.cpp \
Christopher Ferrise2960912014-03-07 19:42:19 -0800159 GetPss.cpp \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800160 thread_utils.c \
161
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800162backtrace_test_ldlibs_host := \
Ying Wang9f437d72014-05-07 15:36:05 -0700163 -lpthread \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800164 -lrt \
165
166backtrace_test_shared_libraries := \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700167 libbacktrace_test \
168 libbacktrace \
169
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800170backtrace_test_shared_libraries_target := \
171 libcutils \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700172
Christopher Ferrisa2efd3a2014-05-06 15:23:59 -0700173backtrace_test_static_libraries_host := \
174 libcutils \
175
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800176module := backtrace_test
177module_tag := debug
178build_type := target
179build_target := NATIVE_TEST
180include $(LOCAL_PATH)/Android.build.mk
181build_type := host
182include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris17e91d42013-10-21 13:30:52 -0700183
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800184#----------------------------------------------------------------------------
185# Special truncated libbacktrace library for mac.
186#----------------------------------------------------------------------------
187ifeq ($(HOST_OS),darwin)
Christopher Ferris7fb22872013-09-27 12:43:15 -0700188
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800189include $(CLEAR_VARS)
Christopher Ferrisf67c6412014-01-10 00:43:54 -0800190
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800191LOCAL_MODULE := libbacktrace
192LOCAL_MODULE_TAGS := optional
193
194LOCAL_SRC_FILES := \
195 BacktraceMap.cpp \
196
197include $(BUILD_HOST_SHARED_LIBRARY)
198
Ian Rogersdeebae52014-06-11 12:55:50 -0700199# Don't build for unbundled branches
200ifeq (,$(TARGET_BUILD_APPS))
201#-------------------------------------------------------------------------
202# The libbacktrace library (libc++)
203#-------------------------------------------------------------------------
204include $(CLEAR_VARS)
205
206LOCAL_MODULE := libbacktrace_libc++
207LOCAL_MODULE_TAGS := optional
208
209LOCAL_SRC_FILES := \
210 BacktraceMap.cpp \
211
Ian Rogersc132aaf2014-06-24 21:57:55 -0700212LOCAL_MULTILIB := both
213
Ian Rogersdeebae52014-06-11 12:55:50 -0700214include $(BUILD_HOST_SHARED_LIBRARY)
215
216endif # TARGET_BUILD_APPS
217
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800218endif # HOST_OS-darwin