blob: e120f91283911d4e1758ca1c0d70c478927646d8 [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
Christopher Ferrisd1c383c2014-04-09 16:48:26 -070035
Christopher Ferrisfe6ff002014-01-30 01:04:29 -080036common_cflags := \
Christopher Ferrisd1c383c2014-04-09 16:48:26 -070037 -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.
44common_cflags_target := \
45 -Wno-maybe-uninitialized \
46
47ifneq ($(debug),true)
48common_cflags += \
Christopher Ferris1c82a522013-10-01 12:38:42 -070049 -DHAVE_CONFIG_H \
50 -DNDEBUG \
51 -D_GNU_SOURCE \
Christopher Ferris9fc75e82014-01-26 21:39:06 -080052
Christopher Ferris76dbee52014-02-12 21:12:09 -080053else
Christopher Ferrisd1c383c2014-04-09 16:48:26 -070054common_cflags += \
Christopher Ferris76dbee52014-02-12 21:12:09 -080055 -DHAVE_CONFIG_H \
56 -DDEBUG \
57 -D_GNU_SOURCE \
58 -U_FORTIFY_SOURCE \
59
60endif
Pavel Chupinf1f90e72013-12-04 13:29:29 +040061
Christopher Ferrisfe6ff002014-01-30 01:04:29 -080062common_c_includes := \
Christopher Ferris1c82a522013-10-01 12:38:42 -070063 $(LOCAL_PATH)/src \
64 $(LOCAL_PATH)/include \
Colin Cross26183d22014-01-24 15:59:56 -080065
Pavel Chupinf1f90e72013-12-04 13:29:29 +040066libunwind_arches := arm arm64 mips x86 x86_64
Christopher Ferris1c82a522013-10-01 12:38:42 -070067
Colin Cross26183d22014-01-24 15:59:56 -080068$(foreach arch,$(libunwind_arches), \
Christopher Ferrisfe6ff002014-01-30 01:04:29 -080069 $(eval common_c_includes_$(arch) := $(LOCAL_PATH)/include/tdep-$(arch)))
Christopher Ferris1c82a522013-10-01 12:38:42 -070070
Christopher Ferrisfe6ff002014-01-30 01:04:29 -080071#-----------------------------------------------------------------------
72# libunwind shared library
73#-----------------------------------------------------------------------
74libunwind_src_files := \
Christopher Ferris1c82a522013-10-01 12:38:42 -070075 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 Ferrisf4a8df52014-03-07 19:40:06 -080083 src/mi/map.c \
84 src/mi/Lmap.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -070085 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 Ferrisf4a8df52014-03-07 19:40:06 -0800124 src/os-common.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700125 src/os-linux.c \
Christopher Ferrisf4a8df52014-03-07 19:40:06 -0800126 src/Los-common.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700127
Christopher Ferris9fc75e82014-01-26 21:39:06 -0800128# Arch specific source files.
Colin Cross26183d22014-01-24 15:59:56 -0800129$(foreach arch,$(libunwind_arches), \
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800130 $(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 Cross26183d22014-01-24 15:59:56 -0800153 ))
Christopher Ferris9fc75e82014-01-26 21:39:06 -0800154
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800155# 64-bit architectures
156libunwind_src_files_arm64 += src/elf64.c
157libunwind_src_files_x86_64 += src/elf64.c
158
159# 32-bit architectures
160libunwind_src_files_arm += src/elf32.c
161libunwind_src_files_mips += src/elf32.c
162libunwind_src_files_x86 += src/elf32.c
163
164libunwind_src_files_arm += \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700165 src/arm/getcontext.S \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700166 src/arm/Gis_signal_frame.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700167 src/arm/Gex_tables.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700168 src/arm/Lis_signal_frame.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700169 src/arm/Lex_tables.c \
170
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800171libunwind_src_files_arm64 += \
Christopher Ferris9fc75e82014-01-26 21:39:06 -0800172 src/aarch64/Gis_signal_frame.c \
173 src/aarch64/Lis_signal_frame.c \
174
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800175libunwind_src_files_mips += \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700176 src/mips/getcontext-android.S \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700177 src/mips/Gis_signal_frame.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700178 src/mips/Lis_signal_frame.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700179
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800180libunwind_src_files_x86 += \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700181 src/x86/getcontext-linux.S \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700182 src/x86/Gos-linux.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700183 src/x86/Los-linux.c \
184
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800185libunwind_src_files_x86_64 += \
Pavel Chupinf1f90e72013-12-04 13:29:29 +0400186 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 Ferrisfe6ff002014-01-30 01:04:29 -0800195libunwind_shared_libraries_target := \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700196 libdl \
197
Christopher Ferrisf4a8df52014-03-07 19:40:06 -0800198libunwind_ldlibs_host := \
199 -lpthread \
200
Christopher Ferris76dbee52014-02-12 21:12:09 -0800201ifeq ($(debug),true)
202libunwind_shared_libraries += \
203 liblog \
204
205endif
206
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800207module := libunwind
208module_tag := optional
209build_type := target
210build_target := SHARED_LIBRARY
211include $(LOCAL_PATH)/Android.build.mk
212build_type := host
213include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris836d9152013-12-02 12:27:30 -0800214
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800215#-----------------------------------------------------------------------
216# libunwind-ptrace shared library
217#-----------------------------------------------------------------------
218libunwind-ptrace_src_files := \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700219 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 Ferrisfe6ff002014-01-30 01:04:29 -0800233libunwind-ptrace_shared_libraries := \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700234 libunwind \
235
Christopher Ferrisf4a8df52014-03-07 19:40:06 -0800236libunwind_ldlibs_host := \
237 -lpthread \
238
Christopher Ferris76dbee52014-02-12 21:12:09 -0800239ifeq ($(debug),true)
240libunwind-ptrace_shared_libraries += \
241 liblog \
242
243endif
244
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800245module := libunwind-ptrace
246module_tag := optional
247build_type := target
248build_target := SHARED_LIBRARY
249include $(LOCAL_PATH)/Android.build.mk
250build_type := host
251include $(LOCAL_PATH)/Android.build.mk