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 |
Christopher Ferris | 3fa4997 | 2014-01-31 15:07:26 -0800 | [diff] [blame^] | 23 | ifneq ($(strip $(BUILD_HOST_64bit)),) |
| 24 | HOST_ARCH := x86_64 |
| 25 | endif |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 26 | endif |
| 27 | endif |
| 28 | |
| 29 | common_cflags := \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 30 | -DHAVE_CONFIG_H \ |
| 31 | -DNDEBUG \ |
| 32 | -D_GNU_SOURCE \ |
Christopher Ferris | 9fc75e8 | 2014-01-26 21:39:06 -0800 | [diff] [blame] | 33 | -Wno-unused-parameter \ |
| 34 | |
Pavel Chupin | f1f90e7 | 2013-12-04 13:29:29 +0400 | [diff] [blame] | 35 | # For debug build it is required: |
| 36 | # 1. Enable flags below |
| 37 | # 2. On runtime export UNW_DEBUG_LEVEL=x where x controls verbosity (from 1 to 20) |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 38 | #common_cflags := \ |
| 39 | # -DHAVE_CONFIG_H \ |
| 40 | # -DDEBUG \ |
| 41 | # -D_GNU_SOURCE \ |
| 42 | # -U_FORTIFY_SOURCE |
Pavel Chupin | f1f90e7 | 2013-12-04 13:29:29 +0400 | [diff] [blame] | 43 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 44 | common_c_includes := \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 45 | $(LOCAL_PATH)/src \ |
| 46 | $(LOCAL_PATH)/include \ |
Colin Cross | 26183d2 | 2014-01-24 15:59:56 -0800 | [diff] [blame] | 47 | |
Pavel Chupin | f1f90e7 | 2013-12-04 13:29:29 +0400 | [diff] [blame] | 48 | libunwind_arches := arm arm64 mips x86 x86_64 |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 49 | |
Colin Cross | 26183d2 | 2014-01-24 15:59:56 -0800 | [diff] [blame] | 50 | $(foreach arch,$(libunwind_arches), \ |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 51 | $(eval common_c_includes_$(arch) := $(LOCAL_PATH)/include/tdep-$(arch))) |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 52 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 53 | #----------------------------------------------------------------------- |
| 54 | # libunwind shared library |
| 55 | #----------------------------------------------------------------------- |
| 56 | libunwind_src_files := \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 57 | src/mi/init.c \ |
| 58 | src/mi/flush_cache.c \ |
| 59 | src/mi/mempool.c \ |
| 60 | src/mi/strerror.c \ |
| 61 | src/mi/backtrace.c \ |
| 62 | src/mi/dyn-cancel.c \ |
| 63 | src/mi/dyn-info-list.c \ |
| 64 | src/mi/dyn-register.c \ |
Christopher Ferris | 16b95a6 | 2014-01-22 16:07:26 -0800 | [diff] [blame] | 65 | src/mi/maps.c \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 66 | src/mi/Ldyn-extract.c \ |
| 67 | src/mi/Lfind_dynamic_proc_info.c \ |
| 68 | src/mi/Lget_proc_info_by_ip.c \ |
| 69 | src/mi/Lget_proc_name.c \ |
| 70 | src/mi/Lput_dynamic_unwind_info.c \ |
| 71 | src/mi/Ldestroy_addr_space.c \ |
| 72 | src/mi/Lget_reg.c \ |
| 73 | src/mi/Lset_reg.c \ |
| 74 | src/mi/Lget_fpreg.c \ |
| 75 | src/mi/Lset_fpreg.c \ |
| 76 | src/mi/Lset_caching_policy.c \ |
| 77 | src/mi/Gdyn-extract.c \ |
| 78 | src/mi/Gdyn-remote.c \ |
| 79 | src/mi/Gfind_dynamic_proc_info.c \ |
| 80 | src/mi/Gget_accessors.c \ |
| 81 | src/mi/Gget_proc_info_by_ip.c \ |
| 82 | src/mi/Gget_proc_name.c \ |
| 83 | src/mi/Gput_dynamic_unwind_info.c \ |
| 84 | src/mi/Gdestroy_addr_space.c \ |
| 85 | src/mi/Gget_reg.c \ |
| 86 | src/mi/Gset_reg.c \ |
| 87 | src/mi/Gget_fpreg.c \ |
| 88 | src/mi/Gset_fpreg.c \ |
| 89 | src/mi/Gset_caching_policy.c \ |
| 90 | src/dwarf/Lexpr.c \ |
| 91 | src/dwarf/Lfde.c \ |
| 92 | src/dwarf/Lparser.c \ |
| 93 | src/dwarf/Lpe.c \ |
| 94 | src/dwarf/Lstep.c \ |
| 95 | src/dwarf/Lfind_proc_info-lsb.c \ |
| 96 | src/dwarf/Lfind_unwind_table.c \ |
| 97 | src/dwarf/Gexpr.c \ |
| 98 | src/dwarf/Gfde.c \ |
| 99 | src/dwarf/Gfind_proc_info-lsb.c \ |
| 100 | src/dwarf/Gfind_unwind_table.c \ |
| 101 | src/dwarf/Gparser.c \ |
| 102 | src/dwarf/Gpe.c \ |
| 103 | src/dwarf/Gstep.c \ |
| 104 | src/dwarf/global.c \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 105 | src/os-linux.c \ |
| 106 | |
Christopher Ferris | 9fc75e8 | 2014-01-26 21:39:06 -0800 | [diff] [blame] | 107 | # Arch specific source files. |
Colin Cross | 26183d2 | 2014-01-24 15:59:56 -0800 | [diff] [blame] | 108 | $(foreach arch,$(libunwind_arches), \ |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 109 | $(eval libunwind_src_files_$(arch) += \ |
| 110 | src/$(arch)/is_fpreg.c \ |
| 111 | src/$(arch)/regname.c \ |
| 112 | src/$(arch)/Gcreate_addr_space.c \ |
| 113 | src/$(arch)/Gget_proc_info.c \ |
| 114 | src/$(arch)/Gget_save_loc.c \ |
| 115 | src/$(arch)/Gglobal.c \ |
| 116 | src/$(arch)/Ginit.c \ |
| 117 | src/$(arch)/Ginit_local.c \ |
| 118 | src/$(arch)/Ginit_remote.c \ |
| 119 | src/$(arch)/Gregs.c \ |
| 120 | src/$(arch)/Gresume.c \ |
| 121 | src/$(arch)/Gstep.c \ |
| 122 | src/$(arch)/Lcreate_addr_space.c \ |
| 123 | src/$(arch)/Lget_proc_info.c \ |
| 124 | src/$(arch)/Lget_save_loc.c \ |
| 125 | src/$(arch)/Lglobal.c \ |
| 126 | src/$(arch)/Linit.c \ |
| 127 | src/$(arch)/Linit_local.c \ |
| 128 | src/$(arch)/Linit_remote.c \ |
| 129 | src/$(arch)/Lregs.c \ |
| 130 | src/$(arch)/Lresume.c \ |
| 131 | src/$(arch)/Lstep.c \ |
Colin Cross | 26183d2 | 2014-01-24 15:59:56 -0800 | [diff] [blame] | 132 | )) |
Christopher Ferris | 9fc75e8 | 2014-01-26 21:39:06 -0800 | [diff] [blame] | 133 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 134 | # 64-bit architectures |
| 135 | libunwind_src_files_arm64 += src/elf64.c |
| 136 | libunwind_src_files_x86_64 += src/elf64.c |
| 137 | |
| 138 | # 32-bit architectures |
| 139 | libunwind_src_files_arm += src/elf32.c |
| 140 | libunwind_src_files_mips += src/elf32.c |
| 141 | libunwind_src_files_x86 += src/elf32.c |
| 142 | |
| 143 | libunwind_src_files_arm += \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 144 | src/arm/getcontext.S \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 145 | src/arm/Gis_signal_frame.c \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 146 | src/arm/Gex_tables.c \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 147 | src/arm/Lis_signal_frame.c \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 148 | src/arm/Lex_tables.c \ |
| 149 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 150 | libunwind_src_files_arm64 += \ |
Christopher Ferris | 9fc75e8 | 2014-01-26 21:39:06 -0800 | [diff] [blame] | 151 | src/aarch64/Gis_signal_frame.c \ |
| 152 | src/aarch64/Lis_signal_frame.c \ |
| 153 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 154 | libunwind_src_files_mips += \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 155 | src/mips/getcontext-android.S \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 156 | src/mips/Gis_signal_frame.c \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 157 | src/mips/Lis_signal_frame.c \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 158 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 159 | libunwind_src_files_x86 += \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 160 | src/x86/getcontext-linux.S \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 161 | src/x86/Gos-linux.c \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 162 | src/x86/Los-linux.c \ |
| 163 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 164 | libunwind_src_files_x86_64 += \ |
Pavel Chupin | f1f90e7 | 2013-12-04 13:29:29 +0400 | [diff] [blame] | 165 | src/x86_64/getcontext.S \ |
| 166 | src/x86_64/Gstash_frame.c \ |
| 167 | src/x86_64/Gtrace.c \ |
| 168 | src/x86_64/Gos-linux.c \ |
| 169 | src/x86_64/Lstash_frame.c \ |
| 170 | src/x86_64/Ltrace.c \ |
| 171 | src/x86_64/Los-linux.c \ |
| 172 | src/x86_64/setcontext.S \ |
| 173 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 174 | libunwind_shared_libraries_target := \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 175 | libdl \ |
| 176 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 177 | module := libunwind |
| 178 | module_tag := optional |
| 179 | build_type := target |
| 180 | build_target := SHARED_LIBRARY |
| 181 | include $(LOCAL_PATH)/Android.build.mk |
| 182 | build_type := host |
| 183 | include $(LOCAL_PATH)/Android.build.mk |
Christopher Ferris | 836d915 | 2013-12-02 12:27:30 -0800 | [diff] [blame] | 184 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 185 | #----------------------------------------------------------------------- |
| 186 | # libunwind-ptrace shared library |
| 187 | #----------------------------------------------------------------------- |
| 188 | libunwind-ptrace_src_files := \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 189 | src/ptrace/_UPT_elf.c \ |
| 190 | src/ptrace/_UPT_accessors.c \ |
| 191 | src/ptrace/_UPT_access_fpreg.c \ |
| 192 | src/ptrace/_UPT_access_mem.c \ |
| 193 | src/ptrace/_UPT_access_reg.c \ |
| 194 | src/ptrace/_UPT_create.c \ |
| 195 | src/ptrace/_UPT_destroy.c \ |
| 196 | src/ptrace/_UPT_find_proc_info.c \ |
| 197 | src/ptrace/_UPT_get_dyn_info_list_addr.c \ |
| 198 | src/ptrace/_UPT_put_unwind_info.c \ |
| 199 | src/ptrace/_UPT_get_proc_name.c \ |
| 200 | src/ptrace/_UPT_reg_offset.c \ |
| 201 | src/ptrace/_UPT_resume.c \ |
| 202 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 203 | libunwind-ptrace_shared_libraries := \ |
Christopher Ferris | 1c82a52 | 2013-10-01 12:38:42 -0700 | [diff] [blame] | 204 | libunwind \ |
| 205 | |
Christopher Ferris | fe6ff00 | 2014-01-30 01:04:29 -0800 | [diff] [blame] | 206 | module := libunwind-ptrace |
| 207 | module_tag := optional |
| 208 | build_type := target |
| 209 | build_target := SHARED_LIBRARY |
| 210 | include $(LOCAL_PATH)/Android.build.mk |
| 211 | build_type := host |
| 212 | include $(LOCAL_PATH)/Android.build.mk |