blob: b4bf35fbad6dce6225ad5d0b68dd5981fcbaf50e [file] [log] [blame]
Dan Willemsen2e1591b2016-07-12 17:20:18 -07001//
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//
16
17cc_defaults {
18 name: "libbacktrace_common",
19
20 cflags: [
21 "-Wall",
22 "-Werror",
23 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -070024
Dan Willemsen2e1591b2016-07-12 17:20:18 -070025 target: {
Dan Willemsen2e1591b2016-07-12 17:20:18 -070026 darwin: {
27 enabled: false,
28 },
29 },
30
31 multilib: {
32 lib32: {
33 suffix: "32",
34 },
35 lib64: {
36 suffix: "64",
37 },
Elliott Hughesdc699a22018-02-16 17:58:14 -080038 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070039}
40
41libbacktrace_sources = [
42 "Backtrace.cpp",
43 "BacktraceCurrent.cpp",
44 "BacktracePtrace.cpp",
45 "thread_utils.c",
46 "ThreadEntry.cpp",
Christopher Ferris6f3981c2017-07-27 09:29:18 -070047 "UnwindStack.cpp",
48 "UnwindStackMap.cpp",
Dan Willemsen2e1591b2016-07-12 17:20:18 -070049]
50
Vijay Venkatraman8f2c28d2017-04-11 11:22:43 -070051cc_library_headers {
52 name: "libbacktrace_headers",
Steven Moreland4ad9d512017-04-13 21:01:40 -070053 vendor_available: true,
Jiyong Park612210c2018-04-27 21:48:43 +090054 recovery_available: true,
Vijay Venkatraman8f2c28d2017-04-11 11:22:43 -070055 export_include_dirs: ["include"],
56}
57
Dan Willemsen2e1591b2016-07-12 17:20:18 -070058cc_library {
59 name: "libbacktrace",
Jiyong Parkb7d92c42017-08-23 13:25:21 +090060 vendor_available: false,
Jiyong Parka0e75042018-05-24 14:11:00 +090061 recovery_available: true,
Justin Yun9ca92452017-07-31 15:41:10 +090062 vndk: {
63 enabled: true,
64 support_system_process: true,
65 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070066 defaults: ["libbacktrace_common"],
67 host_supported: true,
68
Josh Gaoe22701e2017-10-23 14:25:08 -070069 cflags: [
70 "-Wexit-time-destructors",
71 ],
72
Dan Willemsen2e1591b2016-07-12 17:20:18 -070073 srcs: [
74 "BacktraceMap.cpp",
75 ],
76
Vijay Venkatraman8f2c28d2017-04-11 11:22:43 -070077 export_include_dirs: ["include"],
78
Dan Willemsen2e1591b2016-07-12 17:20:18 -070079 target: {
80 darwin: {
81 enabled: true,
Christopher Tate69831122018-02-16 14:52:26 -080082 shared_libs: [
Elliott Hughesdc699a22018-02-16 17:58:14 -080083 "libbase",
84 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -070085 },
Dan Willemsenbdddcab2017-10-03 14:17:31 -070086 linux: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -070087 srcs: libbacktrace_sources,
88
89 shared_libs: [
90 "libbase",
91 "liblog",
Christopher Ferris6f3981c2017-07-27 09:29:18 -070092 "libunwindstack",
Christopher Ferris0b06a592018-01-19 10:26:36 -080093 "libdexfile",
Dan Willemsene0cd1e02017-03-15 15:23:36 -070094 ],
95
Yabin Cui3841acc2018-05-10 17:19:12 -070096 static_libs: [
97 "libcutils",
98 "libprocinfo",
99 ],
Christopher Ferris0b06a592018-01-19 10:26:36 -0800100
101 // libdexfile will eventually properly export headers, for now
102 // include these directly.
103 include_dirs: [
104 "art/runtime",
105 ],
Dan Willemsene0cd1e02017-03-15 15:23:36 -0700106 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700107 android: {
Dan Willemsenbdddcab2017-10-03 14:17:31 -0700108 static_libs: ["libasync_safe"],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700109 },
Christopher Ferris0b06a592018-01-19 10:26:36 -0800110 vendor: {
Christopher Ferrisd70ea5e2018-01-30 19:47:24 -0800111 cflags: ["-DNO_LIBDEXFILE_SUPPORT"],
Christopher Ferris0b06a592018-01-19 10:26:36 -0800112 exclude_shared_libs: ["libdexfile"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800113 },
Jiyong Parka0e75042018-05-24 14:11:00 +0900114 recovery: {
115 cflags: ["-DNO_LIBDEXFILE_SUPPORT"],
116 exclude_shared_libs: ["libdexfile"],
117 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700118 },
Christopher Ferris7d0aea92017-06-01 14:15:09 -0700119 whole_static_libs: ["libdemangle"],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700120}
121
122cc_library_shared {
123 name: "libbacktrace_test",
124 defaults: ["libbacktrace_common"],
125 host_supported: true,
126 strip: {
127 none: true,
128 },
129 cflags: ["-O0"],
Christopher Ferris5ea2c1f2017-03-23 14:55:01 -0700130 srcs: ["backtrace_testlib.cpp"],
Yabin Cui5d991bc2016-11-15 17:47:09 -0800131
Christopher Ferrisc8bec5a2017-12-11 17:44:33 -0800132 shared_libs: [
Elliott Hughesdc699a22018-02-16 17:58:14 -0800133 "libunwindstack",
Colin Crossda9bd592016-12-14 17:24:46 -0800134 ],
135}
136
137//-------------------------------------------------------------------------
138// The backtrace_test executable.
139//-------------------------------------------------------------------------
140cc_test {
141 name: "backtrace_test",
142 defaults: ["libbacktrace_common"],
143 host_supported: true,
144 srcs: [
145 "backtrace_offline_test.cpp",
146 "backtrace_test.cpp",
147 "GetPss.cpp",
148 "thread_utils.c",
149 ],
150
151 cflags: [
152 "-fno-builtin",
153 "-O0",
154 "-g",
155 ],
156
157 shared_libs: [
158 "libbacktrace_test",
159 "libbacktrace",
Christopher Ferris0b06a592018-01-19 10:26:36 -0800160 "libdexfile",
Colin Crossda9bd592016-12-14 17:24:46 -0800161 "libbase",
162 "libcutils",
163 "liblog",
Christopher Ferris6f3981c2017-07-27 09:29:18 -0700164 "libunwindstack",
Colin Crossda9bd592016-12-14 17:24:46 -0800165 ],
166
167 group_static_libs: true,
168
Colin Crossda9bd592016-12-14 17:24:46 -0800169 target: {
170 android: {
171 cflags: ["-DENABLE_PSS_TESTS"],
172 shared_libs: [
Colin Crossda9bd592016-12-14 17:24:46 -0800173 "libutils",
174 ],
175 },
Dan Willemsen48529332017-10-02 10:38:16 -0700176 linux_glibc: {
Colin Crossda9bd592016-12-14 17:24:46 -0800177 static_libs: ["libutils"],
178 },
179 },
Christopher Ferris458cc662017-08-28 16:31:18 -0700180
Christopher Ferris0b06a592018-01-19 10:26:36 -0800181 // libdexfile will eventually properly export headers, for now
182 // include these directly.
183 include_dirs: [
184 "art/runtime",
185 ],
186
Elliott Hughes40fdf3f2018-04-27 16:12:06 -0700187 test_suites: ["device-tests"],
Christopher Ferris458cc662017-08-28 16:31:18 -0700188 data: [
189 "testdata/arm/*",
190 "testdata/arm64/*",
191 "testdata/x86/*",
192 "testdata/x86_64/*",
193 ],
Elliott Hughes03d183a2018-05-03 10:06:45 -0700194 required: [
195 "libbacktrace_test",
196 ],
Colin Crossda9bd592016-12-14 17:24:46 -0800197}
Christopher Ferris60521c72017-08-18 15:10:53 -0700198
199cc_benchmark {
200 name: "backtrace_benchmarks",
201 defaults: ["libbacktrace_common"],
202
203 srcs: [
204 "backtrace_benchmarks.cpp",
Christopher Ferrise3286732017-12-07 17:41:18 -0800205 "backtrace_read_benchmarks.cpp",
Christopher Ferris60521c72017-08-18 15:10:53 -0700206 ],
207
208 shared_libs: [
209 "libbacktrace",
210 "libbase",
Josh Gaob9670bb2017-10-25 15:12:24 -0700211 "libunwindstack",
Christopher Ferris60521c72017-08-18 15:10:53 -0700212 ],
213}