summaryrefslogtreecommitdiff
path: root/lib/Makefile.in
blob: 92a129fd5c06885905aa8ed56b1e16043cf9d644 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
# lib/Makefile for libelf.
# Copyright (C) 1995 - 2009 Michael Riepe
# 
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
# 
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.
# 
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA

# @(#) $Id: Makefile.in,v 1.40 2009/11/01 13:04:19 michael Exp $

instroot =

prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
includedir = @includedir@
installdirs = $(libdir) $(includedir) $(includedir)/libelf

CC = @CC@
LD = @LD@
AR = ar
MV = mv -f
RM = rm -f
LN_S = @LN_S@
RANLIB = @RANLIB@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@

CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
DEFS = -DHAVE_CONFIG_H
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
DEPSHLIBS = @DEPSHLIBS@

DO_SHLIB = @DO_SHLIB@
PICFLAGS = @PICFLAGS@
SHLIB_SFX = @SHLIB_SFX@
SHLINK_SFX = @SHLINK_SFX@
SONAME_SFX = @SONAME_SFX@
LINK_SHLIB = @LINK_SHLIB@
INSTALL_SHLIB = @INSTALL_SHLIB@

SHLIB = libelf$(SHLIB_SFX)
SHLINK = libelf$(SHLINK_SFX)
SONAME = libelf$(SONAME_SFX)

# install includes in includedir?
DO_COMPAT = @DO_COMPAT@

COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)

# no user serviceable parts below

PACKAGE = @PACKAGE@
VERSION = @VERSION@
MAJOR = @MAJOR@

SHELL = /bin/sh
@SET_MAKE@

srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@

topdir = ..
subdir = lib

.SUFFIXES:
.SUFFIXES: .c .o
.c.o:
	@$(RM) $@ $(@:.o=.os)
	if test -n "$(PICFLAGS)"; then \
	  $(COMPILE) $(PICFLAGS) $< && $(MV) $@ $(@:.o=.os); \
	else true; fi
	$(COMPILE) $<

INCLUDES = -I$(topdir) -I. -I$(srcdir)

# generic sources
SRCS1 = begin.c cntl.c end.c errmsg.c errno.c fill.c flag.c getarhdr.c \
	getarsym.c getbase.c getdata.c getident.c getscn.c hash.c kind.c \
	ndxscn.c newdata.c newscn.c next.c nextscn.c rand.c rawdata.c \
	rawfile.c strptr.c update.c version.c checksum.c getaroff.c
OBJS1 = begin.o cntl.o end.o errmsg.o errno.o fill.o flag.o getarhdr.o \
	getarsym.o getbase.o getdata.o getident.o getscn.o hash.o kind.o \
	ndxscn.o newdata.o newscn.o next.o nextscn.o rand.o rawdata.o \
	rawfile.o strptr.o update.o version.o checksum.o getaroff.o

# 32-bit sources
SRCS2 = 32.fsize.c 32.getehdr.c 32.getphdr.c 32.getshdr.c 32.newehdr.c \
	32.newphdr.c 32.xlatetof.c
OBJS2 = 32.fsize.o 32.getehdr.o 32.getphdr.o 32.getshdr.o 32.newehdr.o \
	32.newphdr.o 32.xlatetof.o

# support
SRCS3 = cook.c data.c input.c assert.c
OBJS3 = cook.o data.o input.o assert.o

# nlist
SRCS4 = nlist.c
OBJS4 = nlist.o

# opt
SRCS5 = opt.delscn.c x.remscn.c x.movscn.c x.elfext.c
OBJS5 = opt.delscn.o x.remscn.o x.movscn.o x.elfext.o

# 64-bit sources
SRCS64 = 64.xlatetof.c gelfehdr.c gelfphdr.c gelfshdr.c gelftrans.c swap64.c
OBJS64 = 64.xlatetof.o gelfehdr.o gelfphdr.o gelfshdr.o gelftrans.o swap64.o

# Versioning sources
SRCS_V = verdef_32_tof.c verdef_32_tom.c verdef_64_tof.c verdef_64_tom.c
OBJS_V = verdef_32_tof.o verdef_32_tom.o verdef_64_tof.o verdef_64_tom.o
HDRS_V = verdef.h verneed.h

SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4) $(SRCS5) $(SRCS64) $(SRCS_V)
OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5) $(OBJS64) $(OBJS_V)

# missing functions
LIBSRCS = memset.c
LIBOBJS = @LIBOBJS@

# public header files
HDRS = libelf.h nlist.h gelf.h

# public header files (created by configure)
AUXHDRS = sys_elf.h

# private header files
PRIVHDRS = byteswap.h errors.h ext_types.h private.h elf_repl.h \
	$(HDRS_V)

DISTFILES = $(SRCS) $(LIBSRCS) $(HDRS) $(PRIVHDRS) Makefile.in sys_elf.h.in \
    Makefile.w32 build.bat config.h.w32 libelf.def sys_elf.h.w32

all: libelf.a shared-$(DO_SHLIB)

check:

shared-yes: $(SHLIB)
shared-no:

libelf.a: $(OBJS) $(LIBOBJS)
	@$(RM) $@
	$(AR) rcv $@ $(OBJS) $(LIBOBJS)
	$(RANLIB) $@

$(SHLIB): libelf.a
	@$(RM) $(SHLIB)
	$(LINK_SHLIB) -o $(SHLIB) $(OBJS:.o=.os) $(LIBOBJS:.o=.os) $(DEPSHLIBS)
	if test "$(SONAME)" = "$(SHLIB)"; then true; else \
	  $(RM) $(SONAME) && $(LN_S) $(SHLIB) $(SONAME); \
	fi
	if test "$(SHLINK)" = "$(SHLIB)"; then true; else \
	  $(RM) $(SHLINK) && $(LN_S) $(SHLIB) $(SHLINK); \
	fi

install: install-data \
	install-shared-$(DO_SHLIB) install-compat-$(DO_COMPAT)

installdirs: $(top_srcdir)/mkinstalldirs
	dirs="$(installdirs)"; for dir in $$dirs; do \
	    $(SHELL) $(top_srcdir)/mkinstalldirs $(instroot)$$dir; \
	done

install-data: all installdirs
	$(INSTALL_DATA) libelf.a $(instroot)$(libdir)
	-cd $(instroot)$(libdir) && $(RANLIB) libelf.a
	files="$(HDRS) $(AUXHDRS) elf_repl.h"; for file in $$files; do \
	  if test -r $$file; then \
	    $(INSTALL_DATA) $$file $(instroot)$(includedir)/libelf; \
	  else \
	    $(INSTALL_DATA) $(srcdir)/$$file $(instroot)$(includedir)/libelf; \
	  fi; \
	done

uninstall: uninstall-data \
	uninstall-shared-$(DO_SHLIB) uninstall-compat-$(DO_COMPAT)

uninstall-data:
	$(RM) $(instroot)$(libdir)/libelf.a
	$(RM) -r $(instroot)$(includedir)/libelf

install-shared-yes: install-shared
install-shared-no:
install-shared: installdirs $(SHLIB)
	$(INSTALL_SHLIB) $(SHLIB) $(instroot)$(libdir)
	if test "$(SONAME)" = "$(SHLIB)"; then true; else \
	  cd $(instroot)$(libdir) && $(RM) $(SONAME) && $(LN_S) $(SHLIB) $(SONAME); \
	fi
	if test "$(SHLINK)" = "$(SHLIB)"; then true; else \
	  cd $(instroot)$(libdir) && $(RM) $(SHLINK) && $(LN_S) $(SHLIB) $(SHLINK); \
	fi

uninstall-shared-yes: uninstall-shared
uninstall-shared-no:
uninstall-shared:
	cd $(instroot)$(libdir) && $(RM) $(SHLIB) $(SONAME) $(SHLINK)

install-compat-yes: install-compat
install-compat-no:
install-compat: installdirs
	files="$(HDRS)"; for file in $$files; do \
	  if test -f $(instroot)$(includedir)/$$file; then true; else \
	    echo "#include <libelf/$$file>" > $(instroot)$(includedir)/$$file; \
	  fi; \
	done

uninstall-compat-yes: uninstall-compat
uninstall-compat-no:
uninstall-compat:
	files="$(HDRS)"; for file in $$files; do \
	  if grep "^#include <libelf/$$file>\$$" $(instroot)$(includedir)/$$file >/dev/null 2>&1; then \
	    $(RM) $(instroot)$(includedir)/$$file; \
	  else true; fi; \
	done

mostlyclean:
	$(RM) *.o *.a *.os $(SHLIB) $(SONAME) $(SHLINK)
	$(RM) *~ core a.out errlist

clean: mostlyclean

distclean: clean
	$(RM) stamp-h $(AUXHDRS)
	$(RM) Makefile

maintainer-clean: distclean

# maintainer only

MAINT = @MAINT@

distdir = $(PACKAGE)-$(VERSION)
distsubdir = $(topdir)/$(distdir)/$(subdir)
$(MAINT)dist: $(DISTFILES)
	if test -d $(distsubdir); then true; else mkdir $(distsubdir); fi
	files="$(DISTFILES)"; for file in $$files; do \
	  ln $(srcdir)/$$file $(distsubdir) || \
	    cp -p $(srcdir)/$$file $(distsubdir) || exit 1; \
	done

# For the justification of the following Makefile rules, see node
# `Automatic Remaking' in GNU Autoconf documentation.

$(MAINT)Makefile: Makefile.in $(topdir)/config.status
	cd $(topdir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status

$(MAINT)sys_elf.h: stamp-h
$(MAINT)stamp-h: sys_elf.h.in $(topdir)/config.status
	cd $(topdir) && CONFIG_FILES= CONFIG_HEADERS=$(subdir)/sys_elf.h ./config.status
	$(RM) stamp-h && echo timestamp > stamp-h

# Tell versions [3.59,3.63) of GNU make not to export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

# dependencies
$(OBJS): private.h $(topdir)/config.h libelf.h gelf.h errors.h $(AUXHDRS)
32.fsize.o: ext_types.h
32.xlatetof.o: byteswap.h ext_types.h
64.xlatetof.o: byteswap.h ext_types.h
getarsym.o: byteswap.h
memset.o: $(topdir)/config.h
nlist.o: nlist.h
swap64.o: byteswap.h
$(OBJS_V): byteswap.h ext_types.h $(HDRS_V)