#
# This Makefile in in the public domain
#

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


MODULE_CFLAGS=@KRB5_CPPFLAGS@ -DALLOW_REGISTER

AKLIBS= ${LIBS} @KRB5_LDFLAGS@ @KRB5_LIBS@
AFSLIBS= ${TOP_LIBDIR}/libafsauthent.a \
         ${TOP_LIBDIR}/libafsrpc.a \
	 ${TOP_LIBDIR}/libafshcrypto.a \
	 ${TOP_LIBDIR}/libcmd.a \
	 ${TOP_LIBDIR}/libopr.a \
         ${TOP_LIBDIR}/util.a

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

all: aklog asetkey klog

aklog:	${OBJS} ${AFSLIBS}
	$(AFS_LDRULE) ${OBJS} ${AKLIBS} ${AFSLIBS} $(LIB_roken) ${MT_LIBS}

asetkey: asetkey.o ${AFSLIBS}
	$(AFS_LDRULE) asetkey.o ${AKLIBS} ${AFSLIBS} $(LIB_roken) ${MT_LIBS}

klog:	klog.o skipwrap.o ${AFSLIBS}
	$(AFS_LDRULE) klog.o skipwrap.o \
		${AKLIBS} ${AFSLIBS} $(LIB_roken) ${MT_LIBS}

#
# Installation targets
#
install: aklog asetkey klog
	${INSTALL} -d ${DESTDIR}${bindir}
	${INSTALL_PROGRAM} aklog ${DESTDIR}${bindir}/aklog
	${INSTALL_PROGRAM} klog ${DESTDIR}${bindir}/klog.krb5
	${INSTALL} -d ${DESTDIR}${afssrvbindir}
	${INSTALL_PROGRAM} asetkey ${DESTDIR}${afssrvbindir}/asetkey 

dest: aklog asetkey klog
	${INSTALL} -d ${DEST}/bin
	${INSTALL_PROGRAM} aklog ${DEST}/bin/aklog
	${INSTALL_PROGRAM} klog ${DEST}/bin/klog.krb5
	${INSTALL} -d ${DEST}/root.server/usr/afs/bin
	${INSTALL_PROGRAM} asetkey ${DEST}/root.server/usr/afs/bin/asetkey

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

include ../config/Makefile.version
