Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2014 The Android Open Source Project |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | # |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 16 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 17 | LOCAL_PATH:= $(call my-dir) |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 18 | |
Christopher Ferris | 2c43cff | 2015-03-26 19:18:36 -0700 | [diff] [blame] | 19 | libbacktrace_common_cflags := \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 20 | -Wall \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 21 | -Werror \ |
| 22 | |
Christopher Ferris | 2c43cff | 2015-03-26 19:18:36 -0700 | [diff] [blame] | 23 | libbacktrace_common_conlyflags := \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 24 | -std=gnu99 \ |
| 25 | |
Christopher Ferris | 2c43cff | 2015-03-26 19:18:36 -0700 | [diff] [blame] | 26 | libbacktrace_common_cppflags := \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 27 | -std=gnu++11 \ |
Dan Willemsen | ee2da03 | 2016-05-25 13:19:49 -0700 | [diff] [blame] | 28 | |
| 29 | libbacktrace_common_c_includes := \ |
| 30 | external/libunwind/include/tdep \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 31 | |
Stephen Hines | 035e9ba | 2015-03-31 09:39:20 -0700 | [diff] [blame] | 32 | # The latest clang (r230699) does not allow SP/PC to be declared in inline asm lists. |
| 33 | libbacktrace_common_clang_cflags += \ |
| 34 | -Wno-inline-asm |
| 35 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 36 | build_host := false |
| 37 | ifeq ($(HOST_OS),linux) |
| 38 | ifeq ($(HOST_ARCH),$(filter $(HOST_ARCH),x86 x86_64)) |
| 39 | build_host := true |
| 40 | endif |
| 41 | endif |
| 42 | |
Yabin Cui | 9e402bb | 2015-09-22 04:46:57 +0000 | [diff] [blame] | 43 | LLVM_ROOT_PATH := external/llvm |
| 44 | include $(LLVM_ROOT_PATH)/llvm.mk |
| 45 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 46 | #------------------------------------------------------------------------- |
| 47 | # The libbacktrace library. |
| 48 | #------------------------------------------------------------------------- |
| 49 | libbacktrace_src_files := \ |
Christopher Ferris | 2c43cff | 2015-03-26 19:18:36 -0700 | [diff] [blame] | 50 | Backtrace.cpp \ |
| 51 | BacktraceCurrent.cpp \ |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 52 | BacktraceMap.cpp \ |
Christopher Ferris | 2c43cff | 2015-03-26 19:18:36 -0700 | [diff] [blame] | 53 | BacktracePtrace.cpp \ |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 54 | thread_utils.c \ |
Christopher Ferris | 2c43cff | 2015-03-26 19:18:36 -0700 | [diff] [blame] | 55 | ThreadEntry.cpp \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 56 | UnwindCurrent.cpp \ |
Christopher Ferris | df29061 | 2014-01-22 19:21:07 -0800 | [diff] [blame] | 57 | UnwindMap.cpp \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 58 | UnwindPtrace.cpp \ |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 59 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 60 | libbacktrace_shared_libraries := \ |
Christopher Ferris | 2c43cff | 2015-03-26 19:18:36 -0700 | [diff] [blame] | 61 | libbase \ |
Christopher Ferris | 9e1ee2b | 2013-10-02 14:19:19 -0700 | [diff] [blame] | 62 | liblog \ |
Colin Cross | db134ca | 2015-04-28 17:49:42 -0700 | [diff] [blame] | 63 | libunwind \ |
Christopher Ferris | f67c641 | 2014-01-10 00:43:54 -0800 | [diff] [blame] | 64 | |
Than McIntosh | 1e0fea2 | 2016-02-01 10:17:45 -0500 | [diff] [blame] | 65 | libbacktrace_static_libraries := \ |
| 66 | libcutils |
| 67 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 68 | module := libbacktrace |
| 69 | module_tag := optional |
| 70 | build_type := target |
| 71 | build_target := SHARED_LIBRARY |
| 72 | include $(LOCAL_PATH)/Android.build.mk |
| 73 | build_type := host |
Dan Albert | 0d7164d | 2014-11-11 15:15:21 -0800 | [diff] [blame] | 74 | libbacktrace_multilib := both |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 75 | include $(LOCAL_PATH)/Android.build.mk |
Yabin Cui | 9946a8f | 2016-02-10 13:46:06 -0800 | [diff] [blame] | 76 | |
| 77 | libbacktrace_shared_libraries := |
| 78 | |
Calin Juravle | 28042b5 | 2015-06-08 14:30:52 +0100 | [diff] [blame] | 79 | libbacktrace_static_libraries := \ |
| 80 | libbase \ |
| 81 | liblog \ |
| 82 | libunwind \ |
Yabin Cui | 9946a8f | 2016-02-10 13:46:06 -0800 | [diff] [blame] | 83 | liblzma \ |
Calin Juravle | 28042b5 | 2015-06-08 14:30:52 +0100 | [diff] [blame] | 84 | |
Yabin Cui | 9946a8f | 2016-02-10 13:46:06 -0800 | [diff] [blame] | 85 | module := libbacktrace |
| 86 | build_type := target |
Calin Juravle | 28042b5 | 2015-06-08 14:30:52 +0100 | [diff] [blame] | 87 | build_target := STATIC_LIBRARY |
| 88 | include $(LOCAL_PATH)/Android.build.mk |
Yabin Cui | 9946a8f | 2016-02-10 13:46:06 -0800 | [diff] [blame] | 89 | build_type := host |
| 90 | libbacktrace_multilib := both |
| 91 | include $(LOCAL_PATH)/Android.build.mk |
Christopher Ferris | 9e1ee2b | 2013-10-02 14:19:19 -0700 | [diff] [blame] | 92 | |
Dan Albert | 40a46dd | 2014-05-19 10:10:37 -0700 | [diff] [blame] | 93 | #------------------------------------------------------------------------- |
Christopher Ferris | 8540216 | 2016-01-25 16:17:48 -0800 | [diff] [blame] | 94 | # The libbacktrace_offline shared library. |
| 95 | #------------------------------------------------------------------------- |
| 96 | libbacktrace_offline_src_files := \ |
| 97 | BacktraceOffline.cpp \ |
| 98 | |
Yabin Cui | b791a76 | 2016-03-18 18:46:08 -0700 | [diff] [blame] | 99 | # Use shared llvm library on device to save space. |
Yabin Cui | 51e6070 | 2016-04-13 21:21:47 -0700 | [diff] [blame] | 100 | libbacktrace_offline_shared_libraries_target := \ |
Christopher Ferris | 8540216 | 2016-01-25 16:17:48 -0800 | [diff] [blame] | 101 | libbacktrace \ |
Yabin Cui | b791a76 | 2016-03-18 18:46:08 -0700 | [diff] [blame] | 102 | libbase \ |
Christopher Ferris | 8540216 | 2016-01-25 16:17:48 -0800 | [diff] [blame] | 103 | liblog \ |
| 104 | libunwind \ |
Yabin Cui | b791a76 | 2016-03-18 18:46:08 -0700 | [diff] [blame] | 105 | libutils \ |
Christopher Ferris | 8540216 | 2016-01-25 16:17:48 -0800 | [diff] [blame] | 106 | libLLVM \ |
| 107 | |
Yabin Cui | 51e6070 | 2016-04-13 21:21:47 -0700 | [diff] [blame] | 108 | libbacktrace_offline_static_libraries_target := \ |
Yabin Cui | b791a76 | 2016-03-18 18:46:08 -0700 | [diff] [blame] | 109 | libziparchive \ |
| 110 | libz \ |
| 111 | |
Christopher Ferris | 8540216 | 2016-01-25 16:17:48 -0800 | [diff] [blame] | 112 | # Use static llvm libraries on host to remove dependency on 32-bit llvm shared library |
| 113 | # which is not included in the prebuilt. |
Yabin Cui | 51e6070 | 2016-04-13 21:21:47 -0700 | [diff] [blame] | 114 | libbacktrace_offline_static_libraries_host := \ |
Yabin Cui | 9946a8f | 2016-02-10 13:46:06 -0800 | [diff] [blame] | 115 | libbacktrace \ |
Yabin Cui | 9946a8f | 2016-02-10 13:46:06 -0800 | [diff] [blame] | 116 | libunwind \ |
Yabin Cui | 51e6070 | 2016-04-13 21:21:47 -0700 | [diff] [blame] | 117 | libziparchive-host \ |
Yabin Cui | b791a76 | 2016-03-18 18:46:08 -0700 | [diff] [blame] | 118 | libz \ |
Yabin Cui | 51e6070 | 2016-04-13 21:21:47 -0700 | [diff] [blame] | 119 | libbase \ |
| 120 | liblog \ |
| 121 | libutils \ |
Yabin Cui | 9946a8f | 2016-02-10 13:46:06 -0800 | [diff] [blame] | 122 | libLLVMObject \ |
| 123 | libLLVMBitReader \ |
| 124 | libLLVMMC \ |
| 125 | libLLVMMCParser \ |
| 126 | libLLVMCore \ |
| 127 | libLLVMSupport \ |
| 128 | |
| 129 | module := libbacktrace_offline |
| 130 | build_type := target |
| 131 | build_target := STATIC_LIBRARY |
Yabin Cui | 51e6070 | 2016-04-13 21:21:47 -0700 | [diff] [blame] | 132 | libbacktrace_offline_multilib := both |
| 133 | include $(LOCAL_PATH)/Android.build.mk |
| 134 | build_type := host |
Yabin Cui | 9946a8f | 2016-02-10 13:46:06 -0800 | [diff] [blame] | 135 | include $(LOCAL_PATH)/Android.build.mk |
| 136 | |
Christopher Ferris | 8540216 | 2016-01-25 16:17:48 -0800 | [diff] [blame] | 137 | #------------------------------------------------------------------------- |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 138 | # The libbacktrace_test library needed by backtrace_test. |
| 139 | #------------------------------------------------------------------------- |
| 140 | libbacktrace_test_cflags := \ |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 141 | -O0 \ |
| 142 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 143 | libbacktrace_test_src_files := \ |
| 144 | backtrace_testlib.c \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 145 | |
Yabin Cui | 9e402bb | 2015-09-22 04:46:57 +0000 | [diff] [blame] | 146 | libbacktrace_test_strip_module := false |
| 147 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 148 | module := libbacktrace_test |
| 149 | module_tag := debug |
| 150 | build_type := target |
| 151 | build_target := SHARED_LIBRARY |
Christopher Ferris | 2c43cff | 2015-03-26 19:18:36 -0700 | [diff] [blame] | 152 | libbacktrace_test_multilib := both |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 153 | include $(LOCAL_PATH)/Android.build.mk |
| 154 | build_type := host |
| 155 | include $(LOCAL_PATH)/Android.build.mk |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 156 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 157 | #------------------------------------------------------------------------- |
| 158 | # The backtrace_test executable. |
| 159 | #------------------------------------------------------------------------- |
| 160 | backtrace_test_cflags := \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 161 | -fno-builtin \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 162 | -O0 \ |
| 163 | -g \ |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 164 | |
| 165 | backtrace_test_cflags_target := \ |
Christopher Ferris | e296091 | 2014-03-07 19:42:19 -0800 | [diff] [blame] | 166 | -DENABLE_PSS_TESTS \ |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 167 | |
| 168 | backtrace_test_src_files := \ |
Yabin Cui | 9e402bb | 2015-09-22 04:46:57 +0000 | [diff] [blame] | 169 | backtrace_offline_test.cpp \ |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 170 | backtrace_test.cpp \ |
Christopher Ferris | e296091 | 2014-03-07 19:42:19 -0800 | [diff] [blame] | 171 | GetPss.cpp \ |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 172 | thread_utils.c \ |
| 173 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 174 | backtrace_test_ldlibs_host := \ |
Ying Wang | 9f437d7 | 2014-05-07 15:36:05 -0700 | [diff] [blame] | 175 | -lpthread \ |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 176 | -lrt \ |
| 177 | |
| 178 | backtrace_test_shared_libraries := \ |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 179 | libbacktrace_test \ |
| 180 | libbacktrace \ |
Christopher Ferris | 67aba68 | 2015-05-08 15:44:46 -0700 | [diff] [blame] | 181 | libbase \ |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 182 | libcutils \ |
Yabin Cui | 51e6070 | 2016-04-13 21:21:47 -0700 | [diff] [blame] | 183 | liblog \ |
Yabin Cui | 9e402bb | 2015-09-22 04:46:57 +0000 | [diff] [blame] | 184 | libunwind \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 185 | |
Christopher Ferris | 67aba68 | 2015-05-08 15:44:46 -0700 | [diff] [blame] | 186 | backtrace_test_shared_libraries_target += \ |
| 187 | libdl \ |
Yabin Cui | 51e6070 | 2016-04-13 21:21:47 -0700 | [diff] [blame] | 188 | libutils \ |
| 189 | libLLVM \ |
| 190 | |
| 191 | backtrace_test_static_libraries := \ |
| 192 | libbacktrace_offline \ |
| 193 | |
| 194 | backtrace_test_static_libraries_target := \ |
| 195 | libziparchive \ |
| 196 | libz \ |
| 197 | |
| 198 | backtrace_test_static_libraries_host := \ |
| 199 | libziparchive-host \ |
| 200 | libz \ |
| 201 | libutils \ |
| 202 | libLLVMObject \ |
| 203 | libLLVMBitReader \ |
| 204 | libLLVMMC \ |
| 205 | libLLVMMCParser \ |
| 206 | libLLVMCore \ |
| 207 | libLLVMSupport \ |
Christopher Ferris | 67aba68 | 2015-05-08 15:44:46 -0700 | [diff] [blame] | 208 | |
| 209 | backtrace_test_ldlibs_host += \ |
| 210 | -ldl \ |
Christopher Ferris | a2efd3a | 2014-05-06 15:23:59 -0700 | [diff] [blame] | 211 | |
Yabin Cui | 9e402bb | 2015-09-22 04:46:57 +0000 | [diff] [blame] | 212 | backtrace_test_strip_module := false |
| 213 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 214 | module := backtrace_test |
| 215 | module_tag := debug |
| 216 | build_type := target |
| 217 | build_target := NATIVE_TEST |
Christopher Ferris | 2c43cff | 2015-03-26 19:18:36 -0700 | [diff] [blame] | 218 | backtrace_test_multilib := both |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 219 | include $(LOCAL_PATH)/Android.build.mk |
| 220 | build_type := host |
| 221 | include $(LOCAL_PATH)/Android.build.mk |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 222 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 223 | #---------------------------------------------------------------------------- |
| 224 | # Special truncated libbacktrace library for mac. |
| 225 | #---------------------------------------------------------------------------- |
| 226 | ifeq ($(HOST_OS),darwin) |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 227 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 228 | include $(CLEAR_VARS) |
Christopher Ferris | f67c641 | 2014-01-10 00:43:54 -0800 | [diff] [blame] | 229 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 230 | LOCAL_MODULE := libbacktrace |
| 231 | LOCAL_MODULE_TAGS := optional |
| 232 | |
| 233 | LOCAL_SRC_FILES := \ |
| 234 | BacktraceMap.cpp \ |
| 235 | |
Dan Albert | 5570c9b | 2014-11-13 14:54:10 -0800 | [diff] [blame] | 236 | LOCAL_MULTILIB := both |
| 237 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 238 | include $(BUILD_HOST_SHARED_LIBRARY) |
| 239 | |
| 240 | endif # HOST_OS-darwin |