blob: 893128da67ea46463d5f84593461971867af7516 [file] [log] [blame]
//
// Copyright (C) 2014 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
libbacktrace_common_cflags = [
"-Wall",
"-Werror",
]
libbacktrace_common_conlyflags = ["-std=gnu99"]
libbacktrace_common_cppflags = ["-std=gnu++11"]
// The latest clang (r230699) does not allow SP/PC to be declared in inline asm lists.
ibbacktrace_common_clang_cflags = ["-Wno-inline-asm"]
build_host = ["false"]
// ANDROIDMK TRANSLATION ERROR: unsupported conditional
// ifeq ($(HOST_OS),linux)
// ANDROIDMK TRANSLATION ERROR: unsupported conditional
// ifeq ($(HOST_ARCH),$(filter $(HOST_ARCH),x86 x86_64))
//build_host = ["true"]
// ANDROIDMK TRANSLATION ERROR: endif from unsupported contitional
// endif
// ANDROIDMK TRANSLATION ERROR: endif from unsupported contitional
// endif
//-------------------------------------------------------------------------
// The libbacktrace library.
//-------------------------------------------------------------------------
libbacktrace_src_files = [
"Backtrace.cpp",
"BacktraceCurrent.cpp",
"BacktraceMap.cpp",
"BacktracePtrace.cpp",
"thread_utils.c",
"ThreadEntry.cpp",
"UnwindCurrent.cpp",
"UnwindMap.cpp",
"UnwindPtrace.cpp",
]
cc_library_shared {
name: "libbacktrace",
host_supported: true,
cflags: libbacktrace_common_cflags,
conlyflags: libbacktrace_common_conlyflags,
cppflags: libbacktrace_common_cppflags,
target: {
android: {
srcs: libbacktrace_src_files,
shared_libs: [
"libbase",
"libunwind",
"libcutils",
],
},
linux: {
srcs: libbacktrace_src_files,
shared_libs: [
"libbase",
"libunwind",
],
static_libs: ["libcutils"],
host_ldlibs: [
"-lpthread",
"-lrt",
],
},
// Special truncated libbacktrace library for mac.
darwin: {
srcs: ["BacktraceMap.cpp"],
},
host: {
cflags: [
"-Wno-extern-c-compat",
"-fno-omit-frame-pointer",
],
},
},
}
//-------------------------------------------------------------------------
// The libbacktrace_test library needed by backtrace_test.
//-------------------------------------------------------------------------
cc_library_shared {
host_supported: true,
name: "libbacktrace_test",
srcs: ["backtrace_testlib.c"],
cflags: libbacktrace_common_cflags,
conlyflags: libbacktrace_common_conlyflags,
cppflags: libbacktrace_common_cppflags,
target: {
host: {
cflags: [
"-Wno-extern-c-compat",
"-fno-omit-frame-pointer",
],
},
darwin: {
disabled: true,
},
},
}
//-------------------------------------------------------------------------
// The backtrace_test executable.
//-------------------------------------------------------------------------
cc_test {
name: "backtrace_test",
host_supported: true,
cflags: [
"-fno-builtin",
"-O0",
"-g",
],
compile_multilib: "both",
target: {
android: {
cflags: ["-DENABLE_PSS_TESTS"],
shared_libs: [
"libcutils",
],
},
host: {
host_ldlibs: [
"-lpthread",
"-lrt",
],
static_libs: [
"libcutils",
],
cflags: [
"-Wno-extern-c-compat",
"-fno-omit-frame-pointer",
],
},
darwin: {
disabled: true,
},
},
srcs: [
"backtrace_test.cpp",
"GetPss.cpp",
"thread_utils.c",
],
shared_libs: [
"libbacktrace_test",
"libbacktrace",
],
tags: ["debug"]
}