Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 1 | // |
| 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 | |
| 17 | cc_defaults { |
| 18 | name: "libbacktrace_common", |
| 19 | |
| 20 | cflags: [ |
| 21 | "-Wall", |
| 22 | "-Werror", |
| 23 | ], |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 24 | |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 25 | target: { |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 26 | darwin: { |
| 27 | enabled: false, |
| 28 | }, |
| 29 | }, |
| 30 | |
| 31 | multilib: { |
| 32 | lib32: { |
| 33 | suffix: "32", |
| 34 | }, |
| 35 | lib64: { |
| 36 | suffix: "64", |
| 37 | }, |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 38 | }, |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 39 | } |
| 40 | |
| 41 | libbacktrace_sources = [ |
| 42 | "Backtrace.cpp", |
| 43 | "BacktraceCurrent.cpp", |
| 44 | "BacktracePtrace.cpp", |
| 45 | "thread_utils.c", |
| 46 | "ThreadEntry.cpp", |
Christopher Ferris | 6f3981c | 2017-07-27 09:29:18 -0700 | [diff] [blame] | 47 | "UnwindStack.cpp", |
| 48 | "UnwindStackMap.cpp", |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 49 | ] |
| 50 | |
Vijay Venkatraman | 8f2c28d | 2017-04-11 11:22:43 -0700 | [diff] [blame] | 51 | cc_library_headers { |
| 52 | name: "libbacktrace_headers", |
Steven Moreland | 4ad9d51 | 2017-04-13 21:01:40 -0700 | [diff] [blame] | 53 | vendor_available: true, |
Vijay Venkatraman | 8f2c28d | 2017-04-11 11:22:43 -0700 | [diff] [blame] | 54 | export_include_dirs: ["include"], |
| 55 | } |
| 56 | |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 57 | cc_library { |
| 58 | name: "libbacktrace", |
Jiyong Park | b7d92c4 | 2017-08-23 13:25:21 +0900 | [diff] [blame] | 59 | vendor_available: false, |
Justin Yun | 9ca9245 | 2017-07-31 15:41:10 +0900 | [diff] [blame] | 60 | vndk: { |
| 61 | enabled: true, |
| 62 | support_system_process: true, |
| 63 | }, |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 64 | defaults: ["libbacktrace_common"], |
| 65 | host_supported: true, |
| 66 | |
Josh Gao | e22701e | 2017-10-23 14:25:08 -0700 | [diff] [blame] | 67 | cflags: [ |
| 68 | "-Wexit-time-destructors", |
| 69 | ], |
| 70 | |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 71 | srcs: [ |
| 72 | "BacktraceMap.cpp", |
| 73 | ], |
| 74 | |
Vijay Venkatraman | 8f2c28d | 2017-04-11 11:22:43 -0700 | [diff] [blame] | 75 | export_include_dirs: ["include"], |
| 76 | |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 77 | target: { |
| 78 | darwin: { |
| 79 | enabled: true, |
Christopher Tate | 6983112 | 2018-02-16 14:52:26 -0800 | [diff] [blame] | 80 | shared_libs: [ |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 81 | "libbase", |
| 82 | ], |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 83 | }, |
Dan Willemsen | bdddcab | 2017-10-03 14:17:31 -0700 | [diff] [blame] | 84 | linux: { |
Dan Willemsen | e0cd1e0 | 2017-03-15 15:23:36 -0700 | [diff] [blame] | 85 | srcs: libbacktrace_sources, |
| 86 | |
| 87 | shared_libs: [ |
| 88 | "libbase", |
| 89 | "liblog", |
Christopher Ferris | 6f3981c | 2017-07-27 09:29:18 -0700 | [diff] [blame] | 90 | "libunwindstack", |
Christopher Ferris | 0b06a59 | 2018-01-19 10:26:36 -0800 | [diff] [blame] | 91 | "libdexfile", |
Dan Willemsen | e0cd1e0 | 2017-03-15 15:23:36 -0700 | [diff] [blame] | 92 | ], |
| 93 | |
| 94 | static_libs: ["libcutils"], |
Christopher Ferris | 0b06a59 | 2018-01-19 10:26:36 -0800 | [diff] [blame] | 95 | |
| 96 | // libdexfile will eventually properly export headers, for now |
| 97 | // include these directly. |
| 98 | include_dirs: [ |
| 99 | "art/runtime", |
| 100 | ], |
| 101 | |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 102 | header_libs: ["jni_headers"], |
Dan Willemsen | e0cd1e0 | 2017-03-15 15:23:36 -0700 | [diff] [blame] | 103 | }, |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 104 | android: { |
Dan Willemsen | bdddcab | 2017-10-03 14:17:31 -0700 | [diff] [blame] | 105 | static_libs: ["libasync_safe"], |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 106 | }, |
Christopher Ferris | 0b06a59 | 2018-01-19 10:26:36 -0800 | [diff] [blame] | 107 | vendor: { |
Christopher Ferris | d70ea5e | 2018-01-30 19:47:24 -0800 | [diff] [blame] | 108 | cflags: ["-DNO_LIBDEXFILE_SUPPORT"], |
Christopher Ferris | 0b06a59 | 2018-01-19 10:26:36 -0800 | [diff] [blame] | 109 | exclude_shared_libs: ["libdexfile"], |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 110 | }, |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 111 | }, |
Christopher Ferris | 7d0aea9 | 2017-06-01 14:15:09 -0700 | [diff] [blame] | 112 | whole_static_libs: ["libdemangle"], |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 113 | } |
| 114 | |
| 115 | cc_library_shared { |
| 116 | name: "libbacktrace_test", |
| 117 | defaults: ["libbacktrace_common"], |
| 118 | host_supported: true, |
| 119 | strip: { |
| 120 | none: true, |
| 121 | }, |
| 122 | cflags: ["-O0"], |
Christopher Ferris | 5ea2c1f | 2017-03-23 14:55:01 -0700 | [diff] [blame] | 123 | srcs: ["backtrace_testlib.cpp"], |
Yabin Cui | 5d991bc | 2016-11-15 17:47:09 -0800 | [diff] [blame] | 124 | |
Christopher Ferris | c8bec5a | 2017-12-11 17:44:33 -0800 | [diff] [blame] | 125 | shared_libs: [ |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 126 | "libunwindstack", |
Colin Cross | da9bd59 | 2016-12-14 17:24:46 -0800 | [diff] [blame] | 127 | ], |
| 128 | } |
| 129 | |
| 130 | //------------------------------------------------------------------------- |
| 131 | // The backtrace_test executable. |
| 132 | //------------------------------------------------------------------------- |
| 133 | cc_test { |
| 134 | name: "backtrace_test", |
| 135 | defaults: ["libbacktrace_common"], |
| 136 | host_supported: true, |
| 137 | srcs: [ |
| 138 | "backtrace_offline_test.cpp", |
| 139 | "backtrace_test.cpp", |
| 140 | "GetPss.cpp", |
| 141 | "thread_utils.c", |
| 142 | ], |
| 143 | |
| 144 | cflags: [ |
| 145 | "-fno-builtin", |
| 146 | "-O0", |
| 147 | "-g", |
| 148 | ], |
| 149 | |
| 150 | shared_libs: [ |
| 151 | "libbacktrace_test", |
| 152 | "libbacktrace", |
Christopher Ferris | 0b06a59 | 2018-01-19 10:26:36 -0800 | [diff] [blame] | 153 | "libdexfile", |
Colin Cross | da9bd59 | 2016-12-14 17:24:46 -0800 | [diff] [blame] | 154 | "libbase", |
| 155 | "libcutils", |
| 156 | "liblog", |
Christopher Ferris | 6f3981c | 2017-07-27 09:29:18 -0700 | [diff] [blame] | 157 | "libunwindstack", |
Colin Cross | da9bd59 | 2016-12-14 17:24:46 -0800 | [diff] [blame] | 158 | ], |
| 159 | |
| 160 | group_static_libs: true, |
| 161 | |
Colin Cross | da9bd59 | 2016-12-14 17:24:46 -0800 | [diff] [blame] | 162 | target: { |
| 163 | android: { |
| 164 | cflags: ["-DENABLE_PSS_TESTS"], |
| 165 | shared_libs: [ |
Colin Cross | da9bd59 | 2016-12-14 17:24:46 -0800 | [diff] [blame] | 166 | "libutils", |
| 167 | ], |
| 168 | }, |
Dan Willemsen | 4852933 | 2017-10-02 10:38:16 -0700 | [diff] [blame] | 169 | linux_glibc: { |
Colin Cross | da9bd59 | 2016-12-14 17:24:46 -0800 | [diff] [blame] | 170 | static_libs: ["libutils"], |
| 171 | }, |
| 172 | }, |
Christopher Ferris | 458cc66 | 2017-08-28 16:31:18 -0700 | [diff] [blame] | 173 | |
Christopher Ferris | 0b06a59 | 2018-01-19 10:26:36 -0800 | [diff] [blame] | 174 | // libdexfile will eventually properly export headers, for now |
| 175 | // include these directly. |
| 176 | include_dirs: [ |
| 177 | "art/runtime", |
| 178 | ], |
| 179 | |
Elliott Hughes | 40fdf3f | 2018-04-27 16:12:06 -0700 | [diff] [blame] | 180 | test_suites: ["device-tests"], |
Christopher Ferris | 458cc66 | 2017-08-28 16:31:18 -0700 | [diff] [blame] | 181 | data: [ |
| 182 | "testdata/arm/*", |
| 183 | "testdata/arm64/*", |
| 184 | "testdata/x86/*", |
| 185 | "testdata/x86_64/*", |
| 186 | ], |
Elliott Hughes | 03d183a | 2018-05-03 10:06:45 -0700 | [diff] [blame] | 187 | required: [ |
| 188 | "libbacktrace_test", |
| 189 | ], |
Colin Cross | da9bd59 | 2016-12-14 17:24:46 -0800 | [diff] [blame] | 190 | } |
Christopher Ferris | 60521c7 | 2017-08-18 15:10:53 -0700 | [diff] [blame] | 191 | |
| 192 | cc_benchmark { |
| 193 | name: "backtrace_benchmarks", |
| 194 | defaults: ["libbacktrace_common"], |
| 195 | |
| 196 | srcs: [ |
| 197 | "backtrace_benchmarks.cpp", |
Christopher Ferris | e328673 | 2017-12-07 17:41:18 -0800 | [diff] [blame] | 198 | "backtrace_read_benchmarks.cpp", |
Christopher Ferris | 60521c7 | 2017-08-18 15:10:53 -0700 | [diff] [blame] | 199 | ], |
| 200 | |
| 201 | shared_libs: [ |
| 202 | "libbacktrace", |
| 203 | "libbase", |
Josh Gao | b9670bb | 2017-10-25 15:12:24 -0700 | [diff] [blame] | 204 | "libunwindstack", |
Christopher Ferris | 60521c7 | 2017-08-18 15:10:53 -0700 | [diff] [blame] | 205 | ], |
| 206 | } |