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 \ |
| 5 | BacktraceThread.cpp \ |
| 6 | map_info.c \ |
| 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 | |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 151 | LOCAL_CONLYFLAGS += \ |
| 152 | $(common_conlyflags) \ |
| 153 | |
| 154 | LOCAL_CPPFLAGS += \ |
| 155 | $(common_cppflags) \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 156 | |
| 157 | LOCAL_SHARED_LIBRARIES += \ |
| 158 | libcutils \ |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 159 | libbacktrace_test \ |
| 160 | libbacktrace \ |
| 161 | |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 162 | LOCAL_LDLIBS := \ |
| 163 | -lpthread \ |
| 164 | |
| 165 | LOCAL_ADDITIONAL_DEPENDENCIES := \ |
| 166 | $(LOCAL_PATH)/Android.mk |
| 167 | |
| 168 | include $(BUILD_NATIVE_TEST) |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 169 | |
| 170 | #---------------------------------------------------------------------------- |
| 171 | # Only linux-x86 host versions of libbacktrace supported. |
| 172 | #---------------------------------------------------------------------------- |
| 173 | ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86) |
| 174 | |
| 175 | #---------------------------------------------------------------------------- |
Christopher Ferris | 9e1ee2b | 2013-10-02 14:19:19 -0700 | [diff] [blame] | 176 | # The host libbacktrace library using libcorkscrew |
| 177 | #---------------------------------------------------------------------------- |
| 178 | include $(CLEAR_VARS) |
| 179 | |
| 180 | LOCAL_SRC_FILES += \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 181 | $(common_src) \ |
| 182 | Corkscrew.cpp \ |
Christopher Ferris | 9e1ee2b | 2013-10-02 14:19:19 -0700 | [diff] [blame] | 183 | |
| 184 | LOCAL_CFLAGS += \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 185 | $(common_cflags) \ |
| 186 | |
| 187 | LOCAL_CONLYFLAGS += \ |
| 188 | $(common_conlyflags) \ |
| 189 | |
| 190 | LOCAL_CPPFLAGS += \ |
| 191 | $(common_cppflags) \ |
| 192 | |
| 193 | LOCAL_C_INCLUDES := \ |
| 194 | $(common_c_includes) \ |
| 195 | system/core/libcorkscrew \ |
Christopher Ferris | 9e1ee2b | 2013-10-02 14:19:19 -0700 | [diff] [blame] | 196 | |
| 197 | LOCAL_SHARED_LIBRARIES := \ |
Christopher Ferris | 9e1ee2b | 2013-10-02 14:19:19 -0700 | [diff] [blame] | 198 | libgccdemangle \ |
| 199 | liblog \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 200 | libcorkscrew \ |
Christopher Ferris | 9e1ee2b | 2013-10-02 14:19:19 -0700 | [diff] [blame] | 201 | |
| 202 | LOCAL_LDLIBS += \ |
| 203 | -ldl \ |
| 204 | -lrt \ |
| 205 | |
| 206 | LOCAL_MODULE := libbacktrace |
| 207 | LOCAL_MODULE_TAGS := optional |
| 208 | |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 209 | LOCAL_ADDITIONAL_DEPENDENCIES := \ |
| 210 | $(LOCAL_PATH)/Android.mk |
| 211 | |
Christopher Ferris | 9e1ee2b | 2013-10-02 14:19:19 -0700 | [diff] [blame] | 212 | include $(BUILD_HOST_SHARED_LIBRARY) |
| 213 | |
| 214 | #---------------------------------------------------------------------------- |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 215 | # libbacktrace host test library, all optimizations turned off |
| 216 | #---------------------------------------------------------------------------- |
| 217 | include $(CLEAR_VARS) |
| 218 | |
| 219 | LOCAL_MODULE := libbacktrace_test |
| 220 | LOCAL_MODULE_FLAGS := debug |
| 221 | |
| 222 | LOCAL_SRC_FILES := \ |
| 223 | backtrace_testlib.c |
| 224 | |
| 225 | LOCAL_CFLAGS += \ |
| 226 | -std=gnu99 \ |
| 227 | -O0 \ |
| 228 | |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 229 | LOCAL_ADDITIONAL_DEPENDENCIES := \ |
| 230 | $(LOCAL_PATH)/Android.mk |
| 231 | |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 232 | include $(BUILD_HOST_SHARED_LIBRARY) |
| 233 | |
| 234 | #---------------------------------------------------------------------------- |
| 235 | # libbacktrace host test executable |
| 236 | #---------------------------------------------------------------------------- |
| 237 | include $(CLEAR_VARS) |
| 238 | |
| 239 | LOCAL_MODULE := backtrace_test |
| 240 | LOCAL_MODULE_FLAGS := debug |
| 241 | |
| 242 | LOCAL_SRC_FILES := \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 243 | backtrace_test.cpp \ |
| 244 | thread_utils.c \ |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 245 | |
| 246 | LOCAL_CFLAGS += \ |
Christopher Ferris | 7f081ec | 2013-11-05 11:38:05 -0800 | [diff] [blame] | 247 | $(common_cflags) \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 248 | -fno-builtin \ |
| 249 | -fstack-protector-all \ |
| 250 | -O0 \ |
| 251 | -g \ |
| 252 | -DGTEST_HAS_STD_STRING \ |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 253 | |
| 254 | LOCAL_SHARED_LIBRARIES := \ |
| 255 | libbacktrace_test \ |
| 256 | libbacktrace \ |
| 257 | |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 258 | LOCAL_LDLIBS := \ |
| 259 | -lpthread \ |
| 260 | |
| 261 | LOCAL_ADDITIONAL_DEPENDENCIES := \ |
| 262 | $(LOCAL_PATH)/Android.mk |
| 263 | |
| 264 | include $(BUILD_HOST_NATIVE_TEST) |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 265 | |
| 266 | endif # HOST_OS-HOST_ARCH == linux-x86 |