Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -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 | # |
| 16 | |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 17 | LOCAL_PATH := $(call my-dir) |
| 18 | |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 19 | libunwind_build_host := false |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 20 | ifeq ($(HOST_OS),linux) |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 21 | libunwind_build_host := true |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 22 | endif |
| 23 | |
Christopher Ferris | 76dbee5 | 2014-02-12 21:12:09 -0800 | [diff] [blame] | 24 | # Set to true to enable a debug build of the libraries. |
| 25 | # To control what is logged, set the environment variable UNW_DEBUG_LEVEL=x, |
| 26 | # where x controls the verbosity (from 1 to 20). |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 27 | libunwind_debug := false |
Christopher Ferris | 76dbee5 | 2014-02-12 21:12:09 -0800 | [diff] [blame] | 28 | |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 29 | libunwind_common_cppflags := \ |
| 30 | -Wno-old-style-cast \ |
Christopher Ferris | 4a59009 | 2015-03-07 11:32:24 -0800 | [diff] [blame] | 31 | |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 32 | libunwind_common_cflags := \ |
| 33 | -Wno-unused-parameter \ |
| 34 | -Werror \ |
Christopher Ferris | d1c383c | 2014-04-09 16:48:26 -0700 | [diff] [blame] | 35 | |
| 36 | # gcc 4.8 appears to be overeager declaring that a variable is uninitialized, |
| 37 | # under certain circumstances. Turn off this warning only for target so that |
| 38 | # coverage is still present for the host code. When the entire build system |
| 39 | # is switched to 4.9, then this can be removed. |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 40 | libunwind_common_cflags_target := \ |
| 41 | -Wno-maybe-uninitialized \ |
Christopher Ferris | d1c383c | 2014-04-09 16:48:26 -0700 | [diff] [blame] | 42 | |
Bernhard Rosenkraenzer | 25a2f1e | 2014-05-13 21:31:55 +0200 | [diff] [blame] | 43 | # src/mi/backtrace.c is misdetected as a bogus header guard by clang 3.5 |
Chih-Hung Hsieh | f760bf5 | 2014-10-03 09:33:43 -0700 | [diff] [blame] | 44 | # src/x86_64/Gstash_frame.c has unnecessary calls to labs. |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 45 | libunwind_common_clang_cflags += \ |
Chih-Hung Hsieh | f760bf5 | 2014-10-03 09:33:43 -0700 | [diff] [blame] | 46 | -Wno-header-guard \ |
| 47 | -Wno-absolute-value \ |
Bernhard Rosenkraenzer | 25a2f1e | 2014-05-13 21:31:55 +0200 | [diff] [blame] | 48 | |
Stephen Hines | bbd6a88 | 2015-03-31 09:37:48 -0700 | [diff] [blame^] | 49 | # The latest clang (r230699) does not allow SP/PC to be declared in inline asm lists. |
| 50 | libunwind_common_clang_cflags += \ |
| 51 | -Wno-inline-asm |
| 52 | |
Christopher Ferris | d1c383c | 2014-04-09 16:48:26 -0700 | [diff] [blame] | 53 | ifneq ($(debug),true) |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 54 | libunwind_common_cflags += \ |
| 55 | -DHAVE_CONFIG_H \ |
| 56 | -DNDEBUG \ |
| 57 | -D_GNU_SOURCE \ |
Christopher Ferris | 9fc75e8 | 2014-01-26 21:39:06 -0800 | [diff] [blame] | 58 | |
Christopher Ferris | 76dbee5 | 2014-02-12 21:12:09 -0800 | [diff] [blame] | 59 | else |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 60 | libunwind_common_cflags += \ |
| 61 | -DHAVE_CONFIG_H \ |
| 62 | -DDEBUG \ |
| 63 | -D_GNU_SOURCE \ |
| 64 | -U_FORTIFY_SOURCE \ |
Christopher Ferris | 76dbee5 | 2014-02-12 21:12:09 -0800 | [diff] [blame] | 65 | |
| 66 | endif |
Pavel Chupin | f1f90e7 | 2013-12-04 13:29:29 +0400 | [diff] [blame] | 67 | |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 68 | libunwind_common_c_includes := \ |
| 69 | $(LOCAL_PATH)/src \ |
| 70 | $(LOCAL_PATH)/include \ |
Colin Cross | 26183d2 | 2014-01-24 15:59:56 -0800 | [diff] [blame] | 71 | |
Duane Sand | 5cd02e1 | 2014-06-05 23:38:56 -0700 | [diff] [blame] | 72 | # Since mips and mips64 use the same source, only generate includes/srcs |
| 73 | # for the below set of arches. |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 74 | libunwind_generate_arches := arm arm64 mips x86 x86_64 |
Duane Sand | 5cd02e1 | 2014-06-05 23:38:56 -0700 | [diff] [blame] | 75 | # The complete list of arches used by Android.build.mk to set arch |
| 76 | # variables. |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 77 | libunwind_arches := $(libunwind_generate_arches) mips64 |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 78 | |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 79 | $(foreach arch,$(libunwind_generate_arches), \ |
| 80 | $(eval libunwind_common_c_includes_$(arch) := $(LOCAL_PATH)/include/tdep-$(arch))) |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 81 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 82 | #----------------------------------------------------------------------- |
| 83 | # libunwind shared library |
| 84 | #----------------------------------------------------------------------- |
| 85 | libunwind_src_files := \ |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 86 | src/mi/init.c \ |
| 87 | src/mi/flush_cache.c \ |
| 88 | src/mi/mempool.c \ |
| 89 | src/mi/strerror.c \ |
| 90 | src/mi/backtrace.c \ |
| 91 | src/mi/dyn-cancel.c \ |
| 92 | src/mi/dyn-info-list.c \ |
| 93 | src/mi/dyn-register.c \ |
| 94 | src/mi/map.c \ |
| 95 | src/mi/Lmap.c \ |
| 96 | src/mi/Ldyn-extract.c \ |
| 97 | src/mi/Lfind_dynamic_proc_info.c \ |
| 98 | src/mi/Lget_proc_info_by_ip.c \ |
| 99 | src/mi/Lget_proc_name.c \ |
| 100 | src/mi/Lput_dynamic_unwind_info.c \ |
| 101 | src/mi/Ldestroy_addr_space.c \ |
| 102 | src/mi/Lget_reg.c \ |
| 103 | src/mi/Lset_reg.c \ |
| 104 | src/mi/Lget_fpreg.c \ |
| 105 | src/mi/Lset_fpreg.c \ |
| 106 | src/mi/Lset_caching_policy.c \ |
| 107 | src/mi/Gdyn-extract.c \ |
| 108 | src/mi/Gdyn-remote.c \ |
| 109 | src/mi/Gfind_dynamic_proc_info.c \ |
| 110 | src/mi/Gget_accessors.c \ |
| 111 | src/mi/Gget_proc_info_by_ip.c \ |
| 112 | src/mi/Gget_proc_name.c \ |
| 113 | src/mi/Gput_dynamic_unwind_info.c \ |
| 114 | src/mi/Gdestroy_addr_space.c \ |
| 115 | src/mi/Gget_reg.c \ |
| 116 | src/mi/Gset_reg.c \ |
| 117 | src/mi/Gget_fpreg.c \ |
| 118 | src/mi/Gset_fpreg.c \ |
| 119 | src/mi/Gset_caching_policy.c \ |
| 120 | src/dwarf/Lexpr.c \ |
| 121 | src/dwarf/Lfde.c \ |
| 122 | src/dwarf/Lparser.c \ |
| 123 | src/dwarf/Lpe.c \ |
| 124 | src/dwarf/Lstep_dwarf.c \ |
| 125 | src/dwarf/Lfind_proc_info-lsb.c \ |
| 126 | src/dwarf/Lfind_unwind_table.c \ |
| 127 | src/dwarf/Gexpr.c \ |
| 128 | src/dwarf/Gfde.c \ |
| 129 | src/dwarf/Gfind_proc_info-lsb.c \ |
| 130 | src/dwarf/Gfind_unwind_table.c \ |
| 131 | src/dwarf/Gparser.c \ |
| 132 | src/dwarf/Gpe.c \ |
| 133 | src/dwarf/Gstep_dwarf.c \ |
| 134 | src/dwarf/global.c \ |
| 135 | src/os-common.c \ |
| 136 | src/os-linux.c \ |
| 137 | src/Los-common.c \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 138 | |
Christopher Ferris | 9fc75e8 | 2014-01-26 21:39:06 -0800 | [diff] [blame] | 139 | # Arch specific source files. |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 140 | $(foreach arch,$(libunwind_generate_arches), \ |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 141 | $(eval libunwind_src_files_$(arch) += \ |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 142 | src/$(arch)/is_fpreg.c \ |
| 143 | src/$(arch)/regname.c \ |
| 144 | src/$(arch)/Gcreate_addr_space.c \ |
| 145 | src/$(arch)/Gget_proc_info.c \ |
| 146 | src/$(arch)/Gget_save_loc.c \ |
| 147 | src/$(arch)/Gglobal.c \ |
| 148 | src/$(arch)/Ginit.c \ |
| 149 | src/$(arch)/Ginit_local.c \ |
| 150 | src/$(arch)/Ginit_remote.c \ |
| 151 | src/$(arch)/Gregs.c \ |
| 152 | src/$(arch)/Gresume.c \ |
| 153 | src/$(arch)/Gstep.c \ |
| 154 | src/$(arch)/Lcreate_addr_space.c \ |
| 155 | src/$(arch)/Lget_proc_info.c \ |
| 156 | src/$(arch)/Lget_save_loc.c \ |
| 157 | src/$(arch)/Lglobal.c \ |
| 158 | src/$(arch)/Linit.c \ |
| 159 | src/$(arch)/Linit_local.c \ |
| 160 | src/$(arch)/Linit_remote.c \ |
| 161 | src/$(arch)/Lregs.c \ |
| 162 | src/$(arch)/Lresume.c \ |
| 163 | src/$(arch)/Lstep.c \ |
| 164 | )) |
Christopher Ferris | 9fc75e8 | 2014-01-26 21:39:06 -0800 | [diff] [blame] | 165 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 166 | libunwind_src_files_arm += \ |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 167 | src/arm/getcontext.S \ |
| 168 | src/arm/Gis_signal_frame.c \ |
| 169 | src/arm/Gex_tables.c \ |
| 170 | src/arm/Lis_signal_frame.c \ |
| 171 | src/arm/Lex_tables.c \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 172 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 173 | libunwind_src_files_arm64 += \ |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 174 | src/aarch64/Gis_signal_frame.c \ |
| 175 | src/aarch64/Lis_signal_frame.c \ |
Christopher Ferris | 9fc75e8 | 2014-01-26 21:39:06 -0800 | [diff] [blame] | 176 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 177 | libunwind_src_files_mips += \ |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 178 | src/mips/getcontext-android.S \ |
| 179 | src/mips/Gis_signal_frame.c \ |
| 180 | src/mips/Lis_signal_frame.c \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 181 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 182 | libunwind_src_files_x86 += \ |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 183 | src/x86/getcontext-linux.S \ |
| 184 | src/x86/Gos-linux.c \ |
| 185 | src/x86/Los-linux.c \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 186 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 187 | libunwind_src_files_x86_64 += \ |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 188 | src/x86_64/getcontext.S \ |
| 189 | src/x86_64/Gstash_frame.c \ |
| 190 | src/x86_64/Gtrace.c \ |
| 191 | src/x86_64/Gos-linux.c \ |
| 192 | src/x86_64/Lstash_frame.c \ |
| 193 | src/x86_64/Ltrace.c \ |
| 194 | src/x86_64/Los-linux.c \ |
| 195 | src/x86_64/setcontext.S \ |
Pavel Chupin | f1f90e7 | 2013-12-04 13:29:29 +0400 | [diff] [blame] | 196 | |
Duane Sand | 5cd02e1 | 2014-06-05 23:38:56 -0700 | [diff] [blame] | 197 | # mips and mips64 use the same sources but define _MIP_SIM differently |
| 198 | # to change the behavior. |
| 199 | # mips uses o32 abi (_MIPS_SIM == _ABIO32). |
| 200 | # mips64 uses n64 abi (_MIPS_SIM == _ABI64). |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 201 | libunwind_common_c_includes_mips64 := $(LOCAL_PATH)/include/tdep-mips |
Duane Sand | 5cd02e1 | 2014-06-05 23:38:56 -0700 | [diff] [blame] | 202 | libunwind_src_files_mips64 := $(libunwind_src_files_mips) |
| 203 | |
| 204 | # 64-bit architectures |
| 205 | libunwind_src_files_arm64 += src/elf64.c |
| 206 | libunwind_src_files_mips64 += src/elf64.c |
| 207 | libunwind_src_files_x86_64 += src/elf64.c |
| 208 | |
| 209 | # 32-bit architectures |
| 210 | libunwind_src_files_arm += src/elf32.c |
| 211 | libunwind_src_files_mips += src/elf32.c |
| 212 | libunwind_src_files_x86 += src/elf32.c |
| 213 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 214 | libunwind_shared_libraries_target := \ |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 215 | libdl \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 216 | |
Dan Albert | 162c8cb | 2014-05-09 10:19:20 -0700 | [diff] [blame] | 217 | libunwind_ldflags_host := \ |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 218 | -nostdlib |
Dan Albert | 162c8cb | 2014-05-09 10:19:20 -0700 | [diff] [blame] | 219 | |
Christopher Ferris | f4a8df5 | 2014-03-07 19:40:06 -0800 | [diff] [blame] | 220 | libunwind_ldlibs_host := \ |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 221 | -lc \ |
| 222 | -lpthread \ |
Christopher Ferris | f4a8df5 | 2014-03-07 19:40:06 -0800 | [diff] [blame] | 223 | |
Trevor Drake | 9fcad64 | 2014-12-07 12:35:09 +0000 | [diff] [blame] | 224 | libunwind_export_c_include_dirs := \ |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 225 | $(LOCAL_PATH)/include |
Trevor Drake | 9fcad64 | 2014-12-07 12:35:09 +0000 | [diff] [blame] | 226 | |
Christopher Ferris | 76dbee5 | 2014-02-12 21:12:09 -0800 | [diff] [blame] | 227 | ifeq ($(debug),true) |
| 228 | libunwind_shared_libraries += \ |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 229 | liblog \ |
Christopher Ferris | 76dbee5 | 2014-02-12 21:12:09 -0800 | [diff] [blame] | 230 | |
| 231 | endif |
| 232 | |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 233 | libunwind_module := libunwind |
| 234 | libunwind_module_tag := optional |
| 235 | libunwind_build_type := target |
| 236 | libunwind_build_target := SHARED_LIBRARY |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 237 | include $(LOCAL_PATH)/Android.build.mk |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 238 | libunwind_build_type := host |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 239 | include $(LOCAL_PATH)/Android.build.mk |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 240 | libunwind_build_type := target |
| 241 | libunwind_build_target := STATIC_LIBRARY |
Dan Albert | 76728fb | 2014-05-09 13:51:35 -0700 | [diff] [blame] | 242 | include $(LOCAL_PATH)/Android.build.mk |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 243 | libunwind_build_type := host |
Dan Albert | 76728fb | 2014-05-09 13:51:35 -0700 | [diff] [blame] | 244 | include $(LOCAL_PATH)/Android.build.mk |
| 245 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 246 | #----------------------------------------------------------------------- |
| 247 | # libunwind-ptrace shared library |
| 248 | #----------------------------------------------------------------------- |
| 249 | libunwind-ptrace_src_files := \ |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 250 | src/ptrace/_UPT_elf.c \ |
| 251 | src/ptrace/_UPT_accessors.c \ |
| 252 | src/ptrace/_UPT_access_fpreg.c \ |
| 253 | src/ptrace/_UPT_access_mem.c \ |
| 254 | src/ptrace/_UPT_access_reg.c \ |
| 255 | src/ptrace/_UPT_create.c \ |
| 256 | src/ptrace/_UPT_destroy.c \ |
| 257 | src/ptrace/_UPT_find_proc_info.c \ |
| 258 | src/ptrace/_UPT_get_dyn_info_list_addr.c \ |
| 259 | src/ptrace/_UPT_put_unwind_info.c \ |
| 260 | src/ptrace/_UPT_get_proc_name.c \ |
| 261 | src/ptrace/_UPT_reg_offset.c \ |
| 262 | src/ptrace/_UPT_resume.c \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 263 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 264 | libunwind-ptrace_shared_libraries := \ |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 265 | libunwind \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 266 | |
Dan Albert | 162c8cb | 2014-05-09 10:19:20 -0700 | [diff] [blame] | 267 | libunwind-ptrace_ldflags_host := \ |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 268 | -nostdlib |
Dan Albert | 162c8cb | 2014-05-09 10:19:20 -0700 | [diff] [blame] | 269 | |
| 270 | libunwind-ptrace_ldlibs_host := \ |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 271 | -lc \ |
| 272 | -lpthread \ |
Christopher Ferris | f4a8df5 | 2014-03-07 19:40:06 -0800 | [diff] [blame] | 273 | |
Trevor Drake | 9fcad64 | 2014-12-07 12:35:09 +0000 | [diff] [blame] | 274 | libunwind-ptrace_export_c_include_dirs := \ |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 275 | $(LOCAL_PATH)/include |
Trevor Drake | 9fcad64 | 2014-12-07 12:35:09 +0000 | [diff] [blame] | 276 | |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 277 | ifeq ($(libunwind_debug),true) |
Christopher Ferris | 76dbee5 | 2014-02-12 21:12:09 -0800 | [diff] [blame] | 278 | libunwind-ptrace_shared_libraries += \ |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 279 | liblog \ |
Christopher Ferris | 76dbee5 | 2014-02-12 21:12:09 -0800 | [diff] [blame] | 280 | |
| 281 | endif |
| 282 | |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 283 | libunwind_module := libunwind-ptrace |
| 284 | libunwind_module_tag := optional |
| 285 | libunwind_build_type := target |
| 286 | libunwind_build_target := SHARED_LIBRARY |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 287 | include $(LOCAL_PATH)/Android.build.mk |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 288 | libunwind_build_type := host |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 289 | include $(LOCAL_PATH)/Android.build.mk |
Christopher Ferris | 7c04242 | 2014-04-25 13:21:40 -0700 | [diff] [blame] | 290 | |
| 291 | #----------------------------------------------------------------------- |
Christopher Ferris | aa94648 | 2014-06-19 11:04:34 -0700 | [diff] [blame] | 292 | # libunwindbacktrace static library |
| 293 | #----------------------------------------------------------------------- |
| 294 | libunwindbacktrace_src_files += \ |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 295 | src/unwind/BacktraceWrapper.c \ |
| 296 | src/unwind/DeleteException.c \ |
| 297 | src/unwind/FindEnclosingFunction.c \ |
| 298 | src/unwind/ForcedUnwind.c \ |
| 299 | src/unwind/GetBSP.c \ |
| 300 | src/unwind/GetCFA.c \ |
| 301 | src/unwind/GetDataRelBase.c \ |
| 302 | src/unwind/GetGR.c \ |
| 303 | src/unwind/GetIP.c \ |
| 304 | src/unwind/GetIPInfo.c \ |
| 305 | src/unwind/GetLanguageSpecificData.c \ |
| 306 | src/unwind/GetRegionStart.c \ |
| 307 | src/unwind/GetTextRelBase.c \ |
| 308 | src/unwind/RaiseException.c \ |
| 309 | src/unwind/Resume.c \ |
| 310 | src/unwind/Resume_or_Rethrow.c \ |
| 311 | src/unwind/SetGR.c \ |
| 312 | src/unwind/SetIP.c \ |
Christopher Ferris | aa94648 | 2014-06-19 11:04:34 -0700 | [diff] [blame] | 313 | |
| 314 | libunwindbacktrace_cflags += \ |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 315 | -Wno-old-style-declaration \ |
| 316 | -fvisibility=hidden \ |
Christopher Ferris | aa94648 | 2014-06-19 11:04:34 -0700 | [diff] [blame] | 317 | |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 318 | libunwind_module := libunwindbacktrace |
| 319 | libunwind_module_tag := optional |
| 320 | libunwind_build_type := target |
| 321 | libunwind_build_target := STATIC_LIBRARY |
Christopher Ferris | aa94648 | 2014-06-19 11:04:34 -0700 | [diff] [blame] | 322 | libunwindbacktrace_whole_static_libraries := libunwind |
| 323 | include $(LOCAL_PATH)/Android.build.mk |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 324 | libunwind_build_type := host |
Christopher Ferris | aa94648 | 2014-06-19 11:04:34 -0700 | [diff] [blame] | 325 | include $(LOCAL_PATH)/Android.build.mk |
| 326 | |
| 327 | #----------------------------------------------------------------------- |
Christopher Ferris | 7c04242 | 2014-04-25 13:21:40 -0700 | [diff] [blame] | 328 | # libunwind testing |
| 329 | #----------------------------------------------------------------------- |
| 330 | libunwind-unit-tests_cflags := \ |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 331 | -fno-builtin \ |
| 332 | -O0 \ |
| 333 | -g \ |
Christopher Ferris | 7c04242 | 2014-04-25 13:21:40 -0700 | [diff] [blame] | 334 | |
| 335 | libunwind-unit-tests_c_includes := \ |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 336 | $(LOCAL_PATH)/include \ |
Christopher Ferris | 7c04242 | 2014-04-25 13:21:40 -0700 | [diff] [blame] | 337 | |
| 338 | libunwind-unit-tests_src_files := \ |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 339 | android/tests/local_test.cpp \ |
Christopher Ferris | 7c04242 | 2014-04-25 13:21:40 -0700 | [diff] [blame] | 340 | |
| 341 | libunwind-unit-tests_shared_libraries := \ |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 342 | libunwind \ |
Christopher Ferris | 7c04242 | 2014-04-25 13:21:40 -0700 | [diff] [blame] | 343 | |
| 344 | libunwind-unit-tests_multilib := both |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 345 | libunwind_module := libunwind-unit-tests |
| 346 | libunwind_module_tag := optional |
| 347 | libunwind_build_type := target |
| 348 | libunwind_build_target := NATIVE_TEST |
Christopher Ferris | 7c04242 | 2014-04-25 13:21:40 -0700 | [diff] [blame] | 349 | include $(LOCAL_PATH)/Android.build.mk |
Christopher Ferris | 465f73c | 2015-03-10 16:40:25 -0700 | [diff] [blame] | 350 | libunwind_build_type := host |
Christopher Ferris | 7c04242 | 2014-04-25 13:21:40 -0700 | [diff] [blame] | 351 | include $(LOCAL_PATH)/Android.build.mk |
| 352 | |
| 353 | # Run the unit tests built for x86 or x86_64. |
| 354 | ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64)) |
| 355 | ifneq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86)) |
| 356 | LINKER = linker64 |
| 357 | TEST_SUFFIX = 64 |
| 358 | else |
| 359 | LINKER = linker |
| 360 | TEST_SUFFIX = 32 |
| 361 | endif |
| 362 | |
| 363 | libunwind-unit-tests-run-on-host: libunwind-unit-tests $(TARGET_OUT_EXECUTABLES)/$(LINKER) $(TARGET_OUT_EXECUTABLES)/sh |
| 364 | if [ ! -d /system -o ! -d /system/bin ]; then \ |
| 365 | echo "Attempting to create /system/bin"; \ |
| 366 | sudo mkdir -p -m 0777 /system/bin; \ |
| 367 | fi |
| 368 | mkdir -p $(TARGET_OUT_DATA)/local/tmp |
| 369 | cp $(TARGET_OUT_EXECUTABLES)/$(LINKER) /system/bin |
| 370 | cp $(TARGET_OUT_EXECUTABLES)/sh /system/bin |
| 371 | ANDROID_DATA=$(TARGET_OUT_DATA) \ |
| 372 | ANDROID_ROOT=$(TARGET_OUT) \ |
| 373 | LD_LIBRARY_PATH=$(TARGET_OUT_SHARED_LIBRARIES) \ |
| 374 | $(TARGET_OUT_DATA_NATIVE_TESTS)/libunwind-unit-tests/libunwind-unit-tests$(TEST_SUFFIX) $(LIBUNWIND_TEST_FLAGS) |
| 375 | endif |