#
# $Id: Makefile.in,v 1.22 1996/11/15 18:39:12 bg Exp $
#

SHELL = /bin/sh

srcdir = @srcdir@
VPATH = @srcdir@

CC = @CC@
AR = ar
RANLIB = @RANLIB@
DEFS = @DEFS@ -DLIBDIR='"$(libdir)"'
CFLAGS = @CFLAGS@

INSTALL = @INSTALL@
INSTALL_DATA	= @INSTALL_DATA@
MKINSTALLDIRS = @top_srcdir@/mkinstalldirs

prefix = @prefix@
exec_prefix = $(prefix)
libdir = $(exec_prefix)/lib
includedir = $(prefix)/include

PICFLAGS = @PICFLAGS@
 
LIBNAME = libkrbafs
LIBEXT = @LIBEXT@
SHLIBEXT = @SHLIBEXT@
SHARED = @SHARED@
AFS_EXTRA_LIBS	= @AFS_EXTRA_LIBS@
LIB = $(LIBNAME).$(LIBEXT) $(AFS_EXTRA_LIBS)

SOURCES = afssys.c afslib.c afs_string_to_key.c lifetime.c resolve.c

OBJECTS = afssys.o afs_string_to_key.o lifetime.o resolve.o

all: $(LIB)

Wall:
	make CFLAGS="-g -Wall -Wno-comment -Wmissing-prototypes -Wmissing-declarations -D__USE_FIXED_PROTOTYPES__"

.c.o:
	$(CC) -c $(CPPFLAGS) $(DEFS) -I$(srcdir) $(CFLAGS) $(PICFLAGS) $<

install: all
	$(MKINSTALLDIRS) $(includedir)
	$(MKINSTALLDIRS) $(libdir)
	$(INSTALL) -m 0555 $(LIB) $(libdir)
	$(INSTALL) -m 0644 krbafs.h $(includedir)	

uninstall:

TAGS: $(SOURCES)
	etags $(SOURCES)

check:

clean:
	rm -f $(LIB) *.o *.a

mostlyclean: clean

distclean: clean
	rm -f Makefile *.tab.c *~

realclean: distclean
	rm -f TAGS

dist: $(DISTFILES)
	for file in $(DISTFILES); do \
	  ln $$file ../`cat ../.fname`/lib \
	    || cp -p $$file ../`cat ../.fname`/lib; \
	done

$(LIBNAME).a: $(OBJECTS) @AFS_EXTRA_OBJS@
	rm -f $@
	$(AR) cr $@ $(OBJECTS) @AFS_EXTRA_OBJS@
	-$(RANLIB) $@


$(LIBNAME).$(SHLIBEXT): $(OBJECTS)
	rm -f $@
	$(CC) $(CFLAGS) $(PICFLAGS) $(SHARED) -o $@ $(OBJECTS)

# AIX: this almost works with gcc, but somehow it fails to use the
# correct ld, use ld instead
afslib.so: afslib.o
	ld -o $@ -bM:SRE -bI:$(srcdir)/afsl.exp -bE:$(srcdir)/afslib.exp -bnoentry afslib.o

$(OBJECTS): config.h
