1# Copyright (c) 2012, Google Inc.
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met:
7#
8#     * Redistributions of source code must retain the above copyright
9# notice, this list of conditions and the following disclaimer.
10#     * Redistributions in binary form must reproduce the above
11# copyright notice, this list of conditions and the following disclaimer
12# in the documentation and/or other materials provided with the
13# distribution.
14#     * Neither the name of Google Inc. nor the names of its
15# contributors may be used to endorse or promote products derived from
16# this software without specific prior written permission.
17#
18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
30# ndk-build module definition for the Google Breakpad client library
31#
32# To use this file, do the following:
33#
34#   1/ Include this file from your own Android.mk, either directly
35#      or with through the NDK's import-module function.
36#
37#   2/ Use the client static library in your project with:
38#
39#      LOCAL_STATIC_LIBRARIES += breakpad_client
40#
41#   3/ In your source code, include "src/client/linux/exception_handler.h"
42#      and use the Linux instructions to use it.
43#
44# This module works with either the STLport or GNU libstdc++, but you need
45# to select one in your Application.mk
46#
47
48# The top Google Breakpad directory.
49# We assume this Android.mk to be under 'android/google_breakpad'
50
51LOCAL_PATH := $(call my-dir)/../..
52
53# Defube the client library module, as a simple static library that
54# exports the right include path / linker flags to its users.
55
56include $(CLEAR_VARS)
57
58LOCAL_MODULE := breakpad_client
59LOCAL_LICENSE_KINDS := SPDX-license-identifier-BSD
60LOCAL_LICENSE_CONDITIONS := notice
61LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../LICENSE
62
63LOCAL_CPP_EXTENSION := .cc
64
65# Breakpad uses inline ARM assembly that requires the library
66# to be built in ARM mode. Otherwise, the build will fail with
67# cryptic assembler messages like:
68#   Compile++ thumb  : google_breakpad_client <= crash_generation_client.cc
69#   /tmp/cc8aMSoD.s: Assembler messages:
70#   /tmp/cc8aMSoD.s:132: Error: invalid immediate: 288 is out of range
71#   /tmp/cc8aMSoD.s:244: Error: invalid immediate: 296 is out of range
72LOCAL_ARM_MODE := arm
73
74# List of client source files, directly taken from Makefile.am
75LOCAL_SRC_FILES := \
76    src/client/linux/crash_generation/crash_generation_client.cc \
77    src/client/linux/dump_writer_common/thread_info.cc \
78    src/client/linux/dump_writer_common/ucontext_reader.cc \
79    src/client/linux/handler/exception_handler.cc \
80    src/client/linux/handler/minidump_descriptor.cc \
81    src/client/linux/log/log.cc \
82    src/client/linux/microdump_writer/microdump_writer.cc \
83    src/client/linux/minidump_writer/linux_dumper.cc \
84    src/client/linux/minidump_writer/linux_ptrace_dumper.cc \
85    src/client/linux/minidump_writer/minidump_writer.cc \
86    src/client/minidump_file_writer.cc \
87    src/common/convert_UTF.cc \
88    src/common/md5.cc \
89    src/common/string_conversion.cc \
90    src/common/linux/breakpad_getcontext.S \
91    src/common/linux/elfutils.cc \
92    src/common/linux/file_id.cc \
93    src/common/linux/guid_creator.cc \
94    src/common/linux/linux_libc_support.cc \
95    src/common/linux/memory_mapped_file.cc \
96    src/common/linux/safe_readlink.cc
97
98LOCAL_C_INCLUDES        := $(LOCAL_PATH)/src/common/android/include \
99                           $(LOCAL_PATH)/src \
100                           $(LSS_PATH)
101
102LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)
103LOCAL_EXPORT_LDLIBS     := -llog
104
105include $(BUILD_STATIC_LIBRARY)
106
107# Done.
108