blob: 91c6fda96f5d40253d154827aac9864055d86d89 [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 Ferris16b95a62014-01-22 16:07:26 -080072 src/mi/maps.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -070073 src/mi/Ldyn-extract.c \
74 src/mi/Lfind_dynamic_proc_info.c \
75 src/mi/Lget_proc_info_by_ip.c \
76 src/mi/Lget_proc_name.c \
77 src/mi/Lput_dynamic_unwind_info.c \
78 src/mi/Ldestroy_addr_space.c \
79 src/mi/Lget_reg.c \
80 src/mi/Lset_reg.c \
81 src/mi/Lget_fpreg.c \
82 src/mi/Lset_fpreg.c \
83 src/mi/Lset_caching_policy.c \
84 src/mi/Gdyn-extract.c \
85 src/mi/Gdyn-remote.c \
86 src/mi/Gfind_dynamic_proc_info.c \
87 src/mi/Gget_accessors.c \
88 src/mi/Gget_proc_info_by_ip.c \
89 src/mi/Gget_proc_name.c \
90 src/mi/Gput_dynamic_unwind_info.c \
91 src/mi/Gdestroy_addr_space.c \
92 src/mi/Gget_reg.c \
93 src/mi/Gset_reg.c \
94 src/mi/Gget_fpreg.c \
95 src/mi/Gset_fpreg.c \
96 src/mi/Gset_caching_policy.c \
97 src/dwarf/Lexpr.c \
98 src/dwarf/Lfde.c \
99 src/dwarf/Lparser.c \
100 src/dwarf/Lpe.c \
101 src/dwarf/Lstep.c \
102 src/dwarf/Lfind_proc_info-lsb.c \
103 src/dwarf/Lfind_unwind_table.c \
104 src/dwarf/Gexpr.c \
105 src/dwarf/Gfde.c \
106 src/dwarf/Gfind_proc_info-lsb.c \
107 src/dwarf/Gfind_unwind_table.c \
108 src/dwarf/Gparser.c \
109 src/dwarf/Gpe.c \
110 src/dwarf/Gstep.c \
111 src/dwarf/global.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700112 src/os-linux.c \
113
Christopher Ferris9fc75e82014-01-26 21:39:06 -0800114# Arch specific source files.
Colin Cross26183d22014-01-24 15:59:56 -0800115$(foreach arch,$(libunwind_arches), \
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800116 $(eval libunwind_src_files_$(arch) += \
117 src/$(arch)/is_fpreg.c \
118 src/$(arch)/regname.c \
119 src/$(arch)/Gcreate_addr_space.c \
120 src/$(arch)/Gget_proc_info.c \
121 src/$(arch)/Gget_save_loc.c \
122 src/$(arch)/Gglobal.c \
123 src/$(arch)/Ginit.c \
124 src/$(arch)/Ginit_local.c \
125 src/$(arch)/Ginit_remote.c \
126 src/$(arch)/Gregs.c \
127 src/$(arch)/Gresume.c \
128 src/$(arch)/Gstep.c \
129 src/$(arch)/Lcreate_addr_space.c \
130 src/$(arch)/Lget_proc_info.c \
131 src/$(arch)/Lget_save_loc.c \
132 src/$(arch)/Lglobal.c \
133 src/$(arch)/Linit.c \
134 src/$(arch)/Linit_local.c \
135 src/$(arch)/Linit_remote.c \
136 src/$(arch)/Lregs.c \
137 src/$(arch)/Lresume.c \
138 src/$(arch)/Lstep.c \
Colin Cross26183d22014-01-24 15:59:56 -0800139 ))
Christopher Ferris9fc75e82014-01-26 21:39:06 -0800140
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800141# 64-bit architectures
142libunwind_src_files_arm64 += src/elf64.c
143libunwind_src_files_x86_64 += src/elf64.c
144
145# 32-bit architectures
146libunwind_src_files_arm += src/elf32.c
147libunwind_src_files_mips += src/elf32.c
148libunwind_src_files_x86 += src/elf32.c
149
150libunwind_src_files_arm += \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700151 src/arm/getcontext.S \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700152 src/arm/Gis_signal_frame.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700153 src/arm/Gex_tables.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700154 src/arm/Lis_signal_frame.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700155 src/arm/Lex_tables.c \
156
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800157libunwind_src_files_arm64 += \
Christopher Ferris9fc75e82014-01-26 21:39:06 -0800158 src/aarch64/Gis_signal_frame.c \
159 src/aarch64/Lis_signal_frame.c \
160
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800161libunwind_src_files_mips += \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700162 src/mips/getcontext-android.S \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700163 src/mips/Gis_signal_frame.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700164 src/mips/Lis_signal_frame.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700165
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800166libunwind_src_files_x86 += \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700167 src/x86/getcontext-linux.S \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700168 src/x86/Gos-linux.c \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700169 src/x86/Los-linux.c \
170
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800171libunwind_src_files_x86_64 += \
Pavel Chupinf1f90e72013-12-04 13:29:29 +0400172 src/x86_64/getcontext.S \
173 src/x86_64/Gstash_frame.c \
174 src/x86_64/Gtrace.c \
175 src/x86_64/Gos-linux.c \
176 src/x86_64/Lstash_frame.c \
177 src/x86_64/Ltrace.c \
178 src/x86_64/Los-linux.c \
179 src/x86_64/setcontext.S \
180
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800181libunwind_shared_libraries_target := \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700182 libdl \
183
Christopher Ferris76dbee52014-02-12 21:12:09 -0800184ifeq ($(debug),true)
185libunwind_shared_libraries += \
186 liblog \
187
188endif
189
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800190module := libunwind
191module_tag := optional
192build_type := target
193build_target := SHARED_LIBRARY
194include $(LOCAL_PATH)/Android.build.mk
195build_type := host
196include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris836d9152013-12-02 12:27:30 -0800197
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800198#-----------------------------------------------------------------------
199# libunwind-ptrace shared library
200#-----------------------------------------------------------------------
201libunwind-ptrace_src_files := \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700202 src/ptrace/_UPT_elf.c \
203 src/ptrace/_UPT_accessors.c \
204 src/ptrace/_UPT_access_fpreg.c \
205 src/ptrace/_UPT_access_mem.c \
206 src/ptrace/_UPT_access_reg.c \
207 src/ptrace/_UPT_create.c \
208 src/ptrace/_UPT_destroy.c \
209 src/ptrace/_UPT_find_proc_info.c \
210 src/ptrace/_UPT_get_dyn_info_list_addr.c \
211 src/ptrace/_UPT_put_unwind_info.c \
212 src/ptrace/_UPT_get_proc_name.c \
213 src/ptrace/_UPT_reg_offset.c \
214 src/ptrace/_UPT_resume.c \
215
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800216libunwind-ptrace_shared_libraries := \
Christopher Ferris1c82a522013-10-01 12:38:42 -0700217 libunwind \
218
Christopher Ferris76dbee52014-02-12 21:12:09 -0800219ifeq ($(debug),true)
220libunwind-ptrace_shared_libraries += \
221 liblog \
222
223endif
224
Christopher Ferrisfe6ff002014-01-30 01:04:29 -0800225module := libunwind-ptrace
226module_tag := optional
227build_type := target
228build_target := SHARED_LIBRARY
229include $(LOCAL_PATH)/Android.build.mk
230build_type := host
231include $(LOCAL_PATH)/Android.build.mk