blob: a6b9c2b9a4e9787611f090c86b68789317e388b1 [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
Elliott Hughes3c67fe92014-01-02 15:13:38 -080025# To enable using libunwind on each arch, add it to this list.
26libunwind_architectures :=
27#libunwind_architectures := arm
28
29ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),$(libunwind_architectures)))
Christopher Ferris17e91d42013-10-21 13:30:52 -070030
Christopher Ferris7fb22872013-09-27 12:43:15 -070031#----------------------------------------------------------------------------
Christopher Ferris17e91d42013-10-21 13:30:52 -070032# The native libbacktrace library with libunwind.
Christopher Ferris7fb22872013-09-27 12:43:15 -070033#----------------------------------------------------------------------------
34include $(CLEAR_VARS)
35
36LOCAL_SRC_FILES:= \
Christopher Ferris17e91d42013-10-21 13:30:52 -070037 $(common_src) \
38 UnwindCurrent.cpp \
39 UnwindPtrace.cpp \
Christopher Ferris7fb22872013-09-27 12:43:15 -070040
41LOCAL_CFLAGS := \
Christopher Ferris17e91d42013-10-21 13:30:52 -070042 $(common_cflags) \
43
44LOCAL_CONLYFLAGS += \
45 $(common_conlyflags) \
46
47LOCAL_CPPFLAGS += \
48 $(common_cppflags) \
Christopher Ferris7fb22872013-09-27 12:43:15 -070049
50LOCAL_MODULE := libbacktrace
51LOCAL_MODULE_TAGS := optional
52
Christopher Ferris7fb22872013-09-27 12:43:15 -070053LOCAL_C_INCLUDES := \
Christopher Ferris17e91d42013-10-21 13:30:52 -070054 $(common_c_includes) \
Christopher Ferris7fb22872013-09-27 12:43:15 -070055 external/libunwind/include \
56
Christopher Ferris17e91d42013-10-21 13:30:52 -070057LOCAL_SHARED_LIBRARIES := \
58 $(common_shared_libs) \
59 libunwind \
60 libunwind-ptrace \
61
62LOCAL_ADDITIONAL_DEPENDENCIES := \
63 $(LOCAL_PATH)/Android.mk
64
65include external/stlport/libstlport.mk
66
67include $(BUILD_SHARED_LIBRARY)
68
69else
Christopher Ferris7fb22872013-09-27 12:43:15 -070070
71#----------------------------------------------------------------------------
Christopher Ferris17e91d42013-10-21 13:30:52 -070072# The native libbacktrace library with libcorkscrew.
Christopher Ferris7fb22872013-09-27 12:43:15 -070073#----------------------------------------------------------------------------
74include $(CLEAR_VARS)
75
76LOCAL_SRC_FILES:= \
Christopher Ferris17e91d42013-10-21 13:30:52 -070077 $(common_src) \
78 Corkscrew.cpp \
Christopher Ferris7fb22872013-09-27 12:43:15 -070079
80LOCAL_CFLAGS := \
Christopher Ferris17e91d42013-10-21 13:30:52 -070081 $(common_cflags) \
82
83LOCAL_CONLYFLAGS += \
84 $(common_conlyflags) \
85
86LOCAL_CPPFLAGS += \
87 $(common_cppflags) \
Christopher Ferris7fb22872013-09-27 12:43:15 -070088
89LOCAL_MODULE := libbacktrace
90LOCAL_MODULE_TAGS := optional
91
Christopher Ferris17e91d42013-10-21 13:30:52 -070092LOCAL_C_INCLUDES := \
93 $(common_c_includes) \
94 system/core/libcorkscrew \
95
Christopher Ferris7fb22872013-09-27 12:43:15 -070096LOCAL_SHARED_LIBRARIES := \
Christopher Ferris17e91d42013-10-21 13:30:52 -070097 $(common_shared_libs) \
Christopher Ferris7fb22872013-09-27 12:43:15 -070098 libcorkscrew \
99 libdl \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700100
101LOCAL_ADDITIONAL_DEPENDENCIES := \
102 $(LOCAL_PATH)/Android.mk
103
104include external/stlport/libstlport.mk
Christopher Ferris7fb22872013-09-27 12:43:15 -0700105
106include $(BUILD_SHARED_LIBRARY)
107
Christopher Ferris17e91d42013-10-21 13:30:52 -0700108endif
109
Christopher Ferris7fb22872013-09-27 12:43:15 -0700110#----------------------------------------------------------------------------
Christopher Ferris7fb22872013-09-27 12:43:15 -0700111# libbacktrace test library, all optimizations turned off
112#----------------------------------------------------------------------------
113include $(CLEAR_VARS)
114
115LOCAL_MODULE := libbacktrace_test
116LOCAL_MODULE_FLAGS := debug
117
118LOCAL_SRC_FILES := \
119 backtrace_testlib.c
120
121LOCAL_CFLAGS += \
122 -std=gnu99 \
123 -O0 \
124
Christopher Ferris17e91d42013-10-21 13:30:52 -0700125LOCAL_ADDITIONAL_DEPENDENCIES := \
126 $(LOCAL_PATH)/Android.mk
127
Christopher Ferris7fb22872013-09-27 12:43:15 -0700128include $(BUILD_SHARED_LIBRARY)
129
130#----------------------------------------------------------------------------
131# libbacktrace test executable
132#----------------------------------------------------------------------------
133include $(CLEAR_VARS)
134
135LOCAL_MODULE := backtrace_test
136LOCAL_MODULE_FLAGS := debug
137
138LOCAL_SRC_FILES := \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700139 backtrace_test.cpp \
140 thread_utils.c \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700141
142LOCAL_CFLAGS += \
Christopher Ferris7f081ec2013-11-05 11:38:05 -0800143 $(common_cflags) \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700144 -fno-builtin \
145 -fstack-protector-all \
146 -O0 \
147 -g \
148 -DGTEST_OS_LINUX_ANDROID \
149 -DGTEST_HAS_STD_STRING \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700150
Christopher Ferris17e91d42013-10-21 13:30:52 -0700151LOCAL_CONLYFLAGS += \
152 $(common_conlyflags) \
153
154LOCAL_CPPFLAGS += \
155 $(common_cppflags) \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700156
157LOCAL_SHARED_LIBRARIES += \
158 libcutils \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700159 libbacktrace_test \
160 libbacktrace \
161
Christopher Ferris17e91d42013-10-21 13:30:52 -0700162LOCAL_LDLIBS := \
163 -lpthread \
164
165LOCAL_ADDITIONAL_DEPENDENCIES := \
166 $(LOCAL_PATH)/Android.mk
167
168include $(BUILD_NATIVE_TEST)
Christopher Ferris7fb22872013-09-27 12:43:15 -0700169
170#----------------------------------------------------------------------------
171# Only linux-x86 host versions of libbacktrace supported.
172#----------------------------------------------------------------------------
173ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86)
174
175#----------------------------------------------------------------------------
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -0700176# The host libbacktrace library using libcorkscrew
177#----------------------------------------------------------------------------
178include $(CLEAR_VARS)
179
180LOCAL_SRC_FILES += \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700181 $(common_src) \
182 Corkscrew.cpp \
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -0700183
184LOCAL_CFLAGS += \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700185 $(common_cflags) \
186
187LOCAL_CONLYFLAGS += \
188 $(common_conlyflags) \
189
190LOCAL_CPPFLAGS += \
191 $(common_cppflags) \
192
193LOCAL_C_INCLUDES := \
194 $(common_c_includes) \
195 system/core/libcorkscrew \
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -0700196
197LOCAL_SHARED_LIBRARIES := \
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -0700198 libgccdemangle \
199 liblog \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700200 libcorkscrew \
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -0700201
202LOCAL_LDLIBS += \
203 -ldl \
204 -lrt \
205
206LOCAL_MODULE := libbacktrace
207LOCAL_MODULE_TAGS := optional
208
Christopher Ferris17e91d42013-10-21 13:30:52 -0700209LOCAL_ADDITIONAL_DEPENDENCIES := \
210 $(LOCAL_PATH)/Android.mk
211
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -0700212include $(BUILD_HOST_SHARED_LIBRARY)
213
214#----------------------------------------------------------------------------
Christopher Ferris7fb22872013-09-27 12:43:15 -0700215# libbacktrace host test library, all optimizations turned off
216#----------------------------------------------------------------------------
217include $(CLEAR_VARS)
218
219LOCAL_MODULE := libbacktrace_test
220LOCAL_MODULE_FLAGS := debug
221
222LOCAL_SRC_FILES := \
223 backtrace_testlib.c
224
225LOCAL_CFLAGS += \
226 -std=gnu99 \
227 -O0 \
228
Christopher Ferris17e91d42013-10-21 13:30:52 -0700229LOCAL_ADDITIONAL_DEPENDENCIES := \
230 $(LOCAL_PATH)/Android.mk
231
Christopher Ferris7fb22872013-09-27 12:43:15 -0700232include $(BUILD_HOST_SHARED_LIBRARY)
233
234#----------------------------------------------------------------------------
235# libbacktrace host test executable
236#----------------------------------------------------------------------------
237include $(CLEAR_VARS)
238
239LOCAL_MODULE := backtrace_test
240LOCAL_MODULE_FLAGS := debug
241
242LOCAL_SRC_FILES := \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700243 backtrace_test.cpp \
244 thread_utils.c \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700245
246LOCAL_CFLAGS += \
Christopher Ferris7f081ec2013-11-05 11:38:05 -0800247 $(common_cflags) \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700248 -fno-builtin \
249 -fstack-protector-all \
250 -O0 \
251 -g \
252 -DGTEST_HAS_STD_STRING \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700253
254LOCAL_SHARED_LIBRARIES := \
255 libbacktrace_test \
256 libbacktrace \
257
Christopher Ferris17e91d42013-10-21 13:30:52 -0700258LOCAL_LDLIBS := \
259 -lpthread \
260
261LOCAL_ADDITIONAL_DEPENDENCIES := \
262 $(LOCAL_PATH)/Android.mk
263
264include $(BUILD_HOST_NATIVE_TEST)
Christopher Ferris7fb22872013-09-27 12:43:15 -0700265
266endif # HOST_OS-HOST_ARCH == linux-x86