| 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", | 
|  | 53 | "UnwindCurrent.cpp", | 
|  | 54 | "UnwindMap.cpp", | 
|  | 55 | "UnwindPtrace.cpp", | 
| Christopher Ferris | 6f3981c | 2017-07-27 09:29:18 -0700 | [diff] [blame] | 56 | "UnwindStack.cpp", | 
|  | 57 | "UnwindStackMap.cpp", | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 58 | ] | 
|  | 59 |  | 
| Vijay Venkatraman | 8f2c28d | 2017-04-11 11:22:43 -0700 | [diff] [blame] | 60 | cc_library_headers { | 
|  | 61 | name: "libbacktrace_headers", | 
| Steven Moreland | 4ad9d51 | 2017-04-13 21:01:40 -0700 | [diff] [blame] | 62 | vendor_available: true, | 
| Vijay Venkatraman | 8f2c28d | 2017-04-11 11:22:43 -0700 | [diff] [blame] | 63 | export_include_dirs: ["include"], | 
|  | 64 | } | 
|  | 65 |  | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 66 | cc_library { | 
|  | 67 | name: "libbacktrace", | 
| Jiyong Park | b7d92c4 | 2017-08-23 13:25:21 +0900 | [diff] [blame] | 68 | vendor_available: false, | 
| Justin Yun | 9ca9245 | 2017-07-31 15:41:10 +0900 | [diff] [blame] | 69 | vndk: { | 
|  | 70 | enabled: true, | 
|  | 71 | support_system_process: true, | 
|  | 72 | }, | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 73 | defaults: ["libbacktrace_common"], | 
|  | 74 | host_supported: true, | 
|  | 75 |  | 
| Josh Gao | e22701e | 2017-10-23 14:25:08 -0700 | [diff] [blame] | 76 | cflags: [ | 
|  | 77 | "-Wexit-time-destructors", | 
|  | 78 | ], | 
|  | 79 |  | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 80 | srcs: [ | 
|  | 81 | "BacktraceMap.cpp", | 
|  | 82 | ], | 
|  | 83 |  | 
| Vijay Venkatraman | 8f2c28d | 2017-04-11 11:22:43 -0700 | [diff] [blame] | 84 | export_include_dirs: ["include"], | 
|  | 85 |  | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 86 | target: { | 
|  | 87 | darwin: { | 
|  | 88 | enabled: true, | 
|  | 89 | }, | 
| Dan Willemsen | bdddcab | 2017-10-03 14:17:31 -0700 | [diff] [blame] | 90 | linux: { | 
| Dan Willemsen | e0cd1e0 | 2017-03-15 15:23:36 -0700 | [diff] [blame] | 91 | srcs: libbacktrace_sources, | 
|  | 92 |  | 
|  | 93 | shared_libs: [ | 
|  | 94 | "libbase", | 
|  | 95 | "liblog", | 
|  | 96 | "libunwind", | 
| Christopher Ferris | 6f3981c | 2017-07-27 09:29:18 -0700 | [diff] [blame] | 97 | "libunwindstack", | 
| Dan Willemsen | e0cd1e0 | 2017-03-15 15:23:36 -0700 | [diff] [blame] | 98 | ], | 
|  | 99 |  | 
|  | 100 | static_libs: ["libcutils"], | 
|  | 101 | }, | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 102 | android: { | 
| Dan Willemsen | bdddcab | 2017-10-03 14:17:31 -0700 | [diff] [blame] | 103 | static_libs: ["libasync_safe"], | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 104 | }, | 
|  | 105 | }, | 
| Christopher Ferris | 7d0aea9 | 2017-06-01 14:15:09 -0700 | [diff] [blame] | 106 | whole_static_libs: ["libdemangle"], | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 107 | } | 
|  | 108 |  | 
|  | 109 | cc_library_shared { | 
|  | 110 | name: "libbacktrace_test", | 
|  | 111 | defaults: ["libbacktrace_common"], | 
|  | 112 | host_supported: true, | 
|  | 113 | strip: { | 
|  | 114 | none: true, | 
|  | 115 | }, | 
|  | 116 | cflags: ["-O0"], | 
| Christopher Ferris | 5ea2c1f | 2017-03-23 14:55:01 -0700 | [diff] [blame] | 117 | srcs: ["backtrace_testlib.cpp"], | 
| Yabin Cui | 5d991bc | 2016-11-15 17:47:09 -0800 | [diff] [blame] | 118 |  | 
|  | 119 | target: { | 
| Dan Willemsen | bdddcab | 2017-10-03 14:17:31 -0700 | [diff] [blame] | 120 | linux: { | 
| Yabin Cui | 5d991bc | 2016-11-15 17:47:09 -0800 | [diff] [blame] | 121 | shared_libs: [ | 
|  | 122 | "libunwind", | 
| Christopher Ferris | 6f3981c | 2017-07-27 09:29:18 -0700 | [diff] [blame] | 123 | "libunwindstack", | 
| Yabin Cui | 5d991bc | 2016-11-15 17:47:09 -0800 | [diff] [blame] | 124 | ], | 
|  | 125 | }, | 
|  | 126 | } | 
| Colin Cross | da9bd59 | 2016-12-14 17:24:46 -0800 | [diff] [blame] | 127 | } | 
|  | 128 |  | 
|  | 129 | //------------------------------------------------------------------------- | 
|  | 130 | // The libbacktrace_offline static library. | 
|  | 131 | //------------------------------------------------------------------------- | 
|  | 132 | cc_library_static { | 
|  | 133 | name: "libbacktrace_offline", | 
|  | 134 | defaults: ["libbacktrace_common"], | 
|  | 135 | host_supported: true, | 
|  | 136 | srcs: ["BacktraceOffline.cpp"], | 
|  | 137 |  | 
|  | 138 | cflags: [ | 
|  | 139 | "-D__STDC_CONSTANT_MACROS", | 
|  | 140 | "-D__STDC_LIMIT_MACROS", | 
|  | 141 | "-D__STDC_FORMAT_MACROS", | 
|  | 142 | ], | 
|  | 143 |  | 
|  | 144 | header_libs: ["llvm-headers"], | 
|  | 145 |  | 
|  | 146 | // Use shared libraries so their headers get included during build. | 
|  | 147 | shared_libs = [ | 
|  | 148 | "libbase", | 
|  | 149 | "libunwind", | 
| Christopher Ferris | 6f3981c | 2017-07-27 09:29:18 -0700 | [diff] [blame] | 150 | "libunwindstack", | 
| Andreas Gampe | 8f0947c | 2017-07-03 13:02:33 -0700 | [diff] [blame] | 151 | "libziparchive", | 
| Colin Cross | da9bd59 | 2016-12-14 17:24:46 -0800 | [diff] [blame] | 152 | ], | 
|  | 153 | } | 
|  | 154 |  | 
|  | 155 | //------------------------------------------------------------------------- | 
|  | 156 | // The backtrace_test executable. | 
|  | 157 | //------------------------------------------------------------------------- | 
|  | 158 | cc_test { | 
|  | 159 | name: "backtrace_test", | 
|  | 160 | defaults: ["libbacktrace_common"], | 
|  | 161 | host_supported: true, | 
|  | 162 | srcs: [ | 
|  | 163 | "backtrace_offline_test.cpp", | 
|  | 164 | "backtrace_test.cpp", | 
|  | 165 | "GetPss.cpp", | 
|  | 166 | "thread_utils.c", | 
|  | 167 | ], | 
|  | 168 |  | 
|  | 169 | cflags: [ | 
|  | 170 | "-fno-builtin", | 
|  | 171 | "-O0", | 
|  | 172 | "-g", | 
|  | 173 | ], | 
|  | 174 |  | 
|  | 175 | shared_libs: [ | 
|  | 176 | "libbacktrace_test", | 
|  | 177 | "libbacktrace", | 
|  | 178 | "libbase", | 
|  | 179 | "libcutils", | 
|  | 180 | "liblog", | 
|  | 181 | "libunwind", | 
| Christopher Ferris | 6f3981c | 2017-07-27 09:29:18 -0700 | [diff] [blame] | 182 | "libunwindstack", | 
| Colin Cross | da9bd59 | 2016-12-14 17:24:46 -0800 | [diff] [blame] | 183 | ], | 
|  | 184 |  | 
|  | 185 | group_static_libs: true, | 
|  | 186 |  | 
|  | 187 | // Statically link LLVMlibraries to remove dependency on llvm shared library. | 
|  | 188 | static_libs = [ | 
|  | 189 | "libbacktrace_offline", | 
|  | 190 | "libLLVMObject", | 
|  | 191 | "libLLVMBitReader", | 
|  | 192 | "libLLVMMC", | 
|  | 193 | "libLLVMMCParser", | 
|  | 194 | "libLLVMCore", | 
|  | 195 | "libLLVMSupport", | 
|  | 196 |  | 
|  | 197 | "libziparchive", | 
|  | 198 | "libz", | 
|  | 199 | ], | 
|  | 200 |  | 
|  | 201 | header_libs: ["llvm-headers"], | 
|  | 202 |  | 
|  | 203 | target: { | 
|  | 204 | android: { | 
|  | 205 | cflags: ["-DENABLE_PSS_TESTS"], | 
|  | 206 | shared_libs: [ | 
| Colin Cross | da9bd59 | 2016-12-14 17:24:46 -0800 | [diff] [blame] | 207 | "libutils", | 
|  | 208 | ], | 
|  | 209 | }, | 
| Dan Willemsen | 4852933 | 2017-10-02 10:38:16 -0700 | [diff] [blame] | 210 | linux_glibc: { | 
| Colin Cross | da9bd59 | 2016-12-14 17:24:46 -0800 | [diff] [blame] | 211 | host_ldlibs: [ | 
| Colin Cross | da9bd59 | 2016-12-14 17:24:46 -0800 | [diff] [blame] | 212 | "-lncurses", | 
|  | 213 | ], | 
|  | 214 | static_libs: ["libutils"], | 
|  | 215 | }, | 
|  | 216 | }, | 
| Christopher Ferris | 458cc66 | 2017-08-28 16:31:18 -0700 | [diff] [blame] | 217 |  | 
|  | 218 | data: [ | 
|  | 219 | "testdata/arm/*", | 
|  | 220 | "testdata/arm64/*", | 
|  | 221 | "testdata/x86/*", | 
|  | 222 | "testdata/x86_64/*", | 
|  | 223 | ], | 
| Colin Cross | da9bd59 | 2016-12-14 17:24:46 -0800 | [diff] [blame] | 224 | } | 
| Christopher Ferris | 60521c7 | 2017-08-18 15:10:53 -0700 | [diff] [blame] | 225 |  | 
|  | 226 | cc_benchmark { | 
|  | 227 | name: "backtrace_benchmarks", | 
|  | 228 | defaults: ["libbacktrace_common"], | 
|  | 229 |  | 
|  | 230 | srcs: [ | 
|  | 231 | "backtrace_benchmarks.cpp", | 
| Christopher Ferris | e328673 | 2017-12-07 17:41:18 -0800 | [diff] [blame] | 232 | "backtrace_read_benchmarks.cpp", | 
| Christopher Ferris | 60521c7 | 2017-08-18 15:10:53 -0700 | [diff] [blame] | 233 | ], | 
|  | 234 |  | 
|  | 235 | shared_libs: [ | 
|  | 236 | "libbacktrace", | 
|  | 237 | "libbase", | 
| Josh Gao | b9670bb | 2017-10-25 15:12:24 -0700 | [diff] [blame] | 238 | "libunwindstack", | 
| Christopher Ferris | 60521c7 | 2017-08-18 15:10:53 -0700 | [diff] [blame] | 239 | ], | 
|  | 240 | } |