Home | History | Annotate | Download | only in libbacktrace
      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 
     25     // The latest clang (r230699) does not allow SP/PC to be declared in inline asm lists.
     26     clang_cflags: ["-Wno-inline-asm"],
     27 
     28     include_dirs: ["external/libunwind/include/tdep"],
     29 
     30     target: {
     31         darwin: {
     32             enabled: false,
     33         },
     34     },
     35 
     36     multilib: {
     37         lib32: {
     38             suffix: "32",
     39         },
     40         lib64: {
     41             suffix: "64",
     42         },
     43     },
     44 }
     45 
     46 libbacktrace_sources = [
     47     "Backtrace.cpp",
     48     "BacktraceCurrent.cpp",
     49     "BacktracePtrace.cpp",
     50     "thread_utils.c",
     51     "ThreadEntry.cpp",
     52     "UnwindStack.cpp",
     53     "UnwindStackMap.cpp",
     54 ]
     55 
     56 cc_library_headers {
     57     name: "libbacktrace_headers",
     58     vendor_available: true,
     59     export_include_dirs: ["include"],
     60 }
     61 
     62 cc_library {
     63     name: "libbacktrace",
     64     vendor_available: false,
     65     vndk: {
     66         enabled: true,
     67         support_system_process: true,
     68     },
     69     defaults: ["libbacktrace_common"],
     70     host_supported: true,
     71 
     72     cflags: [
     73         "-Wexit-time-destructors",
     74     ],
     75 
     76     srcs: [
     77         "BacktraceMap.cpp",
     78     ],
     79 
     80     export_include_dirs: ["include"],
     81 
     82     target: {
     83         darwin: {
     84             enabled: true,
     85             shared_libs: [
     86                 "libbase",
     87             ],
     88         },
     89         linux: {
     90             srcs: libbacktrace_sources,
     91 
     92             shared_libs: [
     93                 "libbase",
     94                 "liblog",
     95                 "libunwind",
     96                 "libunwindstack",
     97                 "libdexfile",
     98             ],
     99 
    100             static_libs: ["libcutils"],
    101 
    102             // libdexfile will eventually properly export headers, for now
    103             // include these directly.
    104             include_dirs: [
    105                 "art/runtime",
    106             ],
    107 
    108             header_libs: ["jni_headers"],
    109         },
    110         android: {
    111             static_libs: ["libasync_safe"],
    112         },
    113         vendor: {
    114             cflags: ["-DNO_LIBDEXFILE_SUPPORT"],
    115             exclude_shared_libs: ["libdexfile"],
    116         },
    117     },
    118     whole_static_libs: ["libdemangle"],
    119 }
    120 
    121 cc_library_shared {
    122     name: "libbacktrace_test",
    123     defaults: ["libbacktrace_common"],
    124     host_supported: true,
    125     strip: {
    126         none: true,
    127     },
    128     cflags: ["-O0"],
    129     srcs: ["backtrace_testlib.cpp"],
    130 
    131     shared_libs: [
    132         "libunwindstack",
    133     ],
    134 }
    135 
    136 //-------------------------------------------------------------------------
    137 // The backtrace_test executable.
    138 //-------------------------------------------------------------------------
    139 cc_test {
    140     name: "backtrace_test",
    141     defaults: ["libbacktrace_common"],
    142     host_supported: true,
    143     srcs: [
    144         "backtrace_offline_test.cpp",
    145         "backtrace_test.cpp",
    146         "GetPss.cpp",
    147         "thread_utils.c",
    148     ],
    149 
    150     cflags: [
    151         "-fno-builtin",
    152         "-O0",
    153         "-g",
    154     ],
    155 
    156     shared_libs: [
    157         "libbacktrace_test",
    158         "libbacktrace",
    159         "libdexfile",
    160         "libbase",
    161         "libcutils",
    162         "liblog",
    163         "libunwindstack",
    164     ],
    165 
    166     group_static_libs: true,
    167 
    168     target: {
    169         android: {
    170             cflags: ["-DENABLE_PSS_TESTS"],
    171             shared_libs: [
    172                 "libutils",
    173             ],
    174         },
    175         linux_glibc: {
    176             static_libs: ["libutils"],
    177         },
    178     },
    179 
    180     // libdexfile will eventually properly export headers, for now
    181     // include these directly.
    182     include_dirs: [
    183         "art/runtime",
    184     ],
    185 
    186     data: [
    187         "testdata/arm/*",
    188         "testdata/arm64/*",
    189         "testdata/x86/*",
    190         "testdata/x86_64/*",
    191     ],
    192 }
    193 
    194 cc_benchmark {
    195     name: "backtrace_benchmarks",
    196     defaults: ["libbacktrace_common"],
    197 
    198     srcs: [
    199         "backtrace_benchmarks.cpp",
    200         "backtrace_read_benchmarks.cpp",
    201     ],
    202 
    203     shared_libs: [
    204         "libbacktrace",
    205         "libbase",
    206         "libunwindstack",
    207     ],
    208 }
    209