blob: 8995fc17facd1c6f6e94856d3b3ddd518ff5b00b [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#----------------------------------------------------------------------------
Christopher Ferrisf67c6412014-01-10 00:43:54 -0800171# Only x86 host versions of libbacktrace supported.
Christopher Ferris7fb22872013-09-27 12:43:15 -0700172#----------------------------------------------------------------------------
Christopher Ferrisf67c6412014-01-10 00:43:54 -0800173ifeq ($(HOST_ARCH),x86)
Christopher Ferris7fb22872013-09-27 12:43:15 -0700174
175#----------------------------------------------------------------------------
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -0700176# The host libbacktrace library using libcorkscrew
177#----------------------------------------------------------------------------
178include $(CLEAR_VARS)
179
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
Christopher Ferris17e91d42013-10-21 13:30:52 -0700187LOCAL_C_INCLUDES := \
188 $(common_c_includes) \
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -0700189
190LOCAL_SHARED_LIBRARIES := \
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -0700191 libgccdemangle \
192 liblog \
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -0700193
194LOCAL_MODULE := libbacktrace
195LOCAL_MODULE_TAGS := optional
196
Christopher Ferris17e91d42013-10-21 13:30:52 -0700197LOCAL_ADDITIONAL_DEPENDENCIES := \
198 $(LOCAL_PATH)/Android.mk
199
Christopher Ferrisf67c6412014-01-10 00:43:54 -0800200ifeq ($(HOST_OS),linux)
201LOCAL_SRC_FILES += \
202 $(common_src) \
203 Corkscrew.cpp \
204
205LOCAL_C_INCLUDES += \
206 system/core/libcorkscrew \
207
208LOCAL_SHARED_LIBRARIES := \
209 libcorkscrew \
210
211LOCAL_CPPFLAGS += \
212 $(common_cppflags) \
213
214LOCAL_LDLIBS += \
215 -ldl \
216 -lrt \
217
218else
219LOCAL_SRC_FILES += \
220 map_info.c \
221
222endif
223
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -0700224include $(BUILD_HOST_SHARED_LIBRARY)
225
226#----------------------------------------------------------------------------
Christopher Ferrisf67c6412014-01-10 00:43:54 -0800227# The host test is only supported on linux.
228#----------------------------------------------------------------------------
229ifeq ($(HOST_OS),linux)
230
231#----------------------------------------------------------------------------
Christopher Ferris7fb22872013-09-27 12:43:15 -0700232# libbacktrace host test library, all optimizations turned off
233#----------------------------------------------------------------------------
234include $(CLEAR_VARS)
235
236LOCAL_MODULE := libbacktrace_test
237LOCAL_MODULE_FLAGS := debug
238
239LOCAL_SRC_FILES := \
240 backtrace_testlib.c
241
242LOCAL_CFLAGS += \
243 -std=gnu99 \
244 -O0 \
245
Christopher Ferris17e91d42013-10-21 13:30:52 -0700246LOCAL_ADDITIONAL_DEPENDENCIES := \
247 $(LOCAL_PATH)/Android.mk
248
Christopher Ferris7fb22872013-09-27 12:43:15 -0700249include $(BUILD_HOST_SHARED_LIBRARY)
250
251#----------------------------------------------------------------------------
252# libbacktrace host test executable
253#----------------------------------------------------------------------------
254include $(CLEAR_VARS)
255
256LOCAL_MODULE := backtrace_test
257LOCAL_MODULE_FLAGS := debug
258
259LOCAL_SRC_FILES := \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700260 backtrace_test.cpp \
261 thread_utils.c \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700262
263LOCAL_CFLAGS += \
Christopher Ferris7f081ec2013-11-05 11:38:05 -0800264 $(common_cflags) \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700265 -fno-builtin \
266 -fstack-protector-all \
267 -O0 \
268 -g \
269 -DGTEST_HAS_STD_STRING \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700270
271LOCAL_SHARED_LIBRARIES := \
272 libbacktrace_test \
273 libbacktrace \
274
Christopher Ferris17e91d42013-10-21 13:30:52 -0700275LOCAL_LDLIBS := \
276 -lpthread \
277
278LOCAL_ADDITIONAL_DEPENDENCIES := \
279 $(LOCAL_PATH)/Android.mk
280
281include $(BUILD_HOST_NATIVE_TEST)
Christopher Ferris7fb22872013-09-27 12:43:15 -0700282
Christopher Ferrisf67c6412014-01-10 00:43:54 -0800283endif # HOST_OS == linux
284
285endif # HOST_ARCH == x86