Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 1 | // |
| 2 | // Copyright (C) 2017 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: "libunwindstack_flags", |
| 19 | |
| 20 | host_supported: true, |
| 21 | |
| 22 | cflags: [ |
| 23 | "-Wall", |
| 24 | "-Werror", |
| 25 | "-Wextra", |
| 26 | ], |
Christopher Ferris | 01d5037 | 2017-01-30 13:45:16 -0800 | [diff] [blame] | 27 | |
| 28 | target: { |
| 29 | darwin: { |
| 30 | enabled: false, |
| 31 | }, |
| 32 | }, |
Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 33 | |
Christopher Ferris | 3517fe0 | 2017-07-11 15:06:19 -0700 | [diff] [blame^] | 34 | arch: { |
| 35 | mips: { |
| 36 | enabled: false, |
| 37 | }, |
| 38 | mips64: { |
| 39 | enabled: false, |
| 40 | }, |
| 41 | }, |
| 42 | |
Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 43 | multilib: { |
| 44 | lib32: { |
| 45 | suffix: "32", |
| 46 | }, |
| 47 | lib64: { |
| 48 | suffix: "64", |
| 49 | }, |
| 50 | }, |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 51 | } |
| 52 | |
| 53 | cc_defaults { |
| 54 | name: "libunwindstack_common", |
| 55 | defaults: ["libunwindstack_flags"], |
| 56 | |
| 57 | srcs: [ |
| 58 | "ArmExidx.cpp", |
Christopher Ferris | 8642fcb | 2017-04-24 11:14:39 -0700 | [diff] [blame] | 59 | "DwarfCfa.cpp", |
Christopher Ferris | 61d4097 | 2017-06-12 19:14:20 -0700 | [diff] [blame] | 60 | "DwarfDebugFrame.cpp", |
| 61 | "DwarfEhFrame.cpp", |
Christopher Ferris | 72a6fa6 | 2017-03-21 12:41:17 -0700 | [diff] [blame] | 62 | "DwarfMemory.cpp", |
Christopher Ferris | 55d22ef | 2017-04-04 10:41:31 -0700 | [diff] [blame] | 63 | "DwarfOp.cpp", |
Christopher Ferris | 53a3c9b | 2017-05-10 18:34:15 -0700 | [diff] [blame] | 64 | "DwarfSection.cpp", |
Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 65 | "Elf.cpp", |
| 66 | "ElfInterface.cpp", |
| 67 | "ElfInterfaceArm.cpp", |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 68 | "Log.cpp", |
Christopher Ferris | 0d7cf3e | 2017-04-19 15:42:19 -0700 | [diff] [blame] | 69 | "MapInfo.cpp", |
Christopher Ferris | 09385e7 | 2017-04-05 13:25:04 -0700 | [diff] [blame] | 70 | "Maps.cpp", |
Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 71 | "Memory.cpp", |
Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 72 | "Regs.cpp", |
Christopher Ferris | e7ba4cc | 2017-04-04 14:06:58 -0700 | [diff] [blame] | 73 | "Symbols.cpp", |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 74 | ], |
| 75 | |
Christopher Ferris | 2a25c4a | 2017-07-07 16:35:48 -0700 | [diff] [blame] | 76 | arch: { |
| 77 | x86: { |
| 78 | srcs: ["AsmGetRegsX86.S"], |
| 79 | }, |
| 80 | x86_64: { |
| 81 | srcs: ["AsmGetRegsX86_64.S"], |
| 82 | }, |
| 83 | }, |
| 84 | |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 85 | shared_libs: [ |
| 86 | "libbase", |
| 87 | "liblog", |
Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 88 | "liblzma", |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 89 | ], |
| 90 | } |
| 91 | |
| 92 | cc_library { |
| 93 | name: "libunwindstack", |
| 94 | defaults: ["libunwindstack_common"], |
| 95 | } |
| 96 | |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 97 | //------------------------------------------------------------------------- |
| 98 | // Unit Tests |
| 99 | //------------------------------------------------------------------------- |
| 100 | cc_defaults { |
| 101 | name: "libunwindstack_test_common", |
| 102 | defaults: ["libunwindstack_flags"], |
| 103 | |
| 104 | srcs: [ |
| 105 | "tests/ArmExidxDecodeTest.cpp", |
| 106 | "tests/ArmExidxExtractTest.cpp", |
Christopher Ferris | 8642fcb | 2017-04-24 11:14:39 -0700 | [diff] [blame] | 107 | "tests/DwarfCfaLogTest.cpp", |
| 108 | "tests/DwarfCfaTest.cpp", |
Christopher Ferris | 61d4097 | 2017-06-12 19:14:20 -0700 | [diff] [blame] | 109 | "tests/DwarfDebugFrameTest.cpp", |
| 110 | "tests/DwarfEhFrameTest.cpp", |
Christopher Ferris | 72a6fa6 | 2017-03-21 12:41:17 -0700 | [diff] [blame] | 111 | "tests/DwarfMemoryTest.cpp", |
Christopher Ferris | 55d22ef | 2017-04-04 10:41:31 -0700 | [diff] [blame] | 112 | "tests/DwarfOpLogTest.cpp", |
| 113 | "tests/DwarfOpTest.cpp", |
Christopher Ferris | 53a3c9b | 2017-05-10 18:34:15 -0700 | [diff] [blame] | 114 | "tests/DwarfSectionTest.cpp", |
| 115 | "tests/DwarfSectionImplTest.cpp", |
Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 116 | "tests/ElfInterfaceArmTest.cpp", |
| 117 | "tests/ElfInterfaceTest.cpp", |
| 118 | "tests/ElfTest.cpp", |
Christopher Ferris | 570b76f | 2017-06-30 17:18:16 -0700 | [diff] [blame] | 119 | "tests/ElfTestUtils.cpp", |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 120 | "tests/LogFake.cpp", |
Christopher Ferris | 570b76f | 2017-06-30 17:18:16 -0700 | [diff] [blame] | 121 | "tests/MapInfoCreateMemoryTest.cpp", |
| 122 | "tests/MapInfoGetElfTest.cpp", |
Christopher Ferris | 09385e7 | 2017-04-05 13:25:04 -0700 | [diff] [blame] | 123 | "tests/MapsTest.cpp", |
Christopher Ferris | 9744fb2 | 2017-07-07 12:18:16 -0700 | [diff] [blame] | 124 | "tests/MemoryBuffer.cpp", |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 125 | "tests/MemoryFake.cpp", |
| 126 | "tests/MemoryFileTest.cpp", |
| 127 | "tests/MemoryLocalTest.cpp", |
| 128 | "tests/MemoryRangeTest.cpp", |
| 129 | "tests/MemoryRemoteTest.cpp", |
Christopher Ferris | 9744fb2 | 2017-07-07 12:18:16 -0700 | [diff] [blame] | 130 | "tests/MemoryTest.cpp", |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 131 | "tests/RegsTest.cpp", |
Christopher Ferris | e7ba4cc | 2017-04-04 14:06:58 -0700 | [diff] [blame] | 132 | "tests/SymbolsTest.cpp", |
Christopher Ferris | 2a25c4a | 2017-07-07 16:35:48 -0700 | [diff] [blame] | 133 | "tests/UnwindTest.cpp", |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 134 | ], |
| 135 | |
| 136 | cflags: [ |
| 137 | "-O0", |
| 138 | "-g", |
| 139 | ], |
| 140 | |
| 141 | shared_libs: [ |
| 142 | "libbase", |
| 143 | "liblog", |
Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 144 | "liblzma", |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 145 | ], |
| 146 | |
Christopher Ferris | 53a3c9b | 2017-05-10 18:34:15 -0700 | [diff] [blame] | 147 | static_libs: [ |
| 148 | "libgmock", |
| 149 | ], |
| 150 | |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 151 | target: { |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 152 | linux: { |
| 153 | host_ldlibs: [ |
| 154 | "-lrt", |
| 155 | ], |
| 156 | }, |
| 157 | }, |
| 158 | } |
| 159 | |
| 160 | // These unit tests run against the shared library. |
| 161 | cc_test { |
| 162 | name: "libunwindstack_test", |
| 163 | defaults: ["libunwindstack_test_common"], |
| 164 | |
| 165 | shared_libs: [ |
| 166 | "libunwindstack", |
| 167 | ], |
Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 168 | |
| 169 | data: [ |
Christopher Ferris | 570b76f | 2017-06-30 17:18:16 -0700 | [diff] [blame] | 170 | "tests/files/elf32.xz", |
| 171 | "tests/files/elf64.xz", |
Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 172 | ], |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 173 | } |
| 174 | |
Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 175 | //------------------------------------------------------------------------- |
| 176 | // Utility Executables |
| 177 | //------------------------------------------------------------------------- |
| 178 | cc_defaults { |
| 179 | name: "libunwindstack_executables", |
| 180 | defaults: ["libunwindstack_flags"], |
| 181 | |
| 182 | shared_libs: [ |
| 183 | "libunwindstack", |
| 184 | "libbase", |
Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 185 | "liblzma", |
Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 186 | ], |
| 187 | |
| 188 | static_libs: [ |
| 189 | "liblog", |
| 190 | ], |
| 191 | |
| 192 | compile_multilib: "both", |
| 193 | } |
| 194 | |
| 195 | cc_binary { |
| 196 | name: "unwind_info", |
| 197 | defaults: ["libunwindstack_executables"], |
| 198 | |
| 199 | srcs: [ |
| 200 | "unwind_info.cpp", |
| 201 | ], |
| 202 | } |
Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 203 | |
| 204 | // Generates the elf data for use in the tests for .gnu_debugdata frames. |
| 205 | // Once these files are generated, use the xz command to compress the data. |
| 206 | cc_binary_host { |
| 207 | name: "gen_gnudebugdata", |
| 208 | |
| 209 | cflags: [ |
| 210 | "-Wall", |
| 211 | "-Werror", |
| 212 | "-Wextra", |
| 213 | ], |
| 214 | |
| 215 | srcs: [ |
| 216 | "tests/GenGnuDebugdata.cpp", |
| 217 | ], |
Christopher Ferris | bfd6292 | 2017-06-28 20:44:48 -0700 | [diff] [blame] | 218 | |
| 219 | target: { |
| 220 | darwin: { |
| 221 | enabled: false, |
| 222 | }, |
| 223 | }, |
Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 224 | } |