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