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