#-----------------------------------------------------------------------------
# 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

liblber.a:	$(OBJS) version.o
	ar ruv $@ $(OBJS) version.o
	ranlib $@

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: Version.c
	(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 > version.c)

install:	$(LIBDIR)/liblber.a

$(LIBDIR)/liblber.a:	liblber.a
	install -c -m 755 liblber.a $(LIBDIR)
	(cd /tmp; ranlib $@)

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 /usr/include/stdio.h /usr/include/malloc.h
decode.o: /usr/include/varargs.h /usr/include/string.h
decode.o: /usr/include/sys/stdtypes.h ../h/lber.h
encode.o: encode.c /usr/include/stdio.h /usr/include/malloc.h
encode.o: /usr/include/varargs.h /usr/include/memory.h /usr/include/string.h
encode.o: /usr/include/sys/stdtypes.h ../h/lber.h
io.o: io.c /usr/include/stdio.h /usr/include/ctype.h /usr/include/malloc.h
io.o: /usr/include/memory.h /usr/include/string.h /usr/include/sys/stdtypes.h
io.o: ../h/lber.h

# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
