|
1 # lib/Makefile for libelf. |
|
2 # Copyright (C) 1995 - 2006 Michael Riepe |
|
3 # |
|
4 # This library is free software; you can redistribute it and/or |
|
5 # modify it under the terms of the GNU Library General Public |
|
6 # License as published by the Free Software Foundation; either |
|
7 # version 2 of the License, or (at your option) any later version. |
|
8 # |
|
9 # This library is distributed in the hope that it will be useful, |
|
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
12 # Library General Public License for more details. |
|
13 # |
|
14 # You should have received a copy of the GNU Library General Public |
|
15 # License along with this library; if not, write to the Free Software |
|
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 |
|
18 # @(#) $Id: Makefile.in,v 1.38 2007/06/29 21:34:25 michael Exp $ |
|
19 |
|
20 instroot = |
|
21 |
|
22 prefix = @prefix@ |
|
23 exec_prefix = @exec_prefix@ |
|
24 libdir = @libdir@ |
|
25 includedir = @includedir@ |
|
26 installdirs = $(libdir) $(includedir) $(includedir)/libelf |
|
27 |
|
28 CC = @CC@ |
|
29 LD = @LD@ |
|
30 AR = ar |
|
31 MV = mv -f |
|
32 RM = rm -f |
|
33 LN_S = @LN_S@ |
|
34 RANLIB = @RANLIB@ |
|
35 INSTALL = @INSTALL@ |
|
36 INSTALL_DATA = @INSTALL_DATA@ |
|
37 INSTALL_PROGRAM = @INSTALL_PROGRAM@ |
|
38 |
|
39 CFLAGS = @CFLAGS@ |
|
40 CPPFLAGS = @CPPFLAGS@ |
|
41 DEFS = -DHAVE_CONFIG_H |
|
42 LDFLAGS = @LDFLAGS@ |
|
43 LIBS = @LIBS@ |
|
44 DEPSHLIBS = @DEPSHLIBS@ |
|
45 |
|
46 DO_SHLIB = @DO_SHLIB@ |
|
47 PICFLAGS = @PICFLAGS@ |
|
48 SHLIB_SFX = @SHLIB_SFX@ |
|
49 SHLINK_SFX = @SHLINK_SFX@ |
|
50 SONAME_SFX = @SONAME_SFX@ |
|
51 LINK_SHLIB = @LINK_SHLIB@ |
|
52 INSTALL_SHLIB = @INSTALL_SHLIB@ |
|
53 |
|
54 SHLIB = libelf$(SHLIB_SFX) |
|
55 SHLINK = libelf$(SHLINK_SFX) |
|
56 SONAME = libelf$(SONAME_SFX) |
|
57 |
|
58 # install includes in includedir? |
|
59 DO_COMPAT = @DO_COMPAT@ |
|
60 |
|
61 COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) |
|
62 |
|
63 # no user serviceable parts below |
|
64 |
|
65 PACKAGE = @PACKAGE@ |
|
66 VERSION = @VERSION@ |
|
67 MAJOR = @MAJOR@ |
|
68 |
|
69 SHELL = /bin/sh |
|
70 @SET_MAKE@ |
|
71 |
|
72 srcdir = @srcdir@ |
|
73 top_srcdir = @top_srcdir@ |
|
74 VPATH = @srcdir@ |
|
75 |
|
76 topdir = .. |
|
77 subdir = lib |
|
78 |
|
79 .SUFFIXES: |
|
80 .SUFFIXES: .c .o |
|
81 .c.o: |
|
82 @$(RM) $@ $(@:.o=.os) |
|
83 if test -n "$(PICFLAGS)"; then \ |
|
84 $(COMPILE) $(PICFLAGS) $< && $(MV) $@ $(@:.o=.os); \ |
|
85 else true; fi |
|
86 $(COMPILE) $< |
|
87 |
|
88 INCLUDES = -I$(topdir) -I. -I$(srcdir) |
|
89 |
|
90 # generic sources |
|
91 SRCS1 = begin.c cntl.c end.c errmsg.c errno.c fill.c flag.c getarhdr.c \ |
|
92 getarsym.c getbase.c getdata.c getident.c getscn.c hash.c kind.c \ |
|
93 ndxscn.c newdata.c newscn.c next.c nextscn.c rand.c rawdata.c \ |
|
94 rawfile.c strptr.c update.c version.c checksum.c |
|
95 OBJS1 = begin.o cntl.o end.o errmsg.o errno.o fill.o flag.o getarhdr.o \ |
|
96 getarsym.o getbase.o getdata.o getident.o getscn.o hash.o kind.o \ |
|
97 ndxscn.o newdata.o newscn.o next.o nextscn.o rand.o rawdata.o \ |
|
98 rawfile.o strptr.o update.o version.o checksum.o |
|
99 |
|
100 # 32-bit sources |
|
101 SRCS2 = 32.fsize.c 32.getehdr.c 32.getphdr.c 32.getshdr.c 32.newehdr.c \ |
|
102 32.newphdr.c 32.xlatetof.c |
|
103 OBJS2 = 32.fsize.o 32.getehdr.o 32.getphdr.o 32.getshdr.o 32.newehdr.o \ |
|
104 32.newphdr.o 32.xlatetof.o |
|
105 |
|
106 # support |
|
107 SRCS3 = cook.c data.c input.c assert.c |
|
108 OBJS3 = cook.o data.o input.o assert.o |
|
109 |
|
110 # nlist |
|
111 SRCS4 = nlist.c |
|
112 OBJS4 = nlist.o |
|
113 |
|
114 # opt |
|
115 SRCS5 = opt.delscn.c x.remscn.c x.movscn.c x.elfext.c |
|
116 OBJS5 = opt.delscn.o x.remscn.o x.movscn.o x.elfext.o |
|
117 |
|
118 # 64-bit sources |
|
119 SRCS64 = 64.xlatetof.c gelfehdr.c gelfphdr.c gelfshdr.c gelftrans.c swap64.c |
|
120 OBJS64 = 64.xlatetof.o gelfehdr.o gelfphdr.o gelfshdr.o gelftrans.o swap64.o |
|
121 |
|
122 # Versioning sources |
|
123 SRCS_V = verdef_32_tof.c verdef_32_tom.c verdef_64_tof.c verdef_64_tom.c |
|
124 OBJS_V = verdef_32_tof.o verdef_32_tom.o verdef_64_tof.o verdef_64_tom.o |
|
125 HDRS_V = verdef.h verneed.h |
|
126 |
|
127 SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4) $(SRCS5) $(SRCS64) $(SRCS_V) |
|
128 OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5) $(OBJS64) $(OBJS_V) |
|
129 |
|
130 # missing functions |
|
131 LIBSRCS = memset.c |
|
132 LIBOBJS = @LIBOBJS@ |
|
133 |
|
134 # public header files |
|
135 HDRS = libelf.h nlist.h gelf.h |
|
136 |
|
137 # public header files (created by configure) |
|
138 AUXHDRS = sys_elf.h |
|
139 |
|
140 # private header files |
|
141 PRIVHDRS = byteswap.h errors.h ext_types.h private.h elf_repl.h \ |
|
142 $(HDRS_V) |
|
143 |
|
144 DISTFILES = $(SRCS) $(LIBSRCS) $(HDRS) $(PRIVHDRS) Makefile.in sys_elf.h.in \ |
|
145 Makefile.w32 build.bat config.h.w32 libelf.def sys_elf.h.w32 |
|
146 |
|
147 all: libelf.a shared-$(DO_SHLIB) |
|
148 |
|
149 check: |
|
150 |
|
151 shared-yes: $(SHLIB) |
|
152 shared-no: |
|
153 |
|
154 libelf.a: $(OBJS) $(LIBOBJS) |
|
155 @$(RM) $@ |
|
156 $(AR) rcv $@ $(OBJS) $(LIBOBJS) |
|
157 $(RANLIB) $@ |
|
158 |
|
159 $(SHLIB): libelf.a |
|
160 @$(RM) $(SHLIB) |
|
161 $(LINK_SHLIB) -o $(SHLIB) $(OBJS:.o=.os) $(LIBOBJS:.o=.os) $(DEPSHLIBS) |
|
162 if test "$(SONAME)" = "$(SHLIB)"; then true; else \ |
|
163 $(RM) $(SONAME) && $(LN_S) $(SHLIB) $(SONAME); \ |
|
164 fi |
|
165 if test "$(SHLINK)" = "$(SHLIB)"; then true; else \ |
|
166 $(RM) $(SHLINK) && $(LN_S) $(SHLIB) $(SHLINK); \ |
|
167 fi |
|
168 |
|
169 install: install-data \ |
|
170 install-shared-$(DO_SHLIB) install-compat-$(DO_COMPAT) |
|
171 |
|
172 installdirs: $(top_srcdir)/mkinstalldirs |
|
173 dirs="$(installdirs)"; for dir in $$dirs; do \ |
|
174 $(SHELL) $(top_srcdir)/mkinstalldirs $(instroot)$$dir; \ |
|
175 done |
|
176 |
|
177 install-data: all installdirs |
|
178 $(INSTALL_DATA) libelf.a $(instroot)$(libdir) |
|
179 -cd $(instroot)$(libdir) && $(RANLIB) libelf.a |
|
180 files="$(HDRS) $(AUXHDRS) elf_repl.h"; for file in $$files; do \ |
|
181 if test -r $$file; then \ |
|
182 $(INSTALL_DATA) $$file $(instroot)$(includedir)/libelf; \ |
|
183 else \ |
|
184 $(INSTALL_DATA) $(srcdir)/$$file $(instroot)$(includedir)/libelf; \ |
|
185 fi; \ |
|
186 done |
|
187 |
|
188 uninstall: uninstall-data \ |
|
189 uninstall-shared-$(DO_SHLIB) uninstall-compat-$(DO_COMPAT) |
|
190 |
|
191 uninstall-data: |
|
192 $(RM) $(instroot)$(libdir)/libelf.a |
|
193 $(RM) -r $(instroot)$(includedir)/libelf |
|
194 |
|
195 install-shared-yes: install-shared |
|
196 install-shared-no: |
|
197 install-shared: installdirs $(SHLIB) |
|
198 $(INSTALL_SHLIB) $(SHLIB) $(instroot)$(libdir) |
|
199 if test "$(SONAME)" = "$(SHLIB)"; then true; else \ |
|
200 cd $(instroot)$(libdir) && $(RM) $(SONAME) && $(LN_S) $(SHLIB) $(SONAME); \ |
|
201 fi |
|
202 if test "$(SHLINK)" = "$(SHLIB)"; then true; else \ |
|
203 cd $(instroot)$(libdir) && $(RM) $(SHLINK) && $(LN_S) $(SHLIB) $(SHLINK); \ |
|
204 fi |
|
205 |
|
206 uninstall-shared-yes: uninstall-shared |
|
207 uninstall-shared-no: |
|
208 uninstall-shared: |
|
209 cd $(instroot)$(libdir) && $(RM) $(SHLIB) $(SONAME) $(SHLINK) |
|
210 |
|
211 install-compat-yes: install-compat |
|
212 install-compat-no: |
|
213 install-compat: installdirs |
|
214 files="$(HDRS)"; for file in $$files; do \ |
|
215 if test -f $(instroot)$(includedir)/$$file; then true; else \ |
|
216 echo "#include <libelf/$$file>" > $(instroot)$(includedir)/$$file; \ |
|
217 fi; \ |
|
218 done |
|
219 |
|
220 uninstall-compat-yes: uninstall-compat |
|
221 uninstall-compat-no: |
|
222 uninstall-compat: |
|
223 files="$(HDRS)"; for file in $$files; do \ |
|
224 if grep "^#include <libelf/$$file>\$$" $(instroot)$(includedir)/$$file >/dev/null 2>&1; then \ |
|
225 $(RM) $(instroot)$(includedir)/$$file; \ |
|
226 else true; fi; \ |
|
227 done |
|
228 |
|
229 mostlyclean: |
|
230 $(RM) *.o *.a *.os $(SHLIB) $(SONAME) $(SHLINK) |
|
231 $(RM) *~ core a.out errlist |
|
232 |
|
233 clean: mostlyclean |
|
234 |
|
235 distclean: clean |
|
236 $(RM) stamp-h $(AUXHDRS) |
|
237 $(RM) Makefile |
|
238 |
|
239 maintainer-clean: distclean |
|
240 |
|
241 # maintainer only |
|
242 |
|
243 MAINT = @MAINT@ |
|
244 |
|
245 distdir = $(PACKAGE)-$(VERSION) |
|
246 distsubdir = $(topdir)/$(distdir)/$(subdir) |
|
247 $(MAINT)dist: $(DISTFILES) |
|
248 if test -d $(distsubdir); then true; else mkdir $(distsubdir); fi |
|
249 files="$(DISTFILES)"; for file in $$files; do \ |
|
250 ln $(srcdir)/$$file $(distsubdir) || \ |
|
251 cp -p $(srcdir)/$$file $(distsubdir) || exit 1; \ |
|
252 done |
|
253 |
|
254 # For the justification of the following Makefile rules, see node |
|
255 # `Automatic Remaking' in GNU Autoconf documentation. |
|
256 |
|
257 $(MAINT)Makefile: Makefile.in $(topdir)/config.status |
|
258 cd $(topdir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status |
|
259 |
|
260 $(MAINT)sys_elf.h: stamp-h |
|
261 $(MAINT)stamp-h: sys_elf.h.in $(topdir)/config.status |
|
262 cd $(topdir) && CONFIG_FILES= CONFIG_HEADERS=$(subdir)/sys_elf.h ./config.status |
|
263 $(RM) stamp-h && echo timestamp > stamp-h |
|
264 |
|
265 # Tell versions [3.59,3.63) of GNU make not to export all variables. |
|
266 # Otherwise a system limit (for SysV at least) may be exceeded. |
|
267 .NOEXPORT: |
|
268 |
|
269 # dependencies |
|
270 $(OBJS): private.h $(topdir)/config.h libelf.h gelf.h errors.h $(AUXHDRS) |
|
271 32.fsize.o: ext_types.h |
|
272 32.xlatetof.o: byteswap.h ext_types.h |
|
273 64.xlatetof.o: byteswap.h ext_types.h |
|
274 getarsym.o: byteswap.h |
|
275 memset.o: $(topdir)/config.h |
|
276 nlist.o: nlist.h |
|
277 swap64.o: byteswap.h |
|
278 $(OBJS_V): byteswap.h ext_types.h $(HDRS_V) |