# 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

DEST=@DEST@
TOP_INCDIR=@TOP_INCDIR@
TOP_LIBDIR=@TOP_LIBDIR@
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
sbindir=@sbindir@
libexecdir=@libexecdir@
libdir=@libdir@
includedir=@includedir@
mandir=@mandir@
afssrvbindir=@afssrvbindir@
afssrvsbindir=@afssrvsbindir@
afssrvlibexecdir=@afssrvlibexecdir@
RXGEN=${TOP_SRCDIR}/rxgen/rxgen
TOP_SRCDIR=@TOP_SRCDIR@
SYS_NAME=@AFS_SYSNAME@

SHELL = 	/bin/sh

include ../config/Makefile.${SYS_NAME}

COMPILE_ET=${TOP_SRCDIR}/comerr/compile_et
OPTMZ=	-g

CFLAGS=${OPTMZ} -I${TOP_SRCDIR}/config -I${TOP_INCDIR} ${XCFLAGS}
LDFLAGS =	${OPTMZ} ${XLDFLAGS}

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

ukinstall webinstall:
		echo No $@ source here

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.xdr.c adkint.h: adkint.xg
		${RXGEN} 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

