# 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
include @TOP_OBJDIR@/src/config/Makefile.lwp

SHELL=/bin/sh

#
# This must be built after inetd has built ta-rauth.o and after rsh
# XXX want these to end up in /usr/afsws ...
# Note that if afskauthlib.so gets installed on a client
# machine then that will be used ..
#
LIBDIR=${TOP_LIBDIR}/
AFSLIBS=${TOP_LIBDIR}/libkauth.a \
	${TOP_LIBDIR}/libprot.a \
	${LIBDIR}/libubik.a \
	${TOP_LIBDIR}/libauth.a \
	${TOP_LIBDIR}/librxkad.a \
	${TOP_LIBDIR}/libsys.a \
	${LIBDIR}/librx.a \
	${TOP_LIBDIR}/libafsrfc3961.a \
	${TOP_LIBDIR}/libafshcrypto_lwp.a \
	${LIBDIR}/liblwp.a \
        ${TOP_LIBDIR}/libcmd.a \
	${TOP_LIBDIR}/libafscom_err.a \
	${TOP_LIBDIR}/util.a

KAFSLIBS=${TOP_LIBDIR}/libkauth.krb.a \
	${TOP_LIBDIR}/libprot.a \
	${LIBDIR}/libubik.a \
	${TOP_LIBDIR}/libauth.krb.a \
	${TOP_LIBDIR}/librxkad.a \
	${TOP_LIBDIR}/libsys.a \
	${LIBDIR}/librx.a \
	${TOP_LIBDIR}/libafsrfc3961.a \
	${TOP_LIBDIR}/libafshcrypto_lwp.a \
	${LIBDIR}/liblwp.a \
        ${TOP_LIBDIR}/libcmd.a \
	${TOP_LIBDIR}/libafscom_err.a \
	${TOP_LIBDIR}/util.a

AUTHFILES=ta-rauth.o rcmd.o herror.o
AUTHLIBS=afsauthlib.so afskauthlib.so
TARGETS=$(AUTHLIBS)

all: ${TOP_LIBDIR}/afsauthlib.so ${TOP_LIBDIR}/afskauthlib.so

${TOP_LIBDIR}/afsauthlib.so: afsauthlib.so
	${INSTALL_DATA} $? $@

${TOP_LIBDIR}/afskauthlib.so: afskauthlib.so
	${INSTALL_DATA} $? $@

install install.noversion: afsauthlib.so afskauthlib.so
	${INSTALL} -d ${DESTDIR}${libdir}
	${INSTALL_DATA} afsauthlib.so ${DESTDIR}${libdir}/afsauthlib.so
	${INSTALL_DATA} afskauthlib.so ${DESTDIR}${libdir}/afskauthlib.so

dest: afsauthlib.so afskauthlib.so
	${INSTALL} -d ${DEST}/root.client/usr/vice/etc
	${INSTALL_DATA} afsauthlib.so \
		${DEST}/root.client/usr/vice/etc/afsauthlib.so
	${INSTALL_DATA} afskauthlib.so \
		${DEST}/root.client/usr/vice/etc/afskauthlib.so

clean:
	$(RM) -f $(AUTHLIBS) $(AUTHFILES)

afsauthlib.so: sgi_auth.o ${AFSLIBS} ${AUTHFILES}
	$(LD) ${AFS_LDFLAGS} -shared -all -o afsauthlib.so sgi_auth.o $(AFSLIBS) ${AUTHFILES}

afskauthlib.so: sgi_auth.o ${KAFSLIBS} ${AUTHFILES}
	$(LD) ${AFS_LDFLAGS} -shared -all -o afskauthlib.so sgi_auth.o $(KAFSLIBS) ${AUTHFILES}

ta-rauth.o: ta-rauth.c

rcmd.o: rcmd.c

herror.o: herror.c

sgi_auth.o: sgi_auth.c
