# 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

LIBS1=${TOP_LIBDIR}/libubik.a        ${TOP_LIBDIR}/libprot.a
LIBS2=${TOP_LIBDIR}/librxkad.a       ${TOP_LIBDIR}/libaudit.a \
	${TOP_LIBDIR}/librx.a          ${TOP_LIBDIR}/liblwp.a \
	${TOP_LIBDIR}/libdes.a         ${TOP_LIBDIR}/libcmd.a \
	${TOP_LIBDIR}/libcom_err.a ${TOP_LIBDIR}/util.a \
	${TOP_LIBDIR}/libsys.a

LIBS=${TOP_LIBDIR}/libkauth.a ${LIBS1} ${TOP_LIBDIR}/libauth.a ${LIBS2}
KLIBS=${TOP_LIBDIR}/libkauth.krb.a ${LIBS1} ${TOP_LIBDIR}/libauth.krb.a ${LIBS2}

all: ${TOP_LIBDIR}/libafssiad.so ${TOP_LIBDIR}/libafssiad.krb.so

clean:
	$(RM) -f test-reauth libafssiad.so libafssiad.krb.so *.s *.o *.b core *~ *.com *.ld AFS_component_version_number.c

CFLAGS=${DBG} ${OPTMZ} -I${TOP_OBJDIR}/src/config -I${TOP_INCDIR} ${XCFLAGS} ${ARCHFLAGS}

${DEST}/lib/afs/libafssiad.so: libafssiad.so
	${INSTALL} $? $@

${DEST}/lib/afs/libafssiad.krb.so: libafssiad.krb.so
	${INSTALL} $? $@

siad.o: siad.c
	$(CC) $(CFLAGS) -c siad.c -o siad.o

siad_krb.o: siad.c
	$(CC) $(CFLAGS) -DAFS_KERBEROS_ENV -c siad.c -o siad_krb.o

libafssiad.so: siad.o
	$(LD) $(LDFLAGS) -shared -no_archive -o libafssiad.so \
		 siad.o ${LIBS} -none -lc

libafssiad.krb.so: siad_krb.o
	$(LD) $(LDFLAGS) -shared -no_archive -o libafssiad.krb.so \
		 siad_krb.o ${KLIBS} ${LIBS} -none -lc

test-reauth: test-reauth.o
	$(CC) $(CFLAGS) -o test-reauth test-reauth.o -lc

install: ${DESTDIR}${libdir}/afs/libafssiad.so ${DESTDIR}${libdir}/afs/libafssiad.krb.so

${DESTDIR}${libdir}/afs/libafssiad.so: libafssiad.so
	${INSTALL} $? $@

${TOP_LIBDIR}/libafssiad.so: libafssiad.so
	${INSTALL} $? $@

${DESTDIR}${libdir}/afs/libafssiad.krb.so: libafssiad.krb.so
	${INSTALL} $? $@

${TOP_LIBDIR}/libafssiad.krb.so: libafssiad.krb.so
	${INSTALL} $? $@

dest: ${DEST}/lib/afs/libafssiad.so ${DEST}/lib/afs/libafssiad.krb.so

