blob: d2fd79e7654db886d7924cc0336120a45333b09c [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
Elliott Hughes1380ddc2014-01-14 16:44:31 -0800151ifeq ($(TARGET_ARCH),aarch64)
152 $(info TODO: $(LOCAL_PATH)/Android.mk -fstack-protector not yet available for the AArch64 toolchain)
153 LOCAL_CFLAGS += -fno-stack-protector
154endif # aarch64
155
Christopher Ferris17e91d42013-10-21 13:30:52 -0700156LOCAL_CONLYFLAGS += \
157 $(common_conlyflags) \
158
159LOCAL_CPPFLAGS += \
160 $(common_cppflags) \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700161
162LOCAL_SHARED_LIBRARIES += \
163 libcutils \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700164 libbacktrace_test \
165 libbacktrace \
166
Christopher Ferris17e91d42013-10-21 13:30:52 -0700167LOCAL_LDLIBS := \
168 -lpthread \
169
170LOCAL_ADDITIONAL_DEPENDENCIES := \
171 $(LOCAL_PATH)/Android.mk
172
173include $(BUILD_NATIVE_TEST)
Christopher Ferris7fb22872013-09-27 12:43:15 -0700174
175#----------------------------------------------------------------------------
Christopher Ferrisf67c6412014-01-10 00:43:54 -0800176# Only x86 host versions of libbacktrace supported.
Christopher Ferris7fb22872013-09-27 12:43:15 -0700177#----------------------------------------------------------------------------
Christopher Ferrisf67c6412014-01-10 00:43:54 -0800178ifeq ($(HOST_ARCH),x86)
Christopher Ferris7fb22872013-09-27 12:43:15 -0700179
180#----------------------------------------------------------------------------
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -0700181# The host libbacktrace library using libcorkscrew
182#----------------------------------------------------------------------------
183include $(CLEAR_VARS)
184
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -0700185
186LOCAL_CFLAGS += \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700187 $(common_cflags) \
188
189LOCAL_CONLYFLAGS += \
190 $(common_conlyflags) \
191
Christopher Ferris17e91d42013-10-21 13:30:52 -0700192LOCAL_C_INCLUDES := \
193 $(common_c_includes) \
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -0700194
195LOCAL_SHARED_LIBRARIES := \
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -0700196 libgccdemangle \
197 liblog \
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -0700198
199LOCAL_MODULE := libbacktrace
200LOCAL_MODULE_TAGS := optional
201
Christopher Ferris17e91d42013-10-21 13:30:52 -0700202LOCAL_ADDITIONAL_DEPENDENCIES := \
203 $(LOCAL_PATH)/Android.mk
204
Christopher Ferrisf67c6412014-01-10 00:43:54 -0800205ifeq ($(HOST_OS),linux)
206LOCAL_SRC_FILES += \
207 $(common_src) \
208 Corkscrew.cpp \
209
210LOCAL_C_INCLUDES += \
211 system/core/libcorkscrew \
212
213LOCAL_SHARED_LIBRARIES := \
214 libcorkscrew \
215
216LOCAL_CPPFLAGS += \
217 $(common_cppflags) \
218
219LOCAL_LDLIBS += \
220 -ldl \
221 -lrt \
222
223else
224LOCAL_SRC_FILES += \
225 map_info.c \
226
227endif
228
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -0700229include $(BUILD_HOST_SHARED_LIBRARY)
230
231#----------------------------------------------------------------------------
Christopher Ferrisf67c6412014-01-10 00:43:54 -0800232# The host test is only supported on linux.
233#----------------------------------------------------------------------------
234ifeq ($(HOST_OS),linux)
235
236#----------------------------------------------------------------------------
Christopher Ferris7fb22872013-09-27 12:43:15 -0700237# libbacktrace host test library, all optimizations turned off
238#----------------------------------------------------------------------------
239include $(CLEAR_VARS)
240
241LOCAL_MODULE := libbacktrace_test
242LOCAL_MODULE_FLAGS := debug
243
244LOCAL_SRC_FILES := \
245 backtrace_testlib.c
246
247LOCAL_CFLAGS += \
248 -std=gnu99 \
249 -O0 \
250
Christopher Ferris17e91d42013-10-21 13:30:52 -0700251LOCAL_ADDITIONAL_DEPENDENCIES := \
252 $(LOCAL_PATH)/Android.mk
253
Christopher Ferris7fb22872013-09-27 12:43:15 -0700254include $(BUILD_HOST_SHARED_LIBRARY)
255
256#----------------------------------------------------------------------------
257# libbacktrace host test executable
258#----------------------------------------------------------------------------
259include $(CLEAR_VARS)
260
261LOCAL_MODULE := backtrace_test
262LOCAL_MODULE_FLAGS := debug
263
264LOCAL_SRC_FILES := \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700265 backtrace_test.cpp \
266 thread_utils.c \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700267
268LOCAL_CFLAGS += \
Christopher Ferris7f081ec2013-11-05 11:38:05 -0800269 $(common_cflags) \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700270 -fno-builtin \
271 -fstack-protector-all \
272 -O0 \
273 -g \
274 -DGTEST_HAS_STD_STRING \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700275
276LOCAL_SHARED_LIBRARIES := \
277 libbacktrace_test \
278 libbacktrace \
279
Christopher Ferris17e91d42013-10-21 13:30:52 -0700280LOCAL_LDLIBS := \
281 -lpthread \
282
283LOCAL_ADDITIONAL_DEPENDENCIES := \
284 $(LOCAL_PATH)/Android.mk
285
286include $(BUILD_HOST_NATIVE_TEST)
Christopher Ferris7fb22872013-09-27 12:43:15 -0700287
Christopher Ferrisf67c6412014-01-10 00:43:54 -0800288endif # HOST_OS == linux
289
290endif # HOST_ARCH == x86