blob: 10a4e4634e6a208dfd1af3758d2d34b605340f52 [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
Colin Crossda9bd592016-12-14 17:24:46 -080025 // The latest clang (r230699) does not allow SP/PC to be declared in inline asm lists.
Dan Willemsen2e1591b2016-07-12 17:20:18 -070026 clang_cflags: ["-Wno-inline-asm"],
27
Dan Willemsen2e1591b2016-07-12 17:20:18 -070028 include_dirs: ["external/libunwind/include/tdep"],
29
Dan Willemsen2e1591b2016-07-12 17:20:18 -070030
31 target: {
Dan Willemsen2e1591b2016-07-12 17:20:18 -070032 darwin: {
33 enabled: false,
34 },
35 },
36
37 multilib: {
38 lib32: {
39 suffix: "32",
40 },
41 lib64: {
42 suffix: "64",
43 },
44 }
45}
46
47libbacktrace_sources = [
48 "Backtrace.cpp",
49 "BacktraceCurrent.cpp",
50 "BacktracePtrace.cpp",
51 "thread_utils.c",
52 "ThreadEntry.cpp",
Christopher Ferris6f3981c2017-07-27 09:29:18 -070053 "UnwindStack.cpp",
54 "UnwindStackMap.cpp",
Dan Willemsen2e1591b2016-07-12 17:20:18 -070055]
56
Vijay Venkatraman8f2c28d2017-04-11 11:22:43 -070057cc_library_headers {
58 name: "libbacktrace_headers",
Steven Moreland4ad9d512017-04-13 21:01:40 -070059 vendor_available: true,
Vijay Venkatraman8f2c28d2017-04-11 11:22:43 -070060 export_include_dirs: ["include"],
61}
62
Dan Willemsen2e1591b2016-07-12 17:20:18 -070063cc_library {
64 name: "libbacktrace",
Jiyong Parkb7d92c42017-08-23 13:25:21 +090065 vendor_available: false,
Justin Yun9ca92452017-07-31 15:41:10 +090066 vndk: {
67 enabled: true,
68 support_system_process: true,
69 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070070 defaults: ["libbacktrace_common"],
71 host_supported: true,
72
Josh Gaoe22701e2017-10-23 14:25:08 -070073 cflags: [
74 "-Wexit-time-destructors",
75 ],
76
Dan Willemsen2e1591b2016-07-12 17:20:18 -070077 srcs: [
78 "BacktraceMap.cpp",
79 ],
80
Vijay Venkatraman8f2c28d2017-04-11 11:22:43 -070081 export_include_dirs: ["include"],
82
Dan Willemsen2e1591b2016-07-12 17:20:18 -070083 target: {
84 darwin: {
85 enabled: true,
86 },
Dan Willemsenbdddcab2017-10-03 14:17:31 -070087 linux: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -070088 srcs: libbacktrace_sources,
89
90 shared_libs: [
91 "libbase",
92 "liblog",
93 "libunwind",
Christopher Ferris6f3981c2017-07-27 09:29:18 -070094 "libunwindstack",
Christopher Ferris0b06a592018-01-19 10:26:36 -080095 "libdexfile",
Dan Willemsene0cd1e02017-03-15 15:23:36 -070096 ],
97
98 static_libs: ["libcutils"],
Christopher Ferris0b06a592018-01-19 10:26:36 -080099
100 // libdexfile will eventually properly export headers, for now
101 // include these directly.
102 include_dirs: [
103 "art/runtime",
104 ],
105
106 header_libs: [ "jni_headers", ],
Dan Willemsene0cd1e02017-03-15 15:23:36 -0700107 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700108 android: {
Dan Willemsenbdddcab2017-10-03 14:17:31 -0700109 static_libs: ["libasync_safe"],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700110 },
Christopher Ferris0b06a592018-01-19 10:26:36 -0800111 vendor: {
Christopher Ferrisd70ea5e2018-01-30 19:47:24 -0800112 cflags: ["-DNO_LIBDEXFILE_SUPPORT"],
Christopher Ferris0b06a592018-01-19 10:26:36 -0800113 exclude_shared_libs: ["libdexfile"],
Christopher Ferrisd70ea5e2018-01-30 19:47:24 -0800114 }
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700115 },
Christopher Ferris7d0aea92017-06-01 14:15:09 -0700116 whole_static_libs: ["libdemangle"],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700117}
118
119cc_library_shared {
120 name: "libbacktrace_test",
121 defaults: ["libbacktrace_common"],
122 host_supported: true,
123 strip: {
124 none: true,
125 },
126 cflags: ["-O0"],
Christopher Ferris5ea2c1f2017-03-23 14:55:01 -0700127 srcs: ["backtrace_testlib.cpp"],
Yabin Cui5d991bc2016-11-15 17:47:09 -0800128
Christopher Ferrisc8bec5a2017-12-11 17:44:33 -0800129 shared_libs: [
130 "libunwindstack",
Colin Crossda9bd592016-12-14 17:24:46 -0800131 ],
132}
133
134//-------------------------------------------------------------------------
135// The backtrace_test executable.
136//-------------------------------------------------------------------------
137cc_test {
138 name: "backtrace_test",
139 defaults: ["libbacktrace_common"],
140 host_supported: true,
141 srcs: [
142 "backtrace_offline_test.cpp",
143 "backtrace_test.cpp",
144 "GetPss.cpp",
145 "thread_utils.c",
146 ],
147
148 cflags: [
149 "-fno-builtin",
150 "-O0",
151 "-g",
152 ],
153
154 shared_libs: [
155 "libbacktrace_test",
156 "libbacktrace",
Christopher Ferris0b06a592018-01-19 10:26:36 -0800157 "libdexfile",
Colin Crossda9bd592016-12-14 17:24:46 -0800158 "libbase",
159 "libcutils",
160 "liblog",
Christopher Ferris6f3981c2017-07-27 09:29:18 -0700161 "libunwindstack",
Colin Crossda9bd592016-12-14 17:24:46 -0800162 ],
163
164 group_static_libs: true,
165
Colin Crossda9bd592016-12-14 17:24:46 -0800166 target: {
167 android: {
168 cflags: ["-DENABLE_PSS_TESTS"],
169 shared_libs: [
Colin Crossda9bd592016-12-14 17:24:46 -0800170 "libutils",
171 ],
172 },
Dan Willemsen48529332017-10-02 10:38:16 -0700173 linux_glibc: {
Colin Crossda9bd592016-12-14 17:24:46 -0800174 static_libs: ["libutils"],
175 },
176 },
Christopher Ferris458cc662017-08-28 16:31:18 -0700177
Christopher Ferris0b06a592018-01-19 10:26:36 -0800178 // libdexfile will eventually properly export headers, for now
179 // include these directly.
180 include_dirs: [
181 "art/runtime",
182 ],
183
Christopher Ferris458cc662017-08-28 16:31:18 -0700184 data: [
185 "testdata/arm/*",
186 "testdata/arm64/*",
187 "testdata/x86/*",
188 "testdata/x86_64/*",
189 ],
Colin Crossda9bd592016-12-14 17:24:46 -0800190}
Christopher Ferris60521c72017-08-18 15:10:53 -0700191
192cc_benchmark {
193 name: "backtrace_benchmarks",
194 defaults: ["libbacktrace_common"],
195
196 srcs: [
197 "backtrace_benchmarks.cpp",
Christopher Ferrise3286732017-12-07 17:41:18 -0800198 "backtrace_read_benchmarks.cpp",
Christopher Ferris60521c72017-08-18 15:10:53 -0700199 ],
200
201 shared_libs: [
202 "libbacktrace",
203 "libbase",
Josh Gaob9670bb2017-10-25 15:12:24 -0700204 "libunwindstack",
Christopher Ferris60521c72017-08-18 15:10:53 -0700205 ],
206}