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 17cc_defaults { 18 name: "libunwindstack_flags", 19 20 host_supported: true, 21 22 cflags: [ 23 "-Wall", 24 "-Werror", 25 "-Wextra", 26 ], 27 28 target: { 29 darwin: { 30 enabled: false, 31 }, 32 }, 33 34 multilib: { 35 lib32: { 36 suffix: "32", 37 }, 38 lib64: { 39 suffix: "64", 40 }, 41 }, 42} 43 44cc_defaults { 45 name: "libunwindstack_common", 46 defaults: ["libunwindstack_flags"], 47 48 srcs: [ 49 "ArmExidx.cpp", 50 "Elf.cpp", 51 "ElfInterface.cpp", 52 "ElfInterfaceArm.cpp", 53 "Log.cpp", 54 "Regs.cpp", 55 "Memory.cpp", 56 ], 57 58 shared_libs: [ 59 "libbase", 60 "liblog", 61 ], 62} 63 64cc_library { 65 name: "libunwindstack", 66 defaults: ["libunwindstack_common"], 67} 68 69cc_library { 70 name: "libunwindstack_debug", 71 defaults: ["libunwindstack_common"], 72 73 cflags: [ 74 "-UNDEBUG", 75 "-O0", 76 "-g", 77 ], 78} 79 80//------------------------------------------------------------------------- 81// Unit Tests 82//------------------------------------------------------------------------- 83cc_defaults { 84 name: "libunwindstack_test_common", 85 defaults: ["libunwindstack_flags"], 86 87 srcs: [ 88 "tests/ArmExidxDecodeTest.cpp", 89 "tests/ArmExidxExtractTest.cpp", 90 "tests/ElfInterfaceArmTest.cpp", 91 "tests/ElfInterfaceTest.cpp", 92 "tests/ElfTest.cpp", 93 "tests/LogFake.cpp", 94 "tests/MemoryFake.cpp", 95 "tests/MemoryFileTest.cpp", 96 "tests/MemoryLocalTest.cpp", 97 "tests/MemoryRangeTest.cpp", 98 "tests/MemoryRemoteTest.cpp", 99 "tests/RegsTest.cpp", 100 ], 101 102 cflags: [ 103 "-O0", 104 "-g", 105 ], 106 107 shared_libs: [ 108 "libbase", 109 "liblog", 110 ], 111 112 target: { 113 linux: { 114 host_ldlibs: [ 115 "-lrt", 116 ], 117 }, 118 }, 119} 120 121// These unit tests run against the shared library. 122cc_test { 123 name: "libunwindstack_test", 124 defaults: ["libunwindstack_test_common"], 125 126 shared_libs: [ 127 "libunwindstack", 128 ], 129} 130 131// These unit tests run against the static debug library. 132cc_test { 133 name: "libunwindstack_test_debug", 134 defaults: ["libunwindstack_test_common"], 135 136 static_libs: [ 137 "libunwindstack_debug", 138 ], 139} 140 141//------------------------------------------------------------------------- 142// Utility Executables 143//------------------------------------------------------------------------- 144cc_defaults { 145 name: "libunwindstack_executables", 146 defaults: ["libunwindstack_flags"], 147 148 shared_libs: [ 149 "libunwindstack", 150 "libbase", 151 ], 152 153 static_libs: [ 154 "liblog", 155 ], 156 157 compile_multilib: "both", 158} 159 160cc_binary { 161 name: "unwind_info", 162 defaults: ["libunwindstack_executables"], 163 164 srcs: [ 165 "unwind_info.cpp", 166 ], 167} 168