| 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 | ], | 
|  | 24 | conlyflags: ["-std=gnu99"], | 
|  | 25 | cppflags: ["-std=gnu++11"], | 
|  | 26 |  | 
|  | 27 | clang_cflags: ["-Wno-inline-asm"], | 
|  | 28 |  | 
|  | 29 | // The latest clang (r230699) does not allow SP/PC to be declared in inline asm lists. | 
|  | 30 | include_dirs: ["external/libunwind/include/tdep"], | 
|  | 31 |  | 
|  | 32 | // TODO: LLVM_DEVICE_BUILD_MK | 
|  | 33 | // TODO: LLVM_HOST_BUILD_MK | 
|  | 34 |  | 
|  | 35 | target: { | 
|  | 36 | host: { | 
|  | 37 | // -fno-omit-frame-pointer should be set for host build. Because currently | 
|  | 38 | // libunwind can't recognize .debug_frame using dwarf version 4, and it relies | 
|  | 39 | // on stack frame pointer to do unwinding on x86. | 
|  | 40 | // $(LLVM_HOST_BUILD_MK) overwrites -fno-omit-frame-pointer. so the below line | 
|  | 41 | // must be after the include. | 
|  | 42 | cflags: [ | 
|  | 43 | "-Wno-extern-c-compat", | 
|  | 44 | "-fno-omit-frame-pointer", | 
|  | 45 | ], | 
|  | 46 | }, | 
|  | 47 |  | 
|  | 48 | darwin: { | 
|  | 49 | enabled: false, | 
|  | 50 | }, | 
|  | 51 | }, | 
|  | 52 |  | 
|  | 53 | multilib: { | 
|  | 54 | lib32: { | 
|  | 55 | suffix: "32", | 
|  | 56 | }, | 
|  | 57 | lib64: { | 
|  | 58 | suffix: "64", | 
|  | 59 | }, | 
|  | 60 | } | 
|  | 61 | } | 
|  | 62 |  | 
|  | 63 | libbacktrace_sources = [ | 
|  | 64 | "Backtrace.cpp", | 
|  | 65 | "BacktraceCurrent.cpp", | 
|  | 66 | "BacktracePtrace.cpp", | 
|  | 67 | "thread_utils.c", | 
|  | 68 | "ThreadEntry.cpp", | 
|  | 69 | "UnwindCurrent.cpp", | 
|  | 70 | "UnwindMap.cpp", | 
|  | 71 | "UnwindPtrace.cpp", | 
|  | 72 | ] | 
|  | 73 |  | 
|  | 74 | cc_library { | 
|  | 75 | name: "libbacktrace", | 
|  | 76 | defaults: ["libbacktrace_common"], | 
|  | 77 | host_supported: true, | 
|  | 78 |  | 
|  | 79 | srcs: [ | 
|  | 80 | "BacktraceMap.cpp", | 
|  | 81 | ], | 
|  | 82 |  | 
|  | 83 | target: { | 
|  | 84 | darwin: { | 
|  | 85 | enabled: true, | 
|  | 86 | }, | 
|  | 87 | linux: { | 
|  | 88 | srcs: libbacktrace_sources, | 
|  | 89 |  | 
|  | 90 | shared_libs: [ | 
|  | 91 | "libbase", | 
|  | 92 | "liblog", | 
|  | 93 | "libunwind", | 
|  | 94 | ], | 
|  | 95 |  | 
|  | 96 | static_libs: ["libcutils"], | 
|  | 97 | }, | 
|  | 98 | android: { | 
|  | 99 | srcs: libbacktrace_sources, | 
|  | 100 |  | 
|  | 101 | shared_libs: [ | 
|  | 102 | "libbase", | 
|  | 103 | "liblog", | 
|  | 104 | "libunwind", | 
|  | 105 | ], | 
|  | 106 |  | 
|  | 107 | static_libs: ["libcutils"], | 
|  | 108 | }, | 
|  | 109 | }, | 
|  | 110 | } | 
|  | 111 |  | 
|  | 112 | cc_library_shared { | 
|  | 113 | name: "libbacktrace_test", | 
|  | 114 | defaults: ["libbacktrace_common"], | 
|  | 115 | host_supported: true, | 
|  | 116 | strip: { | 
|  | 117 | none: true, | 
|  | 118 | }, | 
|  | 119 | cflags: ["-O0"], | 
|  | 120 | srcs: ["backtrace_testlib.c"], | 
|  | 121 | } |