blob: 8bdde700fb633e72796b8660968f4430370fc5c8 [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
Christopher Ferris76dbee52014-02-12 21:12:09 -080029# Set to true to enable a debug build of the libraries.
30# To control what is logged, set the environment variable UNW_DEBUG_LEVEL=x,
31# where x controls the verbosity (from 1 to 20).
32debug := false
33
34ifneq ($(debug),true)
Christopher Ferrisfe6ff002014-01-30 01:04:29 -080035common_cflags := \
Christopher Ferris1c82a522013-10-01 12:38:42 -070036 -DHAVE_CONFIG_H \
37 -DNDEBUG \
38 -D_GNU_SOURCE \
Christopher Ferris9fc75e82014-01-26 21:39:06 -080039 -Wno-unused-parameter \
40
Christopher Ferris76dbee52014-02-12 21:12:09 -080041else
42common_cflags := \
43 -DHAVE_CONFIG_H \
44 -DDEBUG \
45 -D_GNU_SOURCE \
46 -U_FORTIFY_SOURCE \
47
48endif
Pavel Chupinf1f90e72013-12-04 13:29:29 +040049
Christopher Ferrisfe6ff002014-01-30 01:04:29 -080050common_c_includes := \
Christopher Ferris1c82a522013-10-01 12:38:42 -070051 $(LOCAL_PATH)/src \
52 $(LOCAL_PATH)/include \
Colin Cross26183d22014-01-24 15:59:56 -080053
Pavel Chupinf1f90e72013-12-04 13:29:29 +040054libunwind_arches := arm arm64 mips x86 x86_64
Christopher Ferris1c82a522013-10-01 12:38:42 -070055
Colin Cross26183d22014-01-24 15:59:56 -080056$(foreach arch,$(libunwind_arches), \
Christopher Ferrisfe6ff002014-01-30 01:04:29 -080057 $(eval common_c_includes_$(arch) := $(LOCAL_PATH)/include/tdep-$(arch)))
Christopher Ferris1c82a522013-10-01 12:38:42 -070058
Christopher Ferrisfe6ff002014-01-30 01:04:29 -080059#-----------------------------------------------------------------------
60# libunwind shared library
61#-----------------------------------------------------------------------
62libunwind_src_files := \
Christopher Ferris1c82a522013-10-01 12:38:42 -070063 src/mi/init.c \
64 src/mi/flush_cache.c \
65 src/mi/mempool.c \
66 src/mi/strerror.c \
67 src/mi/backtrace.c \
68 src/mi/dyn-cancel.c \
69 src/mi/dyn-info-list.c \
70 src/mi/dyn-register.c \
Christopher Ferris16b95a62014-01-22 16:07:26 -080071 src/mi/maps.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -070072 src/mi/Ldyn-extract.c \
73 src/mi/Lfind_dynamic_proc_info.c \
74 src/mi/Lget_proc_info_by_ip.c \
75 src/mi/Lget_proc_name.c \
76 src/mi/Lput_dynamic_unwind_info.c \
77 src/mi/Ldestroy_addr_space.c \
78 src/mi/Lget_reg.c \
79 src/mi/Lset_reg.c \
80 src/mi/Lget_fpreg.c \
81 src/mi/Lset_fpreg.c \
82 src/mi/Lset_caching_policy.c \
83 src/mi/Gdyn-extract.c \
84 src/mi/Gdyn-remote.c \
85 src/mi/Gfind_dynamic_proc_info.c \
86 src/mi/Gget_accessors.c \
87 src/mi/Gget_proc_info_by_ip.c \
88 src/mi/Gget_proc_name.c \
89 src/mi/Gput_dynamic_unwind_info.c \
90 src/mi/Gdestroy_addr_space.c \
91 src/mi/Gget_reg.c \
92 src/mi/Gset_reg.c \
93 src/mi/Gget_fpreg.c \
94 src/mi/Gset_fpreg.c \
95 src/mi/Gset_caching_policy.c \
96 src/dwarf/Lexpr.c \
97 src/dwarf/Lfde.c \
98 src/dwarf/Lparser.c \
99 src/dwarf/Lpe.c \
100 src/dwarf/Lstep.c \
101 src/dwarf/Lfind_proc_info-lsb.c \
102 src/dwarf/Lfind_unwind_table.c \
103 src/dwarf/Gexpr.c \
104 src/dwarf/Gfde.c \
105 src/dwarf/Gfind_proc_info-lsb.c \
106 src/dwarf/Gfind_unwind_table.c \
107 src/dwarf/Gparser.c \
108 src/dwarf/Gpe.c \
109 src/dwarf/Gstep.c \
110 src/dwarf/global.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700111 src/os-linux.c \
112
Christopher Ferris9fc75e82014-01-26 21:39:06 -0800113# Arch specific source files.
Colin Cross26183d22014-01-24 15:59:56 -0800114$(foreach arch,$(libunwind_arches), \
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800115 $(eval libunwind_src_files_$(arch) += \
116 src/$(arch)/is_fpreg.c \
117 src/$(arch)/regname.c \
118 src/$(arch)/Gcreate_addr_space.c \
119 src/$(arch)/Gget_proc_info.c \
120 src/$(arch)/Gget_save_loc.c \
121 src/$(arch)/Gglobal.c \
122 src/$(arch)/Ginit.c \
123 src/$(arch)/Ginit_local.c \
124 src/$(arch)/Ginit_remote.c \
125 src/$(arch)/Gregs.c \
126 src/$(arch)/Gresume.c \
127 src/$(arch)/Gstep.c \
128 src/$(arch)/Lcreate_addr_space.c \
129 src/$(arch)/Lget_proc_info.c \
130 src/$(arch)/Lget_save_loc.c \
131 src/$(arch)/Lglobal.c \
132 src/$(arch)/Linit.c \
133 src/$(arch)/Linit_local.c \
134 src/$(arch)/Linit_remote.c \
135 src/$(arch)/Lregs.c \
136 src/$(arch)/Lresume.c \
137 src/$(arch)/Lstep.c \
Colin Cross26183d22014-01-24 15:59:56 -0800138 ))
Christopher Ferris9fc75e82014-01-26 21:39:06 -0800139
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800140# 64-bit architectures
141libunwind_src_files_arm64 += src/elf64.c
142libunwind_src_files_x86_64 += src/elf64.c
143
144# 32-bit architectures
145libunwind_src_files_arm += src/elf32.c
146libunwind_src_files_mips += src/elf32.c
147libunwind_src_files_x86 += src/elf32.c
148
149libunwind_src_files_arm += \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700150 src/arm/getcontext.S \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700151 src/arm/Gis_signal_frame.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700152 src/arm/Gex_tables.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700153 src/arm/Lis_signal_frame.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700154 src/arm/Lex_tables.c \
155
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800156libunwind_src_files_arm64 += \
Christopher Ferris9fc75e82014-01-26 21:39:06 -0800157 src/aarch64/Gis_signal_frame.c \
158 src/aarch64/Lis_signal_frame.c \
159
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800160libunwind_src_files_mips += \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700161 src/mips/getcontext-android.S \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700162 src/mips/Gis_signal_frame.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700163 src/mips/Lis_signal_frame.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700164
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800165libunwind_src_files_x86 += \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700166 src/x86/getcontext-linux.S \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700167 src/x86/Gos-linux.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700168 src/x86/Los-linux.c \
169
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800170libunwind_src_files_x86_64 += \
Pavel Chupinf1f90e72013-12-04 13:29:29 +0400171 src/x86_64/getcontext.S \
172 src/x86_64/Gstash_frame.c \
173 src/x86_64/Gtrace.c \
174 src/x86_64/Gos-linux.c \
175 src/x86_64/Lstash_frame.c \
176 src/x86_64/Ltrace.c \
177 src/x86_64/Los-linux.c \
178 src/x86_64/setcontext.S \
179
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800180libunwind_shared_libraries_target := \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700181 libdl \
182
Christopher Ferris76dbee52014-02-12 21:12:09 -0800183ifeq ($(debug),true)
184libunwind_shared_libraries += \
185 liblog \
186
187endif
188
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800189module := libunwind
190module_tag := optional
191build_type := target
192build_target := SHARED_LIBRARY
193include $(LOCAL_PATH)/Android.build.mk
194build_type := host
195include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris836d9152013-12-02 12:27:30 -0800196
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800197#-----------------------------------------------------------------------
198# libunwind-ptrace shared library
199#-----------------------------------------------------------------------
200libunwind-ptrace_src_files := \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700201 src/ptrace/_UPT_elf.c \
202 src/ptrace/_UPT_accessors.c \
203 src/ptrace/_UPT_access_fpreg.c \
204 src/ptrace/_UPT_access_mem.c \
205 src/ptrace/_UPT_access_reg.c \
206 src/ptrace/_UPT_create.c \
207 src/ptrace/_UPT_destroy.c \
208 src/ptrace/_UPT_find_proc_info.c \
209 src/ptrace/_UPT_get_dyn_info_list_addr.c \
210 src/ptrace/_UPT_put_unwind_info.c \
211 src/ptrace/_UPT_get_proc_name.c \
212 src/ptrace/_UPT_reg_offset.c \
213 src/ptrace/_UPT_resume.c \
214
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800215libunwind-ptrace_shared_libraries := \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700216 libunwind \
217
Christopher Ferris76dbee52014-02-12 21:12:09 -0800218ifeq ($(debug),true)
219libunwind-ptrace_shared_libraries += \
220 liblog \
221
222endif
223
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800224module := libunwind-ptrace
225module_tag := optional
226build_type := target
227build_target := SHARED_LIBRARY
228include $(LOCAL_PATH)/Android.build.mk
229build_type := host
230include $(LOCAL_PATH)/Android.build.mk