# Generated automatically from Makefile.in by configure.
# lib/Makefile for libelf.
# Copyright (C) 1995, 1996 Michael Riepe <michael@stud.uni-hannover.de>
# 
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

prefix = /usr/local
exec_prefix = ${prefix}
libdir = ${exec_prefix}/lib
includedir = ${prefix}/include
installdirs = $(libdir) $(includedir) $(includedir)/libelf

CC = gcc
LD = /usr/bin/ld
AR = ar
MV = mv -f
RM = rm -f
LN_S = ln -s
RANLIB = ranlib
INSTALL = /usr/bin/ginstall -c
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_PROGRAM = ${INSTALL}

CFLAGS = -g -O
CPPFLAGS = 
DEFS = -DHAVE_CONFIG_H
LDFLAGS = 
LIBS = 

DO_SHLIB = yes
PICFLAGS = -fPIC
SHLIB = $(PACKAGE).so.$(VERSION)
SHLINK = $(PACKAGE).so
SONAME = $(PACKAGE).so.$(MAJOR)
LINK_SHLIB = $(CC) -shared -Wl,-soname,$(SONAME)
INSTALL_SHLIB = $(INSTALL_PROGRAM)

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

# no user serviceable parts below

PACKAGE = libelf
VERSION = 0.6.4
MAJOR = 0

SHELL = /bin/sh


srcdir = .
top_srcdir = ..

topdir = ..
subdir = lib

picdir = ../pic
back = ../lib

.SUFFIXES:
.SUFFIXES: .c .o
.c.o:
	@$(RM) $@ $(picdir)/$@
	if test -n "$(PICFLAGS)"; then \
	  $(COMPILE) $(PICFLAGS) $< && $(MV) $@ $(picdir); \
	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
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

# 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
OBJS3 = cook.o data.o input.o

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

# opt
SRCS5 = opt.delscn.c
OBJS5 = opt.delscn.o

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

# missing functions
LIBSRCS = memset.c
LIBOBJS = 

# public header files
HDRS = libelf.h nlist.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

DISTFILES = $(SRCS) $(LIBSRCS) $(HDRS) $(PRIVHDRS) Makefile.in

all: $(picdir) libelf.a shared-$(DO_SHLIB)

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

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

$(SHLIB): $(picdir) $(OBJS) $(LIBOBJS)
	@$(RM) $(SHLIB)
	cd $(picdir) && $(LINK_SHLIB) -o $(back)/$(SHLIB) $(OBJS) $(LIBOBJS)
	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

$(picdir):
	@$(RM) -r $(picdir)
	mkdir $(picdir)

install: all installdirs install-data install-shared-$(DO_SHLIB)

install-shared-yes: install-shared
install-shared-no:

installdirs: $(top_srcdir)/mkinstalldirs
	$(SHELL) $(top_srcdir)/mkinstalldirs $(installdirs)

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

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

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

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

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

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

clean: mostlyclean

distclean: clean
	$(RM) Makefile $(AUXHDRS)
	$(RM) -r $(picdir)

maintainer-clean: distclean

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

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

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

# 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 errors.h $(AUXHDRS)
32.fsize.o: ext_types.h
32.xlatetof.o: byteswap.h ext_types.h
getarsym.o: byteswap.h
memset.o: $(topdir)/config.h
nlist.o: nlist.h
