#
# This Makefile in in the public domain
#

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

OPTMZ = @KRB5CFLAGS@ -DALLOW_REGISTER
AKLIBS = ${LIBS} @KRB5LIBS@
AFSLIBS = ${TOP_LIBDIR}/libprot.a ${TOP_LIBDIR}/libubik.a \
	  ${TOP_LIBDIR}/libauth.a ${TOP_LIBDIR}/librxkad.a \
	  ${TOP_LIBDIR}/librx.a ${TOP_LIBDIR}/liblwp.a \
	  ${TOP_LIBDIR}/libsys.a ${TOP_LIBDIR}/libdes.a \
	  ${TOP_LIBDIR}/libcom_err.a ${TOP_LIBDIR}/libafsutil.a

SRCS=	aklog.c aklog_main.c  krb_util.c linked_list.c
OBJS=   aklog.o aklog_main.o krb_util.o linked_list.o

all: aklog asetkey klog

aklog:	${OBJS} ${AFSLIBS}
	${CC} -o $@ ${CFLAGS} ${OBJS} ${AKLIBS} ${AFSLIBS} ${XLIBS}

asetkey: asetkey.o ${AFSLIBS}
	${CC} -o $@ ${CFLAGS} asetkey.o ${AKLIBS} ${AFSLIBS} ${XLIBS}

klog: klog.o skipwrap.o ${AFSLIBS}
	${CC} -o $@ ${CFLAGS} skipwrap.o klog.o ${AKLIBS} ${AFSLIBS} \
		${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/librx.a ${XLIBS}

#
# Installation targets
#
install: \
	${DESTDIR}${bindir}/aklog ${DESTDIR}${bindir}/klog.krb5 \
	${DESTDIR}${afssrvbindir}/asetkey

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

${DESTDIR}${bindir}/klog.krb5: klog
	${INSTALL} -f $? $@

${DESTDIR}${afssrvbindir}/asetkey: asetkey
	${INSTALL} $? $@

dest: \
	${DEST}/bin/aklog ${DEST}/bin/klog.krb5 \
	${DEST}/root.server/usr/afs/bin/asetkey

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

${DEST}/bin/klog.krb5: klog
	${INSTALL} -f $? $@

${DEST}/root.server/usr/afs/bin/asetkey: asetkey
	${INSTALL} $? $@

#
# Misc. targets
#
clean:
	$(RM) -f *.o ${OBJS} aklog asetkey klog

include ../config/Makefile.version

