Android.mk revision 49b79e7c8bb91c98ff5a9190f6cd0bb0f70a26cf
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# Sanity check. We can only build for ARM for now.
49ifneq (,$(filter-out armeabi armeabi-v7a x86,$(TARGET_ARCH_ABI)))
50$(error Sorry, Google Breakpad only works on Android ARM and x86 for now!)
51endif
52
53# The top Google Breakpad directory.
54# We assume this Android.mk to be under 'android/google_breakpad'
55
56LOCAL_PATH := $(call my-dir)/../..
57
58# Defube the client library module, as a simple static library that
59# exports the right include path / linker flags to its users.
60
61include $(CLEAR_VARS)
62
63LOCAL_MODULE := breakpad_client
64
65LOCAL_CPP_EXTENSION := .cc
66
67# Breakpad uses inline ARM assembly that requires the library
68# to be built in ARM mode. Otherwise, the build will fail with
69# cryptic assembler messages like:
70#   Compile++ thumb  : google_breakpad_client <= crash_generation_client.cc
71#   /tmp/cc8aMSoD.s: Assembler messages:
72#   /tmp/cc8aMSoD.s:132: Error: invalid immediate: 288 is out of range
73#   /tmp/cc8aMSoD.s:244: Error: invalid immediate: 296 is out of range
74LOCAL_ARM_MODE := arm
75
76# List of client source files, directly taken from Makefile.am
77LOCAL_SRC_FILES := \
78    src/client/linux/crash_generation/crash_generation_client.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/minidump_writer/linux_dumper.cc \
83    src/client/linux/minidump_writer/linux_ptrace_dumper.cc \
84    src/client/linux/minidump_writer/minidump_writer.cc \
85    src/client/minidump_file_writer.cc \
86    src/common/convert_UTF.c \
87    src/common/md5.cc src/common/string_conversion.cc \
88    src/common/linux/elfutils.cc \
89    src/common/linux/file_id.cc \
90    src/common/linux/guid_creator.cc \
91    src/common/linux/linux_libc_support.cc \
92    src/common/linux/memory_mapped_file.cc \
93    src/common/linux/safe_readlink.cc
94
95LOCAL_C_INCLUDES        := $(LOCAL_PATH)/src
96LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)
97LOCAL_EXPORT_LDLIBS     := -llog
98
99include $(BUILD_STATIC_LIBRARY)
100
101# Done.