#-----------------------------------------------------------------------------
# Copyright (c) 1990 Regents of the University of Michigan.
# All rights reserved.
#
# Redistribution and use in source and binary forms are permitted
# provided that this notice is preserved and that due credit is given
# to the University of Michigan at Ann Arbor. The name of the University
# may not be used to endorse or promote products derived from this
# software without specific prior written permission. This software
# is provided ``as is'' without express or implied warranty.
#
#       lightweight ber library makefile
#
#-----------------------------------------------------------------------------

SRCS	= decode.c encode.c io.c
OBJS	= decode.o encode.o io.o

CFLAGS	= $(ACFLAGS) -I../h

default:
	(cd ../; make lber-library)

all:	liblber.a etest dtest

liblber.a:	version.o
	ar ruv $@ $(OBJS) version.o
	if [ ! -z "$(RANLIB)" ]; then \
		$(RANLIB) $@; \
	fi

idtest:	idtest.o
	$(CC) $(ALDFLAGS) -o $@ idtest.c $(ISODEINCLUDEFLAG) \
		$(KRBINCLUDEFLAG) $(ISODELIBFLAG) $(ISODELIBS) \
		$(KRBLIBLFAG) $(KRBLIBS)

etest:	liblber.a etest.o
	$(CC) $(ALDFLAGS) -o $@ etest.o ./liblber.a

dtest:	liblber.a dtest.o
	$(CC) $(ALDFLAGS) -o $@ dtest.o ./liblber.a

version.c: $(OBJS)
	rm -f $@
	(u=$${USER-root} v=`cat ../version` d=`pwd` h=`hostname` t=`date`; \
	sed -e "s|%WHEN%|$${t}|" \
	-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
	-e "s|%VERSION%|$${v}|" \
	< Version.c > $@)

install:	$(LIBDIR)/liblber.a

$(LIBDIR)/liblber.a:	liblber.a
	$(INSTALL) $(INSTALLFLAGS) -m 644 liblber.a $(LIBDIR)
	if [ ! -z "$(RANLIB)" ]; then \
		(cd /tmp; $(RANLIB) $@) \
	fi

lint:;
	lint -I../h $(SRCS)

5lint:;
	/usr/5bin/lint -I../h $(SRCS)

clean:;
	rm -f liblber.a *.o core a.out version.c dtest etest idtest

depend:;
	../mkdep $(CFLAGS) $(SRCS)

# DO NOT DELETE THIS LINE -- mkdep uses it.
# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.

decode.o: decode.c ../h/lber.h
encode.o: encode.c ../h/lber.h
io.o: io.c ../h/lber.h

# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
