Android.mk revision 688a8a7232ff1f1be1ab077072deadb6f4c71eef
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
17LOCAL_PATH:= $(call my-dir)
18
19common_cflags := \
20	-Wall \
21	-Werror \
22
23common_conlyflags := \
24	-std=gnu99 \
25
26common_cppflags := \
27	-std=gnu++11 \
28
29build_host := false
30ifeq ($(HOST_OS),linux)
31ifeq ($(HOST_ARCH),$(filter $(HOST_ARCH),x86 x86_64))
32build_host := true
33endif
34endif
35
36#-------------------------------------------------------------------------
37# The libbacktrace library.
38#-------------------------------------------------------------------------
39libbacktrace_src_files := \
40	BacktraceImpl.cpp \
41	BacktraceMap.cpp \
42	BacktraceThread.cpp \
43	thread_utils.c \
44
45libbacktrace_shared_libraries_target := \
46	libcutils \
47	libgccdemangle \
48
49libbacktrace_src_files += \
50	UnwindCurrent.cpp \
51	UnwindMap.cpp \
52	UnwindPtrace.cpp \
53
54libbacktrace_c_includes := \
55	external/libunwind/include \
56
57libbacktrace_shared_libraries := \
58	libunwind \
59	libunwind-ptrace \
60
61libbacktrace_shared_libraries_host := \
62	liblog \
63
64libbacktrace_static_libraries_host := \
65	libcutils \
66
67module := libbacktrace
68module_tag := optional
69build_type := target
70build_target := SHARED_LIBRARY
71include $(LOCAL_PATH)/Android.build.mk
72build_type := host
73include $(LOCAL_PATH)/Android.build.mk
74
75#-------------------------------------------------------------------------
76# The libbacktrace_test library needed by backtrace_test.
77#-------------------------------------------------------------------------
78libbacktrace_test_cflags := \
79	-O0 \
80
81libbacktrace_test_src_files := \
82	backtrace_testlib.c \
83
84module := libbacktrace_test
85module_tag := debug
86build_type := target
87build_target := SHARED_LIBRARY
88include $(LOCAL_PATH)/Android.build.mk
89build_type := host
90include $(LOCAL_PATH)/Android.build.mk
91
92#-------------------------------------------------------------------------
93# The backtrace_test executable.
94#-------------------------------------------------------------------------
95backtrace_test_cflags := \
96	-fno-builtin \
97	-O0 \
98	-g \
99	-DGTEST_HAS_STD_STRING \
100	-fstack-protector-all \
101
102backtrace_test_cflags_target := \
103	-DGTEST_OS_LINUX_ANDROID \
104	-DENABLE_PSS_TESTS \
105
106backtrace_test_src_files := \
107	backtrace_test.cpp \
108	GetPss.cpp \
109	thread_utils.c \
110
111backtrace_test_ldlibs := \
112	-lpthread \
113
114backtrace_test_ldlibs_host := \
115	-lrt \
116
117backtrace_test_shared_libraries := \
118	libbacktrace_test \
119	libbacktrace \
120
121backtrace_test_shared_libraries_target := \
122	libcutils \
123
124module := backtrace_test
125module_tag := debug
126build_type := target
127build_target := NATIVE_TEST
128include $(LOCAL_PATH)/Android.build.mk
129build_type := host
130include $(LOCAL_PATH)/Android.build.mk
131
132#----------------------------------------------------------------------------
133# Special truncated libbacktrace library for mac.
134#----------------------------------------------------------------------------
135ifeq ($(HOST_OS),darwin)
136
137include $(CLEAR_VARS)
138
139LOCAL_MODULE := libbacktrace
140LOCAL_MODULE_TAGS := optional
141
142LOCAL_SRC_FILES := \
143	BacktraceMap.cpp \
144
145include $(BUILD_HOST_SHARED_LIBRARY)
146
147endif # HOST_OS-darwin
148