1# Copyright (C) 2013 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15LOCAL_PATH := $(call my-dir)
16
17LIBDW_SRC_FILES := \
18    cfi.c \
19    cie.c \
20    dwarf_abbrevhaschildren.c \
21    dwarf_abbrev_hash.c \
22    dwarf_addrdie.c \
23    dwarf_aggregate_size.c \
24    dwarf_arrayorder.c \
25    dwarf_attr.c \
26    dwarf_attr_integrate.c \
27    dwarf_begin.c \
28    dwarf_begin_elf.c \
29    dwarf_bitoffset.c \
30    dwarf_bitsize.c \
31    dwarf_bytesize.c \
32    dwarf_cfi_addrframe.c \
33    dwarf_cfi_end.c \
34    dwarf_child.c \
35    dwarf_cu_die.c \
36    dwarf_cu_getdwarf.c \
37    dwarf_cuoffset.c \
38    dwarf_decl_column.c \
39    dwarf_decl_file.c \
40    dwarf_decl_line.c \
41    dwarf_diecu.c \
42    dwarf_diename.c \
43    dwarf_dieoffset.c \
44    dwarf_end.c \
45    dwarf_entry_breakpoints.c \
46    dwarf_entrypc.c \
47    dwarf_error.c \
48    dwarf_filesrc.c \
49    dwarf_formaddr.c \
50    dwarf_formblock.c \
51    dwarf_formflag.c \
52    dwarf_formref.c \
53    dwarf_formref_die.c \
54    dwarf_formsdata.c \
55    dwarf_formstring.c \
56    dwarf_formudata.c \
57    dwarf_frame_cfa.c \
58    dwarf_frame_info.c \
59    dwarf_frame_register.c \
60    dwarf_func_inline.c \
61    dwarf_getabbrevattr.c \
62    dwarf_getabbrev.c \
63    dwarf_getabbrevcode.c \
64    dwarf_getabbrevtag.c \
65    dwarf_getalt.c \
66    dwarf_getarange_addr.c \
67    dwarf_getarangeinfo.c \
68    dwarf_getaranges.c \
69    dwarf_getattrcnt.c \
70    dwarf_getattrs.c \
71    dwarf_getcfi.c \
72    dwarf_getcfi_elf.c \
73    dwarf_getelf.c \
74    dwarf_getfuncs.c \
75    dwarf_getlocation_attr.c \
76    dwarf_getlocation.c \
77    dwarf_getlocation_die.c \
78    dwarf_getlocation_implicit_pointer.c \
79    dwarf_getmacros.c \
80    dwarf_getpubnames.c \
81    dwarf_getscopes.c \
82    dwarf_getscopes_die.c \
83    dwarf_getscopevar.c \
84    dwarf_getsrc_die.c \
85    dwarf_getsrcdirs.c \
86    dwarf_getsrc_file.c \
87    dwarf_getsrcfiles.c \
88    dwarf_getsrclines.c \
89    dwarf_getstring.c \
90    dwarf_hasattr.c \
91    dwarf_hasattr_integrate.c \
92    dwarf_haschildren.c \
93    dwarf_hasform.c \
94    dwarf_haspc.c \
95    dwarf_highpc.c \
96    dwarf_lineaddr.c \
97    dwarf_linebeginstatement.c \
98    dwarf_lineblock.c \
99    dwarf_linecol.c \
100    dwarf_linediscriminator.c \
101    dwarf_lineendsequence.c \
102    dwarf_lineepiloguebegin.c \
103    dwarf_lineisa.c \
104    dwarf_lineno.c \
105    dwarf_lineop_index.c \
106    dwarf_lineprologueend.c \
107    dwarf_linesrc.c \
108    dwarf_lowpc.c \
109    dwarf_macro_getparamcnt.c \
110    dwarf_macro_getsrcfiles.c \
111    dwarf_macro_opcode.c \
112    dwarf_macro_param1.c \
113    dwarf_macro_param2.c \
114    dwarf_macro_param.c \
115    dwarf_next_cfi.c \
116    dwarf_nextcu.c \
117    dwarf_offabbrev.c \
118    dwarf_offdie.c \
119    dwarf_onearange.c \
120    dwarf_onesrcline.c \
121    dwarf_peel_type.c \
122    dwarf_ranges.c \
123    dwarf_setalt.c \
124    dwarf_siblingof.c \
125    dwarf_sig8_hash.c \
126    dwarf_srclang.c \
127    dwarf_tag.c \
128    dwarf_whatattr.c \
129    dwarf_whatform.c \
130    fde.c \
131    frame-cache.c \
132    libdw_alloc.c \
133    libdw_findcu.c \
134    libdw_form.c \
135    libdw_visit_scopes.c \
136
137
138ifeq ($(HOST_OS),linux)
139
140#
141# host libdw
142#
143
144include $(CLEAR_VARS)
145
146LOCAL_SRC_FILES := $(LIBDW_SRC_FILES)
147
148LOCAL_C_INCLUDES := \
149	$(LOCAL_PATH)/.. \
150	$(LOCAL_PATH)/../lib \
151	$(LOCAL_PATH)/../libdw \
152	$(LOCAL_PATH)/../libelf
153
154LOCAL_CFLAGS += -DHAVE_CONFIG_H -std=gnu99 -D_GNU_SOURCE -D_BSD_SOURCE -DIS_LIBDW
155
156# to suppress the "pointer of type ‘void *’ used in arithmetic" warning
157LOCAL_CFLAGS += -Wno-pointer-arith
158
159LOCAL_MODULE:= libdw
160
161LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
162
163LOCAL_STATIC_LIBRARIES := libz
164
165include $(BUILD_HOST_STATIC_LIBRARY)
166
167endif # linux
168
169#
170# target libdw
171#
172
173include $(CLEAR_VARS)
174
175# b/25642296, local __thread variable does not work with arm64 clang/llvm.
176LOCAL_CLANG_arm64 := false
177
178LOCAL_SRC_FILES := $(LIBDW_SRC_FILES)
179
180LOCAL_C_INCLUDES := \
181	$(LOCAL_PATH)/.. \
182	$(LOCAL_PATH)/../lib \
183	$(LOCAL_PATH)/../libdw \
184	$(LOCAL_PATH)/../libelf
185
186LOCAL_C_INCLUDES += $(LOCAL_PATH)/../bionic-fixup
187
188LOCAL_CFLAGS += -include $(LOCAL_PATH)/../bionic-fixup/AndroidFixup.h
189
190LOCAL_CFLAGS += -DHAVE_CONFIG_H -std=gnu99 -D_GNU_SOURCE -D_BSD_SOURCE -DIS_LIBDW -Werror
191
192# to suppress the "pointer of type ‘void *’ used in arithmetic" warning
193LOCAL_CFLAGS += -Wno-pointer-arith
194
195LOCAL_MODULE_TAGS := eng
196
197LOCAL_MODULE:= libdw
198
199LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
200
201LOCAL_STATIC_LIBRARIES := libz
202
203include $(BUILD_STATIC_LIBRARY)
204