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