| 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 \ | 
| Yabin Cui | 9e402bb | 2015-09-22 04:46:57 +0000 | [diff] [blame] | 28 | -I external/libunwind/include/tdep \ | 
| Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 29 |  | 
| Stephen Hines | 035e9ba | 2015-03-31 09:39:20 -0700 | [diff] [blame] | 30 | # The latest clang (r230699) does not allow SP/PC to be declared in inline asm lists. | 
|  | 31 | libbacktrace_common_clang_cflags += \ | 
|  | 32 | -Wno-inline-asm | 
|  | 33 |  | 
| Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 34 | build_host := false | 
|  | 35 | ifeq ($(HOST_OS),linux) | 
|  | 36 | ifeq ($(HOST_ARCH),$(filter $(HOST_ARCH),x86 x86_64)) | 
|  | 37 | build_host := true | 
|  | 38 | endif | 
|  | 39 | endif | 
|  | 40 |  | 
| Yabin Cui | 9e402bb | 2015-09-22 04:46:57 +0000 | [diff] [blame] | 41 | LLVM_ROOT_PATH := external/llvm | 
|  | 42 | include $(LLVM_ROOT_PATH)/llvm.mk | 
|  | 43 |  | 
| Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 44 | #------------------------------------------------------------------------- | 
|  | 45 | # The libbacktrace library. | 
|  | 46 | #------------------------------------------------------------------------- | 
|  | 47 | libbacktrace_src_files := \ | 
| Christopher Ferris | 2c43cff | 2015-03-26 19:18:36 -0700 | [diff] [blame] | 48 | Backtrace.cpp \ | 
|  | 49 | BacktraceCurrent.cpp \ | 
| Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 50 | BacktraceMap.cpp \ | 
| Christopher Ferris | 2c43cff | 2015-03-26 19:18:36 -0700 | [diff] [blame] | 51 | BacktracePtrace.cpp \ | 
| Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 52 | thread_utils.c \ | 
| Christopher Ferris | 2c43cff | 2015-03-26 19:18:36 -0700 | [diff] [blame] | 53 | ThreadEntry.cpp \ | 
| Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 54 | UnwindCurrent.cpp \ | 
| Christopher Ferris | df29061 | 2014-01-22 19:21:07 -0800 | [diff] [blame] | 55 | UnwindMap.cpp \ | 
| Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 56 | UnwindPtrace.cpp \ | 
| Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 57 |  | 
| Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 58 | libbacktrace_shared_libraries := \ | 
| Christopher Ferris | 2c43cff | 2015-03-26 19:18:36 -0700 | [diff] [blame] | 59 | libbase \ | 
| Christopher Ferris | 9e1ee2b | 2013-10-02 14:19:19 -0700 | [diff] [blame] | 60 | liblog \ | 
| Colin Cross | db134ca | 2015-04-28 17:49:42 -0700 | [diff] [blame] | 61 | libunwind \ | 
| Christopher Ferris | f67c641 | 2014-01-10 00:43:54 -0800 | [diff] [blame] | 62 |  | 
| Than McIntosh | 1e0fea2 | 2016-02-01 10:17:45 -0500 | [diff] [blame] | 63 | libbacktrace_static_libraries := \ | 
|  | 64 | libcutils | 
|  | 65 |  | 
| Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 66 | module := libbacktrace | 
|  | 67 | module_tag := optional | 
|  | 68 | build_type := target | 
|  | 69 | build_target := SHARED_LIBRARY | 
|  | 70 | include $(LOCAL_PATH)/Android.build.mk | 
|  | 71 | build_type := host | 
| Dan Albert | 0d7164d | 2014-11-11 15:15:21 -0800 | [diff] [blame] | 72 | libbacktrace_multilib := both | 
| Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 73 | include $(LOCAL_PATH)/Android.build.mk | 
| Yabin Cui | 9946a8f | 2016-02-10 13:46:06 -0800 | [diff] [blame] | 74 |  | 
|  | 75 | libbacktrace_shared_libraries := | 
|  | 76 |  | 
| Calin Juravle | 28042b5 | 2015-06-08 14:30:52 +0100 | [diff] [blame] | 77 | libbacktrace_static_libraries := \ | 
|  | 78 | libbase \ | 
|  | 79 | liblog \ | 
|  | 80 | libunwind \ | 
| Yabin Cui | 9946a8f | 2016-02-10 13:46:06 -0800 | [diff] [blame] | 81 | liblzma \ | 
| Calin Juravle | 28042b5 | 2015-06-08 14:30:52 +0100 | [diff] [blame] | 82 |  | 
| Yabin Cui | 9946a8f | 2016-02-10 13:46:06 -0800 | [diff] [blame] | 83 | module := libbacktrace | 
|  | 84 | build_type := target | 
| Calin Juravle | 28042b5 | 2015-06-08 14:30:52 +0100 | [diff] [blame] | 85 | build_target := STATIC_LIBRARY | 
|  | 86 | include $(LOCAL_PATH)/Android.build.mk | 
| Yabin Cui | 9946a8f | 2016-02-10 13:46:06 -0800 | [diff] [blame] | 87 | build_type := host | 
|  | 88 | libbacktrace_multilib := both | 
|  | 89 | include $(LOCAL_PATH)/Android.build.mk | 
| Christopher Ferris | 9e1ee2b | 2013-10-02 14:19:19 -0700 | [diff] [blame] | 90 |  | 
| Dan Albert | 40a46dd | 2014-05-19 10:10:37 -0700 | [diff] [blame] | 91 | #------------------------------------------------------------------------- | 
| Christopher Ferris | 8540216 | 2016-01-25 16:17:48 -0800 | [diff] [blame] | 92 | # The libbacktrace_offline shared library. | 
|  | 93 | #------------------------------------------------------------------------- | 
|  | 94 | libbacktrace_offline_src_files := \ | 
|  | 95 | BacktraceOffline.cpp \ | 
|  | 96 |  | 
|  | 97 | libbacktrace_offline_shared_libraries := \ | 
|  | 98 | libbacktrace \ | 
|  | 99 | liblog \ | 
|  | 100 | libunwind \ | 
|  | 101 |  | 
|  | 102 | # Use shared llvm library on device to save space. | 
|  | 103 | libbacktrace_offline_shared_libraries_target := \ | 
|  | 104 | libLLVM \ | 
|  | 105 |  | 
|  | 106 | # Use static llvm libraries on host to remove dependency on 32-bit llvm shared library | 
|  | 107 | # which is not included in the prebuilt. | 
|  | 108 | libbacktrace_offline_static_libraries_host := \ | 
|  | 109 | libLLVMObject \ | 
|  | 110 | libLLVMBitReader \ | 
|  | 111 | libLLVMMC \ | 
|  | 112 | libLLVMMCParser \ | 
|  | 113 | libLLVMCore \ | 
|  | 114 | libLLVMSupport \ | 
|  | 115 |  | 
|  | 116 | module := libbacktrace_offline | 
| Christopher Ferris | 8540216 | 2016-01-25 16:17:48 -0800 | [diff] [blame] | 117 | build_type := target | 
|  | 118 | build_target := SHARED_LIBRARY | 
|  | 119 | include $(LOCAL_PATH)/Android.build.mk | 
|  | 120 | build_type := host | 
|  | 121 | libbacktrace_multilib := both | 
|  | 122 | include $(LOCAL_PATH)/Android.build.mk | 
|  | 123 |  | 
| Yabin Cui | 9946a8f | 2016-02-10 13:46:06 -0800 | [diff] [blame] | 124 | libbacktrace_offline_shared_libraries := | 
|  | 125 | libbacktrace_offline_static_libraries := \ | 
|  | 126 | libbacktrace \ | 
|  | 127 | libbase \ | 
|  | 128 | libcutils \ | 
|  | 129 | liblog \ | 
|  | 130 | libunwind \ | 
|  | 131 | liblzma \ | 
|  | 132 | libLLVMObject \ | 
|  | 133 | libLLVMBitReader \ | 
|  | 134 | libLLVMMC \ | 
|  | 135 | libLLVMMCParser \ | 
|  | 136 | libLLVMCore \ | 
|  | 137 | libLLVMSupport \ | 
|  | 138 |  | 
|  | 139 | module := libbacktrace_offline | 
|  | 140 | build_type := target | 
|  | 141 | build_target := STATIC_LIBRARY | 
|  | 142 | include $(LOCAL_PATH)/Android.build.mk | 
|  | 143 |  | 
| Christopher Ferris | 8540216 | 2016-01-25 16:17:48 -0800 | [diff] [blame] | 144 | #------------------------------------------------------------------------- | 
| Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 145 | # The libbacktrace_test library needed by backtrace_test. | 
|  | 146 | #------------------------------------------------------------------------- | 
|  | 147 | libbacktrace_test_cflags := \ | 
| Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 148 | -O0 \ | 
|  | 149 |  | 
| Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 150 | libbacktrace_test_src_files := \ | 
|  | 151 | backtrace_testlib.c \ | 
| Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 152 |  | 
| Yabin Cui | 9e402bb | 2015-09-22 04:46:57 +0000 | [diff] [blame] | 153 | libbacktrace_test_strip_module := false | 
|  | 154 |  | 
| Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 155 | module := libbacktrace_test | 
|  | 156 | module_tag := debug | 
|  | 157 | build_type := target | 
|  | 158 | build_target := SHARED_LIBRARY | 
| Christopher Ferris | 2c43cff | 2015-03-26 19:18:36 -0700 | [diff] [blame] | 159 | libbacktrace_test_multilib := both | 
| Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 160 | include $(LOCAL_PATH)/Android.build.mk | 
|  | 161 | build_type := host | 
|  | 162 | include $(LOCAL_PATH)/Android.build.mk | 
| Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 163 |  | 
| Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 164 | #------------------------------------------------------------------------- | 
|  | 165 | # The backtrace_test executable. | 
|  | 166 | #------------------------------------------------------------------------- | 
|  | 167 | backtrace_test_cflags := \ | 
| Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 168 | -fno-builtin \ | 
| Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 169 | -O0 \ | 
|  | 170 | -g \ | 
| Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 171 |  | 
|  | 172 | backtrace_test_cflags_target := \ | 
| Christopher Ferris | e296091 | 2014-03-07 19:42:19 -0800 | [diff] [blame] | 173 | -DENABLE_PSS_TESTS \ | 
| Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 174 |  | 
|  | 175 | backtrace_test_src_files := \ | 
| Yabin Cui | 9e402bb | 2015-09-22 04:46:57 +0000 | [diff] [blame] | 176 | backtrace_offline_test.cpp \ | 
| Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 177 | backtrace_test.cpp \ | 
| Christopher Ferris | e296091 | 2014-03-07 19:42:19 -0800 | [diff] [blame] | 178 | GetPss.cpp \ | 
| Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 179 | thread_utils.c \ | 
|  | 180 |  | 
| Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 181 | backtrace_test_ldlibs_host := \ | 
| Ying Wang | 9f437d7 | 2014-05-07 15:36:05 -0700 | [diff] [blame] | 182 | -lpthread \ | 
| Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 183 | -lrt \ | 
|  | 184 |  | 
|  | 185 | backtrace_test_shared_libraries := \ | 
| Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 186 | libbacktrace_test \ | 
|  | 187 | libbacktrace \ | 
| Christopher Ferris | 8540216 | 2016-01-25 16:17:48 -0800 | [diff] [blame] | 188 | libbacktrace_offline \ | 
| Christopher Ferris | 67aba68 | 2015-05-08 15:44:46 -0700 | [diff] [blame] | 189 | libbase \ | 
| Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 190 | libcutils \ | 
| Yabin Cui | 9e402bb | 2015-09-22 04:46:57 +0000 | [diff] [blame] | 191 | libunwind \ | 
| Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 192 |  | 
| Christopher Ferris | 67aba68 | 2015-05-08 15:44:46 -0700 | [diff] [blame] | 193 | backtrace_test_shared_libraries_target += \ | 
|  | 194 | libdl \ | 
|  | 195 |  | 
|  | 196 | backtrace_test_ldlibs_host += \ | 
|  | 197 | -ldl \ | 
| Christopher Ferris | a2efd3a | 2014-05-06 15:23:59 -0700 | [diff] [blame] | 198 |  | 
| Yabin Cui | 9e402bb | 2015-09-22 04:46:57 +0000 | [diff] [blame] | 199 | backtrace_test_strip_module := false | 
|  | 200 |  | 
| Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 201 | module := backtrace_test | 
|  | 202 | module_tag := debug | 
|  | 203 | build_type := target | 
|  | 204 | build_target := NATIVE_TEST | 
| Christopher Ferris | 2c43cff | 2015-03-26 19:18:36 -0700 | [diff] [blame] | 205 | backtrace_test_multilib := both | 
| Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 206 | include $(LOCAL_PATH)/Android.build.mk | 
|  | 207 | build_type := host | 
|  | 208 | include $(LOCAL_PATH)/Android.build.mk | 
| Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 209 |  | 
| Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 210 | #---------------------------------------------------------------------------- | 
|  | 211 | # Special truncated libbacktrace library for mac. | 
|  | 212 | #---------------------------------------------------------------------------- | 
|  | 213 | ifeq ($(HOST_OS),darwin) | 
| Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 214 |  | 
| Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 215 | include $(CLEAR_VARS) | 
| Christopher Ferris | f67c641 | 2014-01-10 00:43:54 -0800 | [diff] [blame] | 216 |  | 
| Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 217 | LOCAL_MODULE := libbacktrace | 
|  | 218 | LOCAL_MODULE_TAGS := optional | 
|  | 219 |  | 
|  | 220 | LOCAL_SRC_FILES := \ | 
|  | 221 | BacktraceMap.cpp \ | 
|  | 222 |  | 
| Dan Albert | 5570c9b | 2014-11-13 14:54:10 -0800 | [diff] [blame] | 223 | LOCAL_MULTILIB := both | 
|  | 224 |  | 
| Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 225 | include $(BUILD_HOST_SHARED_LIBRARY) | 
|  | 226 |  | 
|  | 227 | endif # HOST_OS-darwin |