blob: 66d7e623edf5d1ac3e46312b5cc5f0c7e58c1acd [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 Ferris17e91d42013-10-21 13:30:52 -0700140 -fno-builtin \
141 -fstack-protector-all \
142 -O0 \
143 -g \
144 -DGTEST_OS_LINUX_ANDROID \
145 -DGTEST_HAS_STD_STRING \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700146
Christopher Ferris17e91d42013-10-21 13:30:52 -0700147LOCAL_CONLYFLAGS += \
148 $(common_conlyflags) \
149
150LOCAL_CPPFLAGS += \
151 $(common_cppflags) \
152 -fpermissive \
153
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 Ferris17e91d42013-10-21 13:30:52 -0700244 -fno-builtin \
245 -fstack-protector-all \
246 -O0 \
247 -g \
248 -DGTEST_HAS_STD_STRING \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700249
250LOCAL_SHARED_LIBRARIES := \
251 libbacktrace_test \
252 libbacktrace \
253
Christopher Ferris17e91d42013-10-21 13:30:52 -0700254LOCAL_CPPFLAGS += \
255 -fpermissive \
256
257LOCAL_LDLIBS := \
258 -lpthread \
259
260LOCAL_ADDITIONAL_DEPENDENCIES := \
261 $(LOCAL_PATH)/Android.mk
262
263include $(BUILD_HOST_NATIVE_TEST)
Christopher Ferris7fb22872013-09-27 12:43:15 -0700264
265endif # HOST_OS-HOST_ARCH == linux-x86