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) |
| 21 | ifeq ($(HOST_ARCH),$(filter $(HOST_ARCH),x86 x86_64)) |
| 22 | build_host := true |
Ying Wang | 57c68a3 | 2014-02-21 15:53:33 -0800 | [diff] [blame] | 23 | my_host_arch := $(HOST_ARCH) |
Christopher Ferris | 3fa4997 | 2014-01-31 15:07:26 -0800 | [diff] [blame] | 24 | ifneq ($(strip $(BUILD_HOST_64bit)),) |
Ying Wang | 57c68a3 | 2014-02-21 15:53:33 -0800 | [diff] [blame] | 25 | my_host_arch := x86_64 |
Christopher Ferris | 3fa4997 | 2014-01-31 15:07:26 -0800 | [diff] [blame] | 26 | endif |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 27 | endif |
| 28 | endif |
| 29 | |
Christopher Ferris | 76dbee5 | 2014-02-12 21:12:09 -0800 | [diff] [blame] | 30 | # Set to true to enable a debug build of the libraries. |
| 31 | # To control what is logged, set the environment variable UNW_DEBUG_LEVEL=x, |
| 32 | # where x controls the verbosity (from 1 to 20). |
| 33 | debug := false |
| 34 | |
Christopher Ferris | d1c383c | 2014-04-09 16:48:26 -0700 | [diff] [blame] | 35 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 36 | common_cflags := \ |
Christopher Ferris | d1c383c | 2014-04-09 16:48:26 -0700 | [diff] [blame] | 37 | -Wno-unused-parameter \ |
| 38 | -Werror \ |
| 39 | |
| 40 | # gcc 4.8 appears to be overeager declaring that a variable is uninitialized, |
| 41 | # under certain circumstances. Turn off this warning only for target so that |
| 42 | # coverage is still present for the host code. When the entire build system |
| 43 | # is switched to 4.9, then this can be removed. |
| 44 | common_cflags_target := \ |
| 45 | -Wno-maybe-uninitialized \ |
| 46 | |
| 47 | ifneq ($(debug),true) |
| 48 | common_cflags += \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 49 | -DHAVE_CONFIG_H \ |
| 50 | -DNDEBUG \ |
| 51 | -D_GNU_SOURCE \ |
Christopher Ferris | 9fc75e8 | 2014-01-26 21:39:06 -0800 | [diff] [blame] | 52 | |
Christopher Ferris | 76dbee5 | 2014-02-12 21:12:09 -0800 | [diff] [blame] | 53 | else |
Christopher Ferris | d1c383c | 2014-04-09 16:48:26 -0700 | [diff] [blame] | 54 | common_cflags += \ |
Christopher Ferris | 76dbee5 | 2014-02-12 21:12:09 -0800 | [diff] [blame] | 55 | -DHAVE_CONFIG_H \ |
| 56 | -DDEBUG \ |
| 57 | -D_GNU_SOURCE \ |
| 58 | -U_FORTIFY_SOURCE \ |
| 59 | |
| 60 | endif |
Pavel Chupin | f1f90e7 | 2013-12-04 13:29:29 +0400 | [diff] [blame] | 61 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 62 | common_c_includes := \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 63 | $(LOCAL_PATH)/src \ |
| 64 | $(LOCAL_PATH)/include \ |
Colin Cross | 26183d2 | 2014-01-24 15:59:56 -0800 | [diff] [blame] | 65 | |
Pavel Chupin | f1f90e7 | 2013-12-04 13:29:29 +0400 | [diff] [blame] | 66 | libunwind_arches := arm arm64 mips x86 x86_64 |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 67 | |
Colin Cross | 26183d2 | 2014-01-24 15:59:56 -0800 | [diff] [blame] | 68 | $(foreach arch,$(libunwind_arches), \ |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 69 | $(eval common_c_includes_$(arch) := $(LOCAL_PATH)/include/tdep-$(arch))) |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 70 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 71 | #----------------------------------------------------------------------- |
| 72 | # libunwind shared library |
| 73 | #----------------------------------------------------------------------- |
| 74 | libunwind_src_files := \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 75 | src/mi/init.c \ |
| 76 | src/mi/flush_cache.c \ |
| 77 | src/mi/mempool.c \ |
| 78 | src/mi/strerror.c \ |
| 79 | src/mi/backtrace.c \ |
| 80 | src/mi/dyn-cancel.c \ |
| 81 | src/mi/dyn-info-list.c \ |
| 82 | src/mi/dyn-register.c \ |
Christopher Ferris | f4a8df5 | 2014-03-07 19:40:06 -0800 | [diff] [blame] | 83 | src/mi/map.c \ |
| 84 | src/mi/Lmap.c \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 85 | src/mi/Ldyn-extract.c \ |
| 86 | src/mi/Lfind_dynamic_proc_info.c \ |
| 87 | src/mi/Lget_proc_info_by_ip.c \ |
| 88 | src/mi/Lget_proc_name.c \ |
| 89 | src/mi/Lput_dynamic_unwind_info.c \ |
| 90 | src/mi/Ldestroy_addr_space.c \ |
| 91 | src/mi/Lget_reg.c \ |
| 92 | src/mi/Lset_reg.c \ |
| 93 | src/mi/Lget_fpreg.c \ |
| 94 | src/mi/Lset_fpreg.c \ |
| 95 | src/mi/Lset_caching_policy.c \ |
| 96 | src/mi/Gdyn-extract.c \ |
| 97 | src/mi/Gdyn-remote.c \ |
| 98 | src/mi/Gfind_dynamic_proc_info.c \ |
| 99 | src/mi/Gget_accessors.c \ |
| 100 | src/mi/Gget_proc_info_by_ip.c \ |
| 101 | src/mi/Gget_proc_name.c \ |
| 102 | src/mi/Gput_dynamic_unwind_info.c \ |
| 103 | src/mi/Gdestroy_addr_space.c \ |
| 104 | src/mi/Gget_reg.c \ |
| 105 | src/mi/Gset_reg.c \ |
| 106 | src/mi/Gget_fpreg.c \ |
| 107 | src/mi/Gset_fpreg.c \ |
| 108 | src/mi/Gset_caching_policy.c \ |
| 109 | src/dwarf/Lexpr.c \ |
| 110 | src/dwarf/Lfde.c \ |
| 111 | src/dwarf/Lparser.c \ |
| 112 | src/dwarf/Lpe.c \ |
| 113 | src/dwarf/Lstep.c \ |
| 114 | src/dwarf/Lfind_proc_info-lsb.c \ |
| 115 | src/dwarf/Lfind_unwind_table.c \ |
| 116 | src/dwarf/Gexpr.c \ |
| 117 | src/dwarf/Gfde.c \ |
| 118 | src/dwarf/Gfind_proc_info-lsb.c \ |
| 119 | src/dwarf/Gfind_unwind_table.c \ |
| 120 | src/dwarf/Gparser.c \ |
| 121 | src/dwarf/Gpe.c \ |
| 122 | src/dwarf/Gstep.c \ |
| 123 | src/dwarf/global.c \ |
Christopher Ferris | f4a8df5 | 2014-03-07 19:40:06 -0800 | [diff] [blame] | 124 | src/os-common.c \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 125 | src/os-linux.c \ |
Christopher Ferris | f4a8df5 | 2014-03-07 19:40:06 -0800 | [diff] [blame] | 126 | src/Los-common.c \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 127 | |
Christopher Ferris | 9fc75e8 | 2014-01-26 21:39:06 -0800 | [diff] [blame] | 128 | # Arch specific source files. |
Colin Cross | 26183d2 | 2014-01-24 15:59:56 -0800 | [diff] [blame] | 129 | $(foreach arch,$(libunwind_arches), \ |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 130 | $(eval libunwind_src_files_$(arch) += \ |
| 131 | src/$(arch)/is_fpreg.c \ |
| 132 | src/$(arch)/regname.c \ |
| 133 | src/$(arch)/Gcreate_addr_space.c \ |
| 134 | src/$(arch)/Gget_proc_info.c \ |
| 135 | src/$(arch)/Gget_save_loc.c \ |
| 136 | src/$(arch)/Gglobal.c \ |
| 137 | src/$(arch)/Ginit.c \ |
| 138 | src/$(arch)/Ginit_local.c \ |
| 139 | src/$(arch)/Ginit_remote.c \ |
| 140 | src/$(arch)/Gregs.c \ |
| 141 | src/$(arch)/Gresume.c \ |
| 142 | src/$(arch)/Gstep.c \ |
| 143 | src/$(arch)/Lcreate_addr_space.c \ |
| 144 | src/$(arch)/Lget_proc_info.c \ |
| 145 | src/$(arch)/Lget_save_loc.c \ |
| 146 | src/$(arch)/Lglobal.c \ |
| 147 | src/$(arch)/Linit.c \ |
| 148 | src/$(arch)/Linit_local.c \ |
| 149 | src/$(arch)/Linit_remote.c \ |
| 150 | src/$(arch)/Lregs.c \ |
| 151 | src/$(arch)/Lresume.c \ |
| 152 | src/$(arch)/Lstep.c \ |
Colin Cross | 26183d2 | 2014-01-24 15:59:56 -0800 | [diff] [blame] | 153 | )) |
Christopher Ferris | 9fc75e8 | 2014-01-26 21:39:06 -0800 | [diff] [blame] | 154 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 155 | # 64-bit architectures |
| 156 | libunwind_src_files_arm64 += src/elf64.c |
| 157 | libunwind_src_files_x86_64 += src/elf64.c |
| 158 | |
| 159 | # 32-bit architectures |
| 160 | libunwind_src_files_arm += src/elf32.c |
| 161 | libunwind_src_files_mips += src/elf32.c |
| 162 | libunwind_src_files_x86 += src/elf32.c |
| 163 | |
| 164 | libunwind_src_files_arm += \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 165 | src/arm/getcontext.S \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 166 | src/arm/Gis_signal_frame.c \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 167 | src/arm/Gex_tables.c \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 168 | src/arm/Lis_signal_frame.c \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 169 | src/arm/Lex_tables.c \ |
| 170 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 171 | libunwind_src_files_arm64 += \ |
Christopher Ferris | 9fc75e8 | 2014-01-26 21:39:06 -0800 | [diff] [blame] | 172 | src/aarch64/Gis_signal_frame.c \ |
| 173 | src/aarch64/Lis_signal_frame.c \ |
| 174 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 175 | libunwind_src_files_mips += \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 176 | src/mips/getcontext-android.S \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 177 | src/mips/Gis_signal_frame.c \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 178 | src/mips/Lis_signal_frame.c \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 179 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 180 | libunwind_src_files_x86 += \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 181 | src/x86/getcontext-linux.S \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 182 | src/x86/Gos-linux.c \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 183 | src/x86/Los-linux.c \ |
| 184 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 185 | libunwind_src_files_x86_64 += \ |
Pavel Chupin | f1f90e7 | 2013-12-04 13:29:29 +0400 | [diff] [blame] | 186 | src/x86_64/getcontext.S \ |
| 187 | src/x86_64/Gstash_frame.c \ |
| 188 | src/x86_64/Gtrace.c \ |
| 189 | src/x86_64/Gos-linux.c \ |
| 190 | src/x86_64/Lstash_frame.c \ |
| 191 | src/x86_64/Ltrace.c \ |
| 192 | src/x86_64/Los-linux.c \ |
| 193 | src/x86_64/setcontext.S \ |
| 194 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 195 | libunwind_shared_libraries_target := \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 196 | libdl \ |
| 197 | |
Christopher Ferris | f4a8df5 | 2014-03-07 19:40:06 -0800 | [diff] [blame] | 198 | libunwind_ldlibs_host := \ |
| 199 | -lpthread \ |
| 200 | |
Christopher Ferris | 76dbee5 | 2014-02-12 21:12:09 -0800 | [diff] [blame] | 201 | ifeq ($(debug),true) |
| 202 | libunwind_shared_libraries += \ |
| 203 | liblog \ |
| 204 | |
| 205 | endif |
| 206 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 207 | module := libunwind |
| 208 | module_tag := optional |
| 209 | build_type := target |
| 210 | build_target := SHARED_LIBRARY |
| 211 | include $(LOCAL_PATH)/Android.build.mk |
| 212 | build_type := host |
| 213 | include $(LOCAL_PATH)/Android.build.mk |
Christopher Ferris | 836d915 | 2013-12-02 12:27:30 -0800 | [diff] [blame] | 214 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 215 | #----------------------------------------------------------------------- |
| 216 | # libunwind-ptrace shared library |
| 217 | #----------------------------------------------------------------------- |
| 218 | libunwind-ptrace_src_files := \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 219 | src/ptrace/_UPT_elf.c \ |
| 220 | src/ptrace/_UPT_accessors.c \ |
| 221 | src/ptrace/_UPT_access_fpreg.c \ |
| 222 | src/ptrace/_UPT_access_mem.c \ |
| 223 | src/ptrace/_UPT_access_reg.c \ |
| 224 | src/ptrace/_UPT_create.c \ |
| 225 | src/ptrace/_UPT_destroy.c \ |
| 226 | src/ptrace/_UPT_find_proc_info.c \ |
| 227 | src/ptrace/_UPT_get_dyn_info_list_addr.c \ |
| 228 | src/ptrace/_UPT_put_unwind_info.c \ |
| 229 | src/ptrace/_UPT_get_proc_name.c \ |
| 230 | src/ptrace/_UPT_reg_offset.c \ |
| 231 | src/ptrace/_UPT_resume.c \ |
| 232 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 233 | libunwind-ptrace_shared_libraries := \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 234 | libunwind \ |
| 235 | |
Christopher Ferris | f4a8df5 | 2014-03-07 19:40:06 -0800 | [diff] [blame] | 236 | libunwind_ldlibs_host := \ |
| 237 | -lpthread \ |
| 238 | |
Christopher Ferris | 76dbee5 | 2014-02-12 21:12:09 -0800 | [diff] [blame] | 239 | ifeq ($(debug),true) |
| 240 | libunwind-ptrace_shared_libraries += \ |
| 241 | liblog \ |
| 242 | |
| 243 | endif |
| 244 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 245 | module := libunwind-ptrace |
| 246 | module_tag := optional |
| 247 | build_type := target |
| 248 | build_target := SHARED_LIBRARY |
| 249 | include $(LOCAL_PATH)/Android.build.mk |
| 250 | build_type := host |
| 251 | include $(LOCAL_PATH)/Android.build.mk |