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 | |
Colin Cross | da9bd59 | 2016-12-14 17:24:46 -0800 | [diff] [blame] | 25 | // The latest clang (r230699) does not allow SP/PC to be declared in inline asm lists. |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 26 | clang_cflags: ["-Wno-inline-asm"], |
| 27 | |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 28 | include_dirs: ["external/libunwind/include/tdep"], |
| 29 | |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 30 | |
| 31 | target: { |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 32 | darwin: { |
| 33 | enabled: false, |
| 34 | }, |
| 35 | }, |
| 36 | |
| 37 | multilib: { |
| 38 | lib32: { |
| 39 | suffix: "32", |
| 40 | }, |
| 41 | lib64: { |
| 42 | suffix: "64", |
| 43 | }, |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | libbacktrace_sources = [ |
| 48 | "Backtrace.cpp", |
| 49 | "BacktraceCurrent.cpp", |
| 50 | "BacktracePtrace.cpp", |
| 51 | "thread_utils.c", |
| 52 | "ThreadEntry.cpp", |
Christopher Ferris | 6f3981c | 2017-07-27 09:29:18 -0700 | [diff] [blame] | 53 | "UnwindStack.cpp", |
| 54 | "UnwindStackMap.cpp", |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 55 | ] |
| 56 | |
Vijay Venkatraman | 8f2c28d | 2017-04-11 11:22:43 -0700 | [diff] [blame] | 57 | cc_library_headers { |
| 58 | name: "libbacktrace_headers", |
Steven Moreland | 4ad9d51 | 2017-04-13 21:01:40 -0700 | [diff] [blame] | 59 | vendor_available: true, |
Vijay Venkatraman | 8f2c28d | 2017-04-11 11:22:43 -0700 | [diff] [blame] | 60 | export_include_dirs: ["include"], |
| 61 | } |
| 62 | |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 63 | cc_library { |
| 64 | name: "libbacktrace", |
Jiyong Park | b7d92c4 | 2017-08-23 13:25:21 +0900 | [diff] [blame] | 65 | vendor_available: false, |
Justin Yun | 9ca9245 | 2017-07-31 15:41:10 +0900 | [diff] [blame] | 66 | vndk: { |
| 67 | enabled: true, |
| 68 | support_system_process: true, |
| 69 | }, |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 70 | defaults: ["libbacktrace_common"], |
| 71 | host_supported: true, |
| 72 | |
Josh Gao | e22701e | 2017-10-23 14:25:08 -0700 | [diff] [blame] | 73 | cflags: [ |
| 74 | "-Wexit-time-destructors", |
| 75 | ], |
| 76 | |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 77 | srcs: [ |
| 78 | "BacktraceMap.cpp", |
| 79 | ], |
| 80 | |
Vijay Venkatraman | 8f2c28d | 2017-04-11 11:22:43 -0700 | [diff] [blame] | 81 | export_include_dirs: ["include"], |
| 82 | |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 83 | target: { |
| 84 | darwin: { |
| 85 | enabled: true, |
| 86 | }, |
Dan Willemsen | bdddcab | 2017-10-03 14:17:31 -0700 | [diff] [blame] | 87 | linux: { |
Dan Willemsen | e0cd1e0 | 2017-03-15 15:23:36 -0700 | [diff] [blame] | 88 | srcs: libbacktrace_sources, |
| 89 | |
| 90 | shared_libs: [ |
| 91 | "libbase", |
| 92 | "liblog", |
| 93 | "libunwind", |
Christopher Ferris | 6f3981c | 2017-07-27 09:29:18 -0700 | [diff] [blame] | 94 | "libunwindstack", |
Christopher Ferris | 0b06a59 | 2018-01-19 10:26:36 -0800 | [diff] [blame] | 95 | "libdexfile", |
Dan Willemsen | e0cd1e0 | 2017-03-15 15:23:36 -0700 | [diff] [blame] | 96 | ], |
| 97 | |
| 98 | static_libs: ["libcutils"], |
Christopher Ferris | 0b06a59 | 2018-01-19 10:26:36 -0800 | [diff] [blame] | 99 | |
| 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 Willemsen | e0cd1e0 | 2017-03-15 15:23:36 -0700 | [diff] [blame] | 107 | }, |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 108 | android: { |
Dan Willemsen | bdddcab | 2017-10-03 14:17:31 -0700 | [diff] [blame] | 109 | static_libs: ["libasync_safe"], |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 110 | }, |
Christopher Ferris | 0b06a59 | 2018-01-19 10:26:36 -0800 | [diff] [blame] | 111 | vendor: { |
Christopher Ferris | d70ea5e | 2018-01-30 19:47:24 -0800 | [diff] [blame^] | 112 | cflags: ["-DNO_LIBDEXFILE_SUPPORT"], |
Christopher Ferris | 0b06a59 | 2018-01-19 10:26:36 -0800 | [diff] [blame] | 113 | exclude_shared_libs: ["libdexfile"], |
Christopher Ferris | d70ea5e | 2018-01-30 19:47:24 -0800 | [diff] [blame^] | 114 | } |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 115 | }, |
Christopher Ferris | 7d0aea9 | 2017-06-01 14:15:09 -0700 | [diff] [blame] | 116 | whole_static_libs: ["libdemangle"], |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 117 | } |
| 118 | |
| 119 | cc_library_shared { |
| 120 | name: "libbacktrace_test", |
| 121 | defaults: ["libbacktrace_common"], |
| 122 | host_supported: true, |
| 123 | strip: { |
| 124 | none: true, |
| 125 | }, |
| 126 | cflags: ["-O0"], |
Christopher Ferris | 5ea2c1f | 2017-03-23 14:55:01 -0700 | [diff] [blame] | 127 | srcs: ["backtrace_testlib.cpp"], |
Yabin Cui | 5d991bc | 2016-11-15 17:47:09 -0800 | [diff] [blame] | 128 | |
Christopher Ferris | c8bec5a | 2017-12-11 17:44:33 -0800 | [diff] [blame] | 129 | shared_libs: [ |
| 130 | "libunwindstack", |
Colin Cross | da9bd59 | 2016-12-14 17:24:46 -0800 | [diff] [blame] | 131 | ], |
| 132 | } |
| 133 | |
| 134 | //------------------------------------------------------------------------- |
| 135 | // The backtrace_test executable. |
| 136 | //------------------------------------------------------------------------- |
| 137 | cc_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 Ferris | 0b06a59 | 2018-01-19 10:26:36 -0800 | [diff] [blame] | 157 | "libdexfile", |
Colin Cross | da9bd59 | 2016-12-14 17:24:46 -0800 | [diff] [blame] | 158 | "libbase", |
| 159 | "libcutils", |
| 160 | "liblog", |
Christopher Ferris | 6f3981c | 2017-07-27 09:29:18 -0700 | [diff] [blame] | 161 | "libunwindstack", |
Colin Cross | da9bd59 | 2016-12-14 17:24:46 -0800 | [diff] [blame] | 162 | ], |
| 163 | |
| 164 | group_static_libs: true, |
| 165 | |
Colin Cross | da9bd59 | 2016-12-14 17:24:46 -0800 | [diff] [blame] | 166 | target: { |
| 167 | android: { |
| 168 | cflags: ["-DENABLE_PSS_TESTS"], |
| 169 | shared_libs: [ |
Colin Cross | da9bd59 | 2016-12-14 17:24:46 -0800 | [diff] [blame] | 170 | "libutils", |
| 171 | ], |
| 172 | }, |
Dan Willemsen | 4852933 | 2017-10-02 10:38:16 -0700 | [diff] [blame] | 173 | linux_glibc: { |
Colin Cross | da9bd59 | 2016-12-14 17:24:46 -0800 | [diff] [blame] | 174 | static_libs: ["libutils"], |
| 175 | }, |
| 176 | }, |
Christopher Ferris | 458cc66 | 2017-08-28 16:31:18 -0700 | [diff] [blame] | 177 | |
Christopher Ferris | 0b06a59 | 2018-01-19 10:26:36 -0800 | [diff] [blame] | 178 | // libdexfile will eventually properly export headers, for now |
| 179 | // include these directly. |
| 180 | include_dirs: [ |
| 181 | "art/runtime", |
| 182 | ], |
| 183 | |
Christopher Ferris | 458cc66 | 2017-08-28 16:31:18 -0700 | [diff] [blame] | 184 | data: [ |
| 185 | "testdata/arm/*", |
| 186 | "testdata/arm64/*", |
| 187 | "testdata/x86/*", |
| 188 | "testdata/x86_64/*", |
| 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 | } |