blob: 50354d0d6a1870bf3f044f3d94f21e950b3e1d25 [file] [log] [blame]
Christopher Ferris7fb22872013-09-27 12:43:15 -07001LOCAL_PATH:= $(call my-dir)
2
Christopher Ferris17e91d42013-10-21 13:30:52 -07003common_src := \
4 Backtrace.cpp \
5 BacktraceThread.cpp \
6 map_info.c \
7 thread_utils.c \
8
9common_cflags := \
10 -Wall \
11 -Wno-unused-parameter \
12 -Werror \
13
14common_conlyflags := \
15 -std=gnu99 \
16
17common_cppflags := \
18 -std=gnu++11 \
19
20common_shared_libs := \
21 libcutils \
22 libgccdemangle \
23 liblog \
24
25# To enable using libunwind on each arch, add it to the list below.
26ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),))
27
Christopher Ferris7fb22872013-09-27 12:43:15 -070028#----------------------------------------------------------------------------
Christopher Ferris17e91d42013-10-21 13:30:52 -070029# The native libbacktrace library with libunwind.
Christopher Ferris7fb22872013-09-27 12:43:15 -070030#----------------------------------------------------------------------------
31include $(CLEAR_VARS)
32
33LOCAL_SRC_FILES:= \
Christopher Ferris17e91d42013-10-21 13:30:52 -070034 $(common_src) \
35 UnwindCurrent.cpp \
36 UnwindPtrace.cpp \
Christopher Ferris7fb22872013-09-27 12:43:15 -070037
38LOCAL_CFLAGS := \
Christopher Ferris17e91d42013-10-21 13:30:52 -070039 $(common_cflags) \
40
41LOCAL_CONLYFLAGS += \
42 $(common_conlyflags) \
43
44LOCAL_CPPFLAGS += \
45 $(common_cppflags) \
Christopher Ferris7fb22872013-09-27 12:43:15 -070046
47LOCAL_MODULE := libbacktrace
48LOCAL_MODULE_TAGS := optional
49
Christopher Ferris7fb22872013-09-27 12:43:15 -070050LOCAL_C_INCLUDES := \
Christopher Ferris17e91d42013-10-21 13:30:52 -070051 $(common_c_includes) \
Christopher Ferris7fb22872013-09-27 12:43:15 -070052 external/libunwind/include \
53
Christopher Ferris17e91d42013-10-21 13:30:52 -070054LOCAL_SHARED_LIBRARIES := \
55 $(common_shared_libs) \
56 libunwind \
57 libunwind-ptrace \
58
59LOCAL_ADDITIONAL_DEPENDENCIES := \
60 $(LOCAL_PATH)/Android.mk
61
62include external/stlport/libstlport.mk
63
64include $(BUILD_SHARED_LIBRARY)
65
66else
Christopher Ferris7fb22872013-09-27 12:43:15 -070067
68#----------------------------------------------------------------------------
Christopher Ferris17e91d42013-10-21 13:30:52 -070069# The native libbacktrace library with libcorkscrew.
Christopher Ferris7fb22872013-09-27 12:43:15 -070070#----------------------------------------------------------------------------
71include $(CLEAR_VARS)
72
73LOCAL_SRC_FILES:= \
Christopher Ferris17e91d42013-10-21 13:30:52 -070074 $(common_src) \
75 Corkscrew.cpp \
Christopher Ferris7fb22872013-09-27 12:43:15 -070076
77LOCAL_CFLAGS := \
Christopher Ferris17e91d42013-10-21 13:30:52 -070078 $(common_cflags) \
79
80LOCAL_CONLYFLAGS += \
81 $(common_conlyflags) \
82
83LOCAL_CPPFLAGS += \
84 $(common_cppflags) \
Christopher Ferris7fb22872013-09-27 12:43:15 -070085
86LOCAL_MODULE := libbacktrace
87LOCAL_MODULE_TAGS := optional
88
Christopher Ferris17e91d42013-10-21 13:30:52 -070089LOCAL_C_INCLUDES := \
90 $(common_c_includes) \
91 system/core/libcorkscrew \
92
Christopher Ferris7fb22872013-09-27 12:43:15 -070093LOCAL_SHARED_LIBRARIES := \
Christopher Ferris17e91d42013-10-21 13:30:52 -070094 $(common_shared_libs) \
Christopher Ferris7fb22872013-09-27 12:43:15 -070095 libcorkscrew \
96 libdl \
Christopher Ferris17e91d42013-10-21 13:30:52 -070097
98LOCAL_ADDITIONAL_DEPENDENCIES := \
99 $(LOCAL_PATH)/Android.mk
100
101include external/stlport/libstlport.mk
Christopher Ferris7fb22872013-09-27 12:43:15 -0700102
103include $(BUILD_SHARED_LIBRARY)
104
Christopher Ferris17e91d42013-10-21 13:30:52 -0700105endif
106
Christopher Ferris7fb22872013-09-27 12:43:15 -0700107#----------------------------------------------------------------------------
Christopher Ferris7fb22872013-09-27 12:43:15 -0700108# libbacktrace test library, all optimizations turned off
109#----------------------------------------------------------------------------
110include $(CLEAR_VARS)
111
112LOCAL_MODULE := libbacktrace_test
113LOCAL_MODULE_FLAGS := debug
114
115LOCAL_SRC_FILES := \
116 backtrace_testlib.c
117
118LOCAL_CFLAGS += \
119 -std=gnu99 \
120 -O0 \
121
Christopher Ferris17e91d42013-10-21 13:30:52 -0700122LOCAL_ADDITIONAL_DEPENDENCIES := \
123 $(LOCAL_PATH)/Android.mk
124
Christopher Ferris7fb22872013-09-27 12:43:15 -0700125include $(BUILD_SHARED_LIBRARY)
126
127#----------------------------------------------------------------------------
128# libbacktrace test executable
129#----------------------------------------------------------------------------
130include $(CLEAR_VARS)
131
132LOCAL_MODULE := backtrace_test
133LOCAL_MODULE_FLAGS := debug
134
135LOCAL_SRC_FILES := \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700136 backtrace_test.cpp \
137 thread_utils.c \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700138
139LOCAL_CFLAGS += \
Christopher Ferris7f081ec2013-11-05 11:38:05 -0800140 $(common_cflags) \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700141 -fno-builtin \
142 -fstack-protector-all \
143 -O0 \
144 -g \
145 -DGTEST_OS_LINUX_ANDROID \
146 -DGTEST_HAS_STD_STRING \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700147
Christopher Ferris17e91d42013-10-21 13:30:52 -0700148LOCAL_CONLYFLAGS += \
149 $(common_conlyflags) \
150
151LOCAL_CPPFLAGS += \
152 $(common_cppflags) \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700153
154LOCAL_SHARED_LIBRARIES += \
155 libcutils \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700156 libbacktrace_test \
157 libbacktrace \
158
Christopher Ferris17e91d42013-10-21 13:30:52 -0700159LOCAL_LDLIBS := \
160 -lpthread \
161
162LOCAL_ADDITIONAL_DEPENDENCIES := \
163 $(LOCAL_PATH)/Android.mk
164
165include $(BUILD_NATIVE_TEST)
Christopher Ferris7fb22872013-09-27 12:43:15 -0700166
167#----------------------------------------------------------------------------
168# Only linux-x86 host versions of libbacktrace supported.
169#----------------------------------------------------------------------------
170ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86)
171
172#----------------------------------------------------------------------------
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -0700173# The host libbacktrace library using libcorkscrew
174#----------------------------------------------------------------------------
175include $(CLEAR_VARS)
176
177LOCAL_SRC_FILES += \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700178 $(common_src) \
179 Corkscrew.cpp \
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -0700180
181LOCAL_CFLAGS += \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700182 $(common_cflags) \
183
184LOCAL_CONLYFLAGS += \
185 $(common_conlyflags) \
186
187LOCAL_CPPFLAGS += \
188 $(common_cppflags) \
189
190LOCAL_C_INCLUDES := \
191 $(common_c_includes) \
192 system/core/libcorkscrew \
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -0700193
194LOCAL_SHARED_LIBRARIES := \
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -0700195 libgccdemangle \
196 liblog \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700197 libcorkscrew \
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -0700198
199LOCAL_LDLIBS += \
200 -ldl \
201 -lrt \
202
203LOCAL_MODULE := libbacktrace
204LOCAL_MODULE_TAGS := optional
205
Christopher Ferris17e91d42013-10-21 13:30:52 -0700206LOCAL_ADDITIONAL_DEPENDENCIES := \
207 $(LOCAL_PATH)/Android.mk
208
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -0700209include $(BUILD_HOST_SHARED_LIBRARY)
210
211#----------------------------------------------------------------------------
Christopher Ferris7fb22872013-09-27 12:43:15 -0700212# libbacktrace host test library, all optimizations turned off
213#----------------------------------------------------------------------------
214include $(CLEAR_VARS)
215
216LOCAL_MODULE := libbacktrace_test
217LOCAL_MODULE_FLAGS := debug
218
219LOCAL_SRC_FILES := \
220 backtrace_testlib.c
221
222LOCAL_CFLAGS += \
223 -std=gnu99 \
224 -O0 \
225
Christopher Ferris17e91d42013-10-21 13:30:52 -0700226LOCAL_ADDITIONAL_DEPENDENCIES := \
227 $(LOCAL_PATH)/Android.mk
228
Christopher Ferris7fb22872013-09-27 12:43:15 -0700229include $(BUILD_HOST_SHARED_LIBRARY)
230
231#----------------------------------------------------------------------------
232# libbacktrace host test executable
233#----------------------------------------------------------------------------
234include $(CLEAR_VARS)
235
236LOCAL_MODULE := backtrace_test
237LOCAL_MODULE_FLAGS := debug
238
239LOCAL_SRC_FILES := \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700240 backtrace_test.cpp \
241 thread_utils.c \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700242
243LOCAL_CFLAGS += \
Christopher Ferris7f081ec2013-11-05 11:38:05 -0800244 $(common_cflags) \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700245 -fno-builtin \
246 -fstack-protector-all \
247 -O0 \
248 -g \
249 -DGTEST_HAS_STD_STRING \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700250
251LOCAL_SHARED_LIBRARIES := \
252 libbacktrace_test \
253 libbacktrace \
254
Christopher Ferris17e91d42013-10-21 13:30:52 -0700255LOCAL_LDLIBS := \
256 -lpthread \
257
258LOCAL_ADDITIONAL_DEPENDENCIES := \
259 $(LOCAL_PATH)/Android.mk
260
261include $(BUILD_HOST_NATIVE_TEST)
Christopher Ferris7fb22872013-09-27 12:43:15 -0700262
263endif # HOST_OS-HOST_ARCH == linux-x86