1# Copyright (C) 2012 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
17supported_platforms := linux-x86 darwin-x86
18cur_platform := $(filter $(HOST_OS)-$(HOST_ARCH),$(supported_platforms))
19
20ifdef cur_platform
21
22#
23# host libelf
24#
25
26include $(CLEAR_VARS)
27
28LIBELF_SRC_FILES := \
29	elf32_checksum.c \
30	elf32_fsize.c \
31	elf32_getehdr.c \
32	elf32_getphdr.c \
33	elf32_getshdr.c \
34	elf32_newehdr.c \
35	elf32_newphdr.c \
36	elf32_offscn.c \
37	elf32_updatefile.c \
38	elf32_updatenull.c \
39	elf32_xlatetof.c \
40	elf32_xlatetom.c \
41	elf64_checksum.c \
42	elf64_fsize.c \
43	elf64_getehdr.c \
44	elf64_getphdr.c \
45	elf64_getshdr.c \
46	elf64_newehdr.c \
47	elf64_newphdr.c \
48	elf64_offscn.c \
49	elf64_updatefile.c \
50	elf64_updatenull.c \
51	elf64_xlatetof.c \
52	elf64_xlatetom.c \
53	elf_begin.c \
54	elf_clone.c \
55	elf_cntl.c \
56	elf_end.c \
57	elf_error.c \
58	elf_fill.c \
59	elf_flagdata.c \
60	elf_flagehdr.c \
61	elf_flagelf.c \
62	elf_flagphdr.c \
63	elf_flagscn.c \
64	elf_flagshdr.c \
65	elf_getarhdr.c \
66	elf_getaroff.c \
67	elf_getarsym.c \
68	elf_getbase.c \
69	elf_getdata.c \
70	elf_getdata_rawchunk.c \
71	elf_getident.c \
72	elf_getscn.c \
73	elf_getshnum.c \
74	elf_getshstrndx.c \
75	elf_gnu_hash.c \
76	elf_hash.c \
77	elf_kind.c \
78	elf_memory.c \
79	elf_ndxscn.c \
80	elf_newdata.c \
81	elf_newscn.c \
82	elf_next.c \
83	elf_nextscn.c \
84	elf_rand.c \
85	elf_rawdata.c \
86	elf_rawfile.c \
87	elf_readall.c \
88	elf_scnshndx.c \
89	elf_strptr.c \
90	elf_update.c \
91	elf_version.c \
92	gelf_checksum.c \
93	gelf_fsize.c \
94	gelf_getauxv.c \
95	gelf_getclass.c \
96	gelf_getdyn.c \
97	gelf_getehdr.c \
98	gelf_getlib.c \
99	gelf_getmove.c \
100	gelf_getnote.c \
101	gelf_getphdr.c \
102	gelf_getrela.c \
103	gelf_getrel.c \
104	gelf_getshdr.c \
105	gelf_getsym.c \
106	gelf_getsyminfo.c \
107	gelf_getsymshndx.c \
108	gelf_getverdaux.c \
109	gelf_getverdef.c \
110	gelf_getvernaux.c \
111	gelf_getverneed.c \
112	gelf_getversym.c \
113	gelf_newehdr.c \
114	gelf_newphdr.c \
115	gelf_offscn.c \
116	gelf_update_auxv.c \
117	gelf_update_dyn.c \
118	gelf_update_ehdr.c \
119	gelf_update_lib.c \
120	gelf_update_move.c \
121	gelf_update_phdr.c \
122	gelf_update_rela.c \
123	gelf_update_rel.c \
124	gelf_update_shdr.c \
125	gelf_update_sym.c \
126	gelf_update_syminfo.c \
127	gelf_update_symshndx.c \
128	gelf_update_verdaux.c \
129	gelf_update_verdef.c \
130	gelf_update_vernaux.c \
131	gelf_update_verneed.c \
132	gelf_update_versym.c \
133	gelf_xlate.c \
134	gelf_xlatetof.c \
135	gelf_xlatetom.c \
136	libelf_crc32.c \
137	libelf_next_prime.c \
138	nlist.c
139
140LOCAL_SRC_FILES := $(LIBELF_SRC_FILES)
141
142LOCAL_C_INCLUDES := \
143	$(LOCAL_PATH)/.. \
144	$(LOCAL_PATH)/../lib \
145	$(LOCAL_PATH)/../libelf
146
147LOCAL_C_INCLUDES += $(LOCAL_PATH)/../host-$(HOST_OS)-fixup
148
149LOCAL_CFLAGS += -DHAVE_CONFIG_H -std=gnu99 -D_GNU_SOURCE
150
151# to suppress the "pointer of type âvoid *â used in arithmetic" warning
152LOCAL_CFLAGS += -Wno-pointer-arith
153
154ifeq ($(HOST_OS),darwin)
155	LOCAL_CFLAGS += -fnested-functions
156endif
157
158# to fix machine-dependent issues
159LOCAL_CFLAGS += -include $(LOCAL_PATH)/../host-$(HOST_OS)-fixup/AndroidFixup.h
160
161LOCAL_MODULE := libelf
162
163include $(BUILD_HOST_STATIC_LIBRARY)
164
165#
166# target libelf
167#
168
169include $(CLEAR_VARS)
170
171LOCAL_SRC_FILES := $(LIBELF_SRC_FILES)
172
173LOCAL_C_INCLUDES := \
174	$(LOCAL_PATH)/.. \
175	$(LOCAL_PATH)/../lib \
176	$(LOCAL_PATH)/../libelf
177
178LOCAL_C_INCLUDES += $(LOCAL_PATH)/../bionic-fixup
179
180LOCAL_CFLAGS += -DHAVE_CONFIG_H -std=gnu99 -Werror
181
182# to suppress the "pointer of type âvoid *â used in arithmetic" warning
183LOCAL_CFLAGS += -Wno-pointer-arith
184
185LOCAL_CFLAGS += -include $(LOCAL_PATH)/../bionic-fixup/AndroidFixup.h
186
187LOCAL_MODULE := libelf
188
189include $(BUILD_STATIC_LIBRARY)
190
191endif #cur_platform
192