blob: e3d1ed9ca79012e384401f17cc45de76e27ca3d2 [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
Ying Wang57c68a32014-02-21 15:53:33 -080023my_host_arch := $(HOST_ARCH)
Christopher Ferris3fa49972014-01-31 15:07:26 -080024ifneq ($(strip $(BUILD_HOST_64bit)),)
Ying Wang57c68a32014-02-21 15:53:33 -080025my_host_arch := x86_64
Christopher Ferris3fa49972014-01-31 15:07:26 -080026endif
Christopher Ferrisfe6ff002014-01-30 01:04:29 -080027endif
28endif
29
Christopher Ferris76dbee52014-02-12 21:12:09 -080030# 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).
33debug := false
34
35ifneq ($(debug),true)
Christopher Ferrisfe6ff002014-01-30 01:04:29 -080036common_cflags := \
Christopher Ferris1c82a522013-10-01 12:38:42 -070037 -DHAVE_CONFIG_H \
38 -DNDEBUG \
39 -D_GNU_SOURCE \
Christopher Ferris9fc75e82014-01-26 21:39:06 -080040 -Wno-unused-parameter \
41
Christopher Ferris76dbee52014-02-12 21:12:09 -080042else
43common_cflags := \
44 -DHAVE_CONFIG_H \
45 -DDEBUG \
46 -D_GNU_SOURCE \
47 -U_FORTIFY_SOURCE \
48
49endif
Pavel Chupinf1f90e72013-12-04 13:29:29 +040050
Christopher Ferrisfe6ff002014-01-30 01:04:29 -080051common_c_includes := \
Christopher Ferris1c82a522013-10-01 12:38:42 -070052 $(LOCAL_PATH)/src \
53 $(LOCAL_PATH)/include \
Colin Cross26183d22014-01-24 15:59:56 -080054
Pavel Chupinf1f90e72013-12-04 13:29:29 +040055libunwind_arches := arm arm64 mips x86 x86_64
Christopher Ferris1c82a522013-10-01 12:38:42 -070056
Colin Cross26183d22014-01-24 15:59:56 -080057$(foreach arch,$(libunwind_arches), \
Christopher Ferrisfe6ff002014-01-30 01:04:29 -080058 $(eval common_c_includes_$(arch) := $(LOCAL_PATH)/include/tdep-$(arch)))
Christopher Ferris1c82a522013-10-01 12:38:42 -070059
Christopher Ferrisfe6ff002014-01-30 01:04:29 -080060#-----------------------------------------------------------------------
61# libunwind shared library
62#-----------------------------------------------------------------------
63libunwind_src_files := \
Christopher Ferris1c82a522013-10-01 12:38:42 -070064 src/mi/init.c \
65 src/mi/flush_cache.c \
66 src/mi/mempool.c \
67 src/mi/strerror.c \
68 src/mi/backtrace.c \
69 src/mi/dyn-cancel.c \
70 src/mi/dyn-info-list.c \
71 src/mi/dyn-register.c \
Christopher Ferrisf4a8df52014-03-07 19:40:06 -080072 src/mi/map.c \
73 src/mi/Lmap.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -070074 src/mi/Ldyn-extract.c \
75 src/mi/Lfind_dynamic_proc_info.c \
76 src/mi/Lget_proc_info_by_ip.c \
77 src/mi/Lget_proc_name.c \
78 src/mi/Lput_dynamic_unwind_info.c \
79 src/mi/Ldestroy_addr_space.c \
80 src/mi/Lget_reg.c \
81 src/mi/Lset_reg.c \
82 src/mi/Lget_fpreg.c \
83 src/mi/Lset_fpreg.c \
84 src/mi/Lset_caching_policy.c \
85 src/mi/Gdyn-extract.c \
86 src/mi/Gdyn-remote.c \
87 src/mi/Gfind_dynamic_proc_info.c \
88 src/mi/Gget_accessors.c \
89 src/mi/Gget_proc_info_by_ip.c \
90 src/mi/Gget_proc_name.c \
91 src/mi/Gput_dynamic_unwind_info.c \
92 src/mi/Gdestroy_addr_space.c \
93 src/mi/Gget_reg.c \
94 src/mi/Gset_reg.c \
95 src/mi/Gget_fpreg.c \
96 src/mi/Gset_fpreg.c \
97 src/mi/Gset_caching_policy.c \
98 src/dwarf/Lexpr.c \
99 src/dwarf/Lfde.c \
100 src/dwarf/Lparser.c \
101 src/dwarf/Lpe.c \
102 src/dwarf/Lstep.c \
103 src/dwarf/Lfind_proc_info-lsb.c \
104 src/dwarf/Lfind_unwind_table.c \
105 src/dwarf/Gexpr.c \
106 src/dwarf/Gfde.c \
107 src/dwarf/Gfind_proc_info-lsb.c \
108 src/dwarf/Gfind_unwind_table.c \
109 src/dwarf/Gparser.c \
110 src/dwarf/Gpe.c \
111 src/dwarf/Gstep.c \
112 src/dwarf/global.c \
Christopher Ferrisf4a8df52014-03-07 19:40:06 -0800113 src/os-common.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700114 src/os-linux.c \
Christopher Ferrisf4a8df52014-03-07 19:40:06 -0800115 src/Los-common.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700116
Christopher Ferris9fc75e82014-01-26 21:39:06 -0800117# Arch specific source files.
Colin Cross26183d22014-01-24 15:59:56 -0800118$(foreach arch,$(libunwind_arches), \
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800119 $(eval libunwind_src_files_$(arch) += \
120 src/$(arch)/is_fpreg.c \
121 src/$(arch)/regname.c \
122 src/$(arch)/Gcreate_addr_space.c \
123 src/$(arch)/Gget_proc_info.c \
124 src/$(arch)/Gget_save_loc.c \
125 src/$(arch)/Gglobal.c \
126 src/$(arch)/Ginit.c \
127 src/$(arch)/Ginit_local.c \
128 src/$(arch)/Ginit_remote.c \
129 src/$(arch)/Gregs.c \
130 src/$(arch)/Gresume.c \
131 src/$(arch)/Gstep.c \
132 src/$(arch)/Lcreate_addr_space.c \
133 src/$(arch)/Lget_proc_info.c \
134 src/$(arch)/Lget_save_loc.c \
135 src/$(arch)/Lglobal.c \
136 src/$(arch)/Linit.c \
137 src/$(arch)/Linit_local.c \
138 src/$(arch)/Linit_remote.c \
139 src/$(arch)/Lregs.c \
140 src/$(arch)/Lresume.c \
141 src/$(arch)/Lstep.c \
Colin Cross26183d22014-01-24 15:59:56 -0800142 ))
Christopher Ferris9fc75e82014-01-26 21:39:06 -0800143
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800144# 64-bit architectures
145libunwind_src_files_arm64 += src/elf64.c
146libunwind_src_files_x86_64 += src/elf64.c
147
148# 32-bit architectures
149libunwind_src_files_arm += src/elf32.c
150libunwind_src_files_mips += src/elf32.c
151libunwind_src_files_x86 += src/elf32.c
152
153libunwind_src_files_arm += \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700154 src/arm/getcontext.S \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700155 src/arm/Gis_signal_frame.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700156 src/arm/Gex_tables.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700157 src/arm/Lis_signal_frame.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700158 src/arm/Lex_tables.c \
159
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800160libunwind_src_files_arm64 += \
Christopher Ferris9fc75e82014-01-26 21:39:06 -0800161 src/aarch64/Gis_signal_frame.c \
162 src/aarch64/Lis_signal_frame.c \
163
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800164libunwind_src_files_mips += \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700165 src/mips/getcontext-android.S \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700166 src/mips/Gis_signal_frame.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700167 src/mips/Lis_signal_frame.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700168
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800169libunwind_src_files_x86 += \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700170 src/x86/getcontext-linux.S \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700171 src/x86/Gos-linux.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700172 src/x86/Los-linux.c \
173
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800174libunwind_src_files_x86_64 += \
Pavel Chupinf1f90e72013-12-04 13:29:29 +0400175 src/x86_64/getcontext.S \
176 src/x86_64/Gstash_frame.c \
177 src/x86_64/Gtrace.c \
178 src/x86_64/Gos-linux.c \
179 src/x86_64/Lstash_frame.c \
180 src/x86_64/Ltrace.c \
181 src/x86_64/Los-linux.c \
182 src/x86_64/setcontext.S \
183
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800184libunwind_shared_libraries_target := \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700185 libdl \
186
Christopher Ferrisf4a8df52014-03-07 19:40:06 -0800187libunwind_ldlibs_host := \
188 -lpthread \
189
Christopher Ferris76dbee52014-02-12 21:12:09 -0800190ifeq ($(debug),true)
191libunwind_shared_libraries += \
192 liblog \
193
194endif
195
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800196module := libunwind
197module_tag := optional
198build_type := target
199build_target := SHARED_LIBRARY
200include $(LOCAL_PATH)/Android.build.mk
201build_type := host
202include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris836d9152013-12-02 12:27:30 -0800203
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800204#-----------------------------------------------------------------------
205# libunwind-ptrace shared library
206#-----------------------------------------------------------------------
207libunwind-ptrace_src_files := \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700208 src/ptrace/_UPT_elf.c \
209 src/ptrace/_UPT_accessors.c \
210 src/ptrace/_UPT_access_fpreg.c \
211 src/ptrace/_UPT_access_mem.c \
212 src/ptrace/_UPT_access_reg.c \
213 src/ptrace/_UPT_create.c \
214 src/ptrace/_UPT_destroy.c \
215 src/ptrace/_UPT_find_proc_info.c \
216 src/ptrace/_UPT_get_dyn_info_list_addr.c \
217 src/ptrace/_UPT_put_unwind_info.c \
218 src/ptrace/_UPT_get_proc_name.c \
219 src/ptrace/_UPT_reg_offset.c \
220 src/ptrace/_UPT_resume.c \
221
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800222libunwind-ptrace_shared_libraries := \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700223 libunwind \
224
Christopher Ferrisf4a8df52014-03-07 19:40:06 -0800225libunwind_ldlibs_host := \
226 -lpthread \
227
Christopher Ferris76dbee52014-02-12 21:12:09 -0800228ifeq ($(debug),true)
229libunwind-ptrace_shared_libraries += \
230 liblog \
231
232endif
233
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800234module := libunwind-ptrace
235module_tag := optional
236build_type := target
237build_target := SHARED_LIBRARY
238include $(LOCAL_PATH)/Android.build.mk
239build_type := host
240include $(LOCAL_PATH)/Android.build.mk