blob: ed3217c92e060184705514ca58d9086ae6d5ed91 [file] [log] [blame]
Christopher Ferrisfe6ff002014-01-30 01:04:29 -08001#
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 Ferris1c82a522013-10-01 12:38:42 -070017LOCAL_PATH := $(call my-dir)
18
Christopher Ferrisfe6ff002014-01-30 01:04:29 -080019build_host := false
20ifeq ($(HOST_OS),linux)
21ifeq ($(HOST_ARCH),$(filter $(HOST_ARCH),x86 x86_64))
22build_host := true
Christopher Ferris3fa49972014-01-31 15:07:26 -080023ifneq ($(strip $(BUILD_HOST_64bit)),)
24HOST_ARCH := x86_64
25endif
Christopher Ferrisfe6ff002014-01-30 01:04:29 -080026endif
27endif
28
29common_cflags := \
Christopher Ferris1c82a522013-10-01 12:38:42 -070030 -DHAVE_CONFIG_H \
31 -DNDEBUG \
32 -D_GNU_SOURCE \
Christopher Ferris9fc75e82014-01-26 21:39:06 -080033 -Wno-unused-parameter \
34
Pavel Chupinf1f90e72013-12-04 13:29:29 +040035# 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 Ferrisfe6ff002014-01-30 01:04:29 -080038#common_cflags := \
39# -DHAVE_CONFIG_H \
40# -DDEBUG \
41# -D_GNU_SOURCE \
42# -U_FORTIFY_SOURCE
Pavel Chupinf1f90e72013-12-04 13:29:29 +040043
Christopher Ferrisfe6ff002014-01-30 01:04:29 -080044common_c_includes := \
Christopher Ferris1c82a522013-10-01 12:38:42 -070045 $(LOCAL_PATH)/src \
46 $(LOCAL_PATH)/include \
Colin Cross26183d22014-01-24 15:59:56 -080047
Pavel Chupinf1f90e72013-12-04 13:29:29 +040048libunwind_arches := arm arm64 mips x86 x86_64
Christopher Ferris1c82a522013-10-01 12:38:42 -070049
Colin Cross26183d22014-01-24 15:59:56 -080050$(foreach arch,$(libunwind_arches), \
Christopher Ferrisfe6ff002014-01-30 01:04:29 -080051 $(eval common_c_includes_$(arch) := $(LOCAL_PATH)/include/tdep-$(arch)))
Christopher Ferris1c82a522013-10-01 12:38:42 -070052
Christopher Ferrisfe6ff002014-01-30 01:04:29 -080053#-----------------------------------------------------------------------
54# libunwind shared library
55#-----------------------------------------------------------------------
56libunwind_src_files := \
Christopher Ferris1c82a522013-10-01 12:38:42 -070057 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 Ferris16b95a62014-01-22 16:07:26 -080065 src/mi/maps.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -070066 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 Ferris1c82a522013-10-01 12:38:42 -0700105 src/os-linux.c \
106
Christopher Ferris9fc75e82014-01-26 21:39:06 -0800107# Arch specific source files.
Colin Cross26183d22014-01-24 15:59:56 -0800108$(foreach arch,$(libunwind_arches), \
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800109 $(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 Cross26183d22014-01-24 15:59:56 -0800132 ))
Christopher Ferris9fc75e82014-01-26 21:39:06 -0800133
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800134# 64-bit architectures
135libunwind_src_files_arm64 += src/elf64.c
136libunwind_src_files_x86_64 += src/elf64.c
137
138# 32-bit architectures
139libunwind_src_files_arm += src/elf32.c
140libunwind_src_files_mips += src/elf32.c
141libunwind_src_files_x86 += src/elf32.c
142
143libunwind_src_files_arm += \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700144 src/arm/getcontext.S \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700145 src/arm/Gis_signal_frame.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700146 src/arm/Gex_tables.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700147 src/arm/Lis_signal_frame.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700148 src/arm/Lex_tables.c \
149
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800150libunwind_src_files_arm64 += \
Christopher Ferris9fc75e82014-01-26 21:39:06 -0800151 src/aarch64/Gis_signal_frame.c \
152 src/aarch64/Lis_signal_frame.c \
153
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800154libunwind_src_files_mips += \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700155 src/mips/getcontext-android.S \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700156 src/mips/Gis_signal_frame.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700157 src/mips/Lis_signal_frame.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700158
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800159libunwind_src_files_x86 += \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700160 src/x86/getcontext-linux.S \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700161 src/x86/Gos-linux.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700162 src/x86/Los-linux.c \
163
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800164libunwind_src_files_x86_64 += \
Pavel Chupinf1f90e72013-12-04 13:29:29 +0400165 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 Ferrisfe6ff002014-01-30 01:04:29 -0800174libunwind_shared_libraries_target := \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700175 libdl \
176
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800177module := libunwind
178module_tag := optional
179build_type := target
180build_target := SHARED_LIBRARY
181include $(LOCAL_PATH)/Android.build.mk
182build_type := host
183include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris836d9152013-12-02 12:27:30 -0800184
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800185#-----------------------------------------------------------------------
186# libunwind-ptrace shared library
187#-----------------------------------------------------------------------
188libunwind-ptrace_src_files := \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700189 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 Ferrisfe6ff002014-01-30 01:04:29 -0800203libunwind-ptrace_shared_libraries := \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700204 libunwind \
205
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800206module := libunwind-ptrace
207module_tag := optional
208build_type := target
209build_target := SHARED_LIBRARY
210include $(LOCAL_PATH)/Android.build.mk
211build_type := host
212include $(LOCAL_PATH)/Android.build.mk