# Copyright 2000, International Business Machines Corporation and others.
# All Rights Reserved.
# 
# This software has been released under the terms of the IBM Public
# License.  For details, see the LICENSE file in the top-level source
# directory or online at http://www.openafs.org/dl/license10.html

srcdir=@srcdir@
include @TOP_OBJDIR@/src/config/Makefile.config

INCLS=${TOP_INCDIR}/ubik.h \
	       	${TOP_INCDIR}/lwp.h \
	       	${TOP_INCDIR}/lock.h  \
	       	${TOP_INCDIR}/rx/rx.h \
	       	${TOP_INCDIR}/rx/xdr.h \
		${TOP_INCDIR}/afs/com_err.h

VERS =	AFS_component_version_number.o
OBJS =		adkint.cs.o adkint.xdr.o

LIBS=${TOP_LIBDIR}/libkauth.a \
		${TOP_LIBDIR}/libauth.a \
		${TOP_LIBDIR}/libcmd.a \
	        ${TOP_LIBDIR}/libcom_err.a \
		${TOP_LIBDIR}/libubik.a \
		${TOP_LIBDIR}/librxkad.a \
		${TOP_LIBDIR}/libdes.a \
		${TOP_LIBDIR}/librx.a \
	        ${TOP_LIBDIR}/liblwp.a \
	       	${TOP_LIBDIR}/libsys.a \
		${TOP_LIBDIR}/util.a

CELL=		`pwd|awk -F/ '{print $$3}'`
USNS=		cellname

include ../config/Makefile.version

noversion:	install

all: dlog dpass

clean:
		$(RM) -f adkint.h adkint.cs.c adkint.ss.c adkint.xdr.c *.o dlog dpass AFS_component_version_number.c

adkint.cs.o:	adkint.cs.c
adkint.xdr.o:	adkint.xdr.c adkint.h

adkint.cs.c: adkint.xg
	${RXGEN} -C -o $@ ${srcdir}/adkint.xg

adkint.xdr.c: adkint.xg
	${RXGEN} -c -o $@ ${srcdir}/adkint.xg

adkint.h: adkint.xg
	${RXGEN} -h -o $@ ${srcdir}/adkint.xg

dlog:		dlog.o $(VERS) $(OBJS) $(LIBS)
		$(CC) ${LDFLAGS} -o dlog dlog.o $(VERS) $(OBJS) ${LIBS} \
				${XLIBS}

dlog.o: 	dlog.c adkint.h

dpass:		dpass.o $(VERS) $(LIBS)
		$(CC) ${LDFLAGS} -o dpass dpass.o $(VERS) $(LIBS) ${XLIBS}

# Test version of dlog just checks ASN.1 date conversion.
dlog_test:	dlog.c $(OBJS) $(LIBS)
		$(CC) $(LDFLAGS) -DDLOG_TEST -o dlog_test dlog.c $(OBJS) \
			$(LIBS) ${XLIBS}

${DEST}/bin/dlog: dlog
	${INSTALL} $? $@

${DEST}/bin/dpass: dpass
	${INSTALL} $? $@


install:  ${DESTDIR}${bindir}/dlog ${DESTDIR}${bindir}/dpass
${DESTDIR}${bindir}/dlog: dlog
	${INSTALL} $? $@

${DESTDIR}${bindir}/dpass: dpass
	${INSTALL} $? $@

dest:  ${DEST}/bin/dlog ${DEST}/bin/dpass

