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