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