Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 1 | LOCAL_PATH:= $(call my-dir) |
| 2 | |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 3 | common_src := \ |
| 4 | Backtrace.cpp \ |
Christopher Ferris | 4675682 | 2014-01-14 20:16:30 -0800 | [diff] [blame] | 5 | BacktraceMap.cpp \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 6 | BacktraceThread.cpp \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 7 | thread_utils.c \ |
| 8 | |
| 9 | common_cflags := \ |
| 10 | -Wall \ |
| 11 | -Wno-unused-parameter \ |
| 12 | -Werror \ |
| 13 | |
| 14 | common_conlyflags := \ |
| 15 | -std=gnu99 \ |
| 16 | |
| 17 | common_cppflags := \ |
| 18 | -std=gnu++11 \ |
| 19 | |
| 20 | common_shared_libs := \ |
| 21 | libcutils \ |
| 22 | libgccdemangle \ |
| 23 | liblog \ |
| 24 | |
Elliott Hughes | 3c67fe9 | 2014-01-02 15:13:38 -0800 | [diff] [blame] | 25 | # To enable using libunwind on each arch, add it to this list. |
| 26 | libunwind_architectures := |
| 27 | #libunwind_architectures := arm |
| 28 | |
| 29 | ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),$(libunwind_architectures))) |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 30 | |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 31 | #---------------------------------------------------------------------------- |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 32 | # The native libbacktrace library with libunwind. |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 33 | #---------------------------------------------------------------------------- |
| 34 | include $(CLEAR_VARS) |
| 35 | |
| 36 | LOCAL_SRC_FILES:= \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 37 | $(common_src) \ |
| 38 | UnwindCurrent.cpp \ |
| 39 | UnwindPtrace.cpp \ |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 40 | |
| 41 | LOCAL_CFLAGS := \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 42 | $(common_cflags) \ |
| 43 | |
| 44 | LOCAL_CONLYFLAGS += \ |
| 45 | $(common_conlyflags) \ |
| 46 | |
| 47 | LOCAL_CPPFLAGS += \ |
| 48 | $(common_cppflags) \ |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 49 | |
| 50 | LOCAL_MODULE := libbacktrace |
| 51 | LOCAL_MODULE_TAGS := optional |
| 52 | |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 53 | LOCAL_C_INCLUDES := \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 54 | $(common_c_includes) \ |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 55 | external/libunwind/include \ |
| 56 | |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 57 | LOCAL_SHARED_LIBRARIES := \ |
| 58 | $(common_shared_libs) \ |
| 59 | libunwind \ |
| 60 | libunwind-ptrace \ |
| 61 | |
| 62 | LOCAL_ADDITIONAL_DEPENDENCIES := \ |
| 63 | $(LOCAL_PATH)/Android.mk |
| 64 | |
| 65 | include external/stlport/libstlport.mk |
| 66 | |
| 67 | include $(BUILD_SHARED_LIBRARY) |
| 68 | |
| 69 | else |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 70 | |
| 71 | #---------------------------------------------------------------------------- |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 72 | # The native libbacktrace library with libcorkscrew. |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 73 | #---------------------------------------------------------------------------- |
| 74 | include $(CLEAR_VARS) |
| 75 | |
| 76 | LOCAL_SRC_FILES:= \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 77 | $(common_src) \ |
| 78 | Corkscrew.cpp \ |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 79 | |
| 80 | LOCAL_CFLAGS := \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 81 | $(common_cflags) \ |
| 82 | |
| 83 | LOCAL_CONLYFLAGS += \ |
| 84 | $(common_conlyflags) \ |
| 85 | |
| 86 | LOCAL_CPPFLAGS += \ |
| 87 | $(common_cppflags) \ |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 88 | |
| 89 | LOCAL_MODULE := libbacktrace |
| 90 | LOCAL_MODULE_TAGS := optional |
| 91 | |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 92 | LOCAL_C_INCLUDES := \ |
| 93 | $(common_c_includes) \ |
| 94 | system/core/libcorkscrew \ |
| 95 | |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 96 | LOCAL_SHARED_LIBRARIES := \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 97 | $(common_shared_libs) \ |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 98 | libcorkscrew \ |
| 99 | libdl \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 100 | |
| 101 | LOCAL_ADDITIONAL_DEPENDENCIES := \ |
| 102 | $(LOCAL_PATH)/Android.mk |
| 103 | |
| 104 | include external/stlport/libstlport.mk |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 105 | |
| 106 | include $(BUILD_SHARED_LIBRARY) |
| 107 | |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 108 | endif |
| 109 | |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 110 | #---------------------------------------------------------------------------- |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 111 | # libbacktrace test library, all optimizations turned off |
| 112 | #---------------------------------------------------------------------------- |
| 113 | include $(CLEAR_VARS) |
| 114 | |
| 115 | LOCAL_MODULE := libbacktrace_test |
| 116 | LOCAL_MODULE_FLAGS := debug |
| 117 | |
| 118 | LOCAL_SRC_FILES := \ |
| 119 | backtrace_testlib.c |
| 120 | |
| 121 | LOCAL_CFLAGS += \ |
| 122 | -std=gnu99 \ |
| 123 | -O0 \ |
| 124 | |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 125 | LOCAL_ADDITIONAL_DEPENDENCIES := \ |
| 126 | $(LOCAL_PATH)/Android.mk |
| 127 | |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 128 | include $(BUILD_SHARED_LIBRARY) |
| 129 | |
| 130 | #---------------------------------------------------------------------------- |
| 131 | # libbacktrace test executable |
| 132 | #---------------------------------------------------------------------------- |
| 133 | include $(CLEAR_VARS) |
| 134 | |
| 135 | LOCAL_MODULE := backtrace_test |
| 136 | LOCAL_MODULE_FLAGS := debug |
| 137 | |
| 138 | LOCAL_SRC_FILES := \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 139 | backtrace_test.cpp \ |
| 140 | thread_utils.c \ |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 141 | |
| 142 | LOCAL_CFLAGS += \ |
Christopher Ferris | 7f081ec | 2013-11-05 11:38:05 -0800 | [diff] [blame] | 143 | $(common_cflags) \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 144 | -fno-builtin \ |
| 145 | -fstack-protector-all \ |
| 146 | -O0 \ |
| 147 | -g \ |
| 148 | -DGTEST_OS_LINUX_ANDROID \ |
| 149 | -DGTEST_HAS_STD_STRING \ |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 150 | |
Colin Cross | d4146e6 | 2014-01-21 20:12:28 -0800 | [diff] [blame^] | 151 | ifeq ($(TARGET_ARCH),arm64) |
Elliott Hughes | 1380ddc | 2014-01-14 16:44:31 -0800 | [diff] [blame] | 152 | $(info TODO: $(LOCAL_PATH)/Android.mk -fstack-protector not yet available for the AArch64 toolchain) |
| 153 | LOCAL_CFLAGS += -fno-stack-protector |
Colin Cross | d4146e6 | 2014-01-21 20:12:28 -0800 | [diff] [blame^] | 154 | endif # arm64 |
Elliott Hughes | 1380ddc | 2014-01-14 16:44:31 -0800 | [diff] [blame] | 155 | |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 156 | LOCAL_CONLYFLAGS += \ |
| 157 | $(common_conlyflags) \ |
| 158 | |
| 159 | LOCAL_CPPFLAGS += \ |
| 160 | $(common_cppflags) \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 161 | |
| 162 | LOCAL_SHARED_LIBRARIES += \ |
| 163 | libcutils \ |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 164 | libbacktrace_test \ |
| 165 | libbacktrace \ |
| 166 | |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 167 | LOCAL_LDLIBS := \ |
| 168 | -lpthread \ |
| 169 | |
| 170 | LOCAL_ADDITIONAL_DEPENDENCIES := \ |
| 171 | $(LOCAL_PATH)/Android.mk |
| 172 | |
| 173 | include $(BUILD_NATIVE_TEST) |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 174 | |
| 175 | #---------------------------------------------------------------------------- |
Christopher Ferris | f67c641 | 2014-01-10 00:43:54 -0800 | [diff] [blame] | 176 | # Only x86 host versions of libbacktrace supported. |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 177 | #---------------------------------------------------------------------------- |
Christopher Ferris | f67c641 | 2014-01-10 00:43:54 -0800 | [diff] [blame] | 178 | ifeq ($(HOST_ARCH),x86) |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 179 | |
| 180 | #---------------------------------------------------------------------------- |
Christopher Ferris | 9e1ee2b | 2013-10-02 14:19:19 -0700 | [diff] [blame] | 181 | # The host libbacktrace library using libcorkscrew |
| 182 | #---------------------------------------------------------------------------- |
| 183 | include $(CLEAR_VARS) |
| 184 | |
Christopher Ferris | 9e1ee2b | 2013-10-02 14:19:19 -0700 | [diff] [blame] | 185 | |
| 186 | LOCAL_CFLAGS += \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 187 | $(common_cflags) \ |
| 188 | |
| 189 | LOCAL_CONLYFLAGS += \ |
| 190 | $(common_conlyflags) \ |
| 191 | |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 192 | LOCAL_C_INCLUDES := \ |
| 193 | $(common_c_includes) \ |
Christopher Ferris | 9e1ee2b | 2013-10-02 14:19:19 -0700 | [diff] [blame] | 194 | |
| 195 | LOCAL_SHARED_LIBRARIES := \ |
Christopher Ferris | 9e1ee2b | 2013-10-02 14:19:19 -0700 | [diff] [blame] | 196 | libgccdemangle \ |
| 197 | liblog \ |
Christopher Ferris | 9e1ee2b | 2013-10-02 14:19:19 -0700 | [diff] [blame] | 198 | |
| 199 | LOCAL_MODULE := libbacktrace |
| 200 | LOCAL_MODULE_TAGS := optional |
| 201 | |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 202 | LOCAL_ADDITIONAL_DEPENDENCIES := \ |
| 203 | $(LOCAL_PATH)/Android.mk |
| 204 | |
Christopher Ferris | f67c641 | 2014-01-10 00:43:54 -0800 | [diff] [blame] | 205 | ifeq ($(HOST_OS),linux) |
| 206 | LOCAL_SRC_FILES += \ |
| 207 | $(common_src) \ |
| 208 | Corkscrew.cpp \ |
| 209 | |
| 210 | LOCAL_C_INCLUDES += \ |
| 211 | system/core/libcorkscrew \ |
| 212 | |
| 213 | LOCAL_SHARED_LIBRARIES := \ |
| 214 | libcorkscrew \ |
| 215 | |
| 216 | LOCAL_CPPFLAGS += \ |
| 217 | $(common_cppflags) \ |
| 218 | |
| 219 | LOCAL_LDLIBS += \ |
| 220 | -ldl \ |
| 221 | -lrt \ |
| 222 | |
| 223 | else |
| 224 | LOCAL_SRC_FILES += \ |
Christopher Ferris | 4675682 | 2014-01-14 20:16:30 -0800 | [diff] [blame] | 225 | BacktraceMap.cpp \ |
Christopher Ferris | f67c641 | 2014-01-10 00:43:54 -0800 | [diff] [blame] | 226 | |
| 227 | endif |
| 228 | |
Christopher Ferris | 9e1ee2b | 2013-10-02 14:19:19 -0700 | [diff] [blame] | 229 | include $(BUILD_HOST_SHARED_LIBRARY) |
| 230 | |
| 231 | #---------------------------------------------------------------------------- |
Christopher Ferris | f67c641 | 2014-01-10 00:43:54 -0800 | [diff] [blame] | 232 | # The host test is only supported on linux. |
| 233 | #---------------------------------------------------------------------------- |
| 234 | ifeq ($(HOST_OS),linux) |
| 235 | |
| 236 | #---------------------------------------------------------------------------- |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 237 | # libbacktrace host test library, all optimizations turned off |
| 238 | #---------------------------------------------------------------------------- |
| 239 | include $(CLEAR_VARS) |
| 240 | |
| 241 | LOCAL_MODULE := libbacktrace_test |
| 242 | LOCAL_MODULE_FLAGS := debug |
| 243 | |
| 244 | LOCAL_SRC_FILES := \ |
| 245 | backtrace_testlib.c |
| 246 | |
| 247 | LOCAL_CFLAGS += \ |
| 248 | -std=gnu99 \ |
| 249 | -O0 \ |
| 250 | |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 251 | LOCAL_ADDITIONAL_DEPENDENCIES := \ |
| 252 | $(LOCAL_PATH)/Android.mk |
| 253 | |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 254 | include $(BUILD_HOST_SHARED_LIBRARY) |
| 255 | |
| 256 | #---------------------------------------------------------------------------- |
| 257 | # libbacktrace host test executable |
| 258 | #---------------------------------------------------------------------------- |
| 259 | include $(CLEAR_VARS) |
| 260 | |
| 261 | LOCAL_MODULE := backtrace_test |
| 262 | LOCAL_MODULE_FLAGS := debug |
| 263 | |
| 264 | LOCAL_SRC_FILES := \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 265 | backtrace_test.cpp \ |
| 266 | thread_utils.c \ |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 267 | |
| 268 | LOCAL_CFLAGS += \ |
Christopher Ferris | 7f081ec | 2013-11-05 11:38:05 -0800 | [diff] [blame] | 269 | $(common_cflags) \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 270 | -fno-builtin \ |
| 271 | -fstack-protector-all \ |
| 272 | -O0 \ |
| 273 | -g \ |
| 274 | -DGTEST_HAS_STD_STRING \ |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 275 | |
| 276 | LOCAL_SHARED_LIBRARIES := \ |
| 277 | libbacktrace_test \ |
| 278 | libbacktrace \ |
| 279 | |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 280 | LOCAL_LDLIBS := \ |
| 281 | -lpthread \ |
| 282 | |
| 283 | LOCAL_ADDITIONAL_DEPENDENCIES := \ |
| 284 | $(LOCAL_PATH)/Android.mk |
| 285 | |
| 286 | include $(BUILD_HOST_NATIVE_TEST) |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 287 | |
Christopher Ferris | f67c641 | 2014-01-10 00:43:54 -0800 | [diff] [blame] | 288 | endif # HOST_OS == linux |
| 289 | |
| 290 | endif # HOST_ARCH == x86 |