# 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
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@

CC = ${MT_CC}
CFLAGS=${COMMON_CFLAGS} ${MT_CFLAGS}
CCRULE = ${CC} ${CFLAGS} -c $?

VLSERVER = ../../vlserver
VOLSER = ../../volser
FSINT = ../../fsint

ADMINOBJS =\
	afs_vosAdmin.o \
	vosutils.o \
	vsprocs.o \
	lockprocs.o

VLSERVEROBJS =\
	vldbint.cs.o \
	vldbint.xdr.o

VOLSEROBJS =\
	volint.cs.o \
	volint.xdr.o

FSINTOBJS =\
	afsint.xdr.o \
	afscbint.xdr.o

LIBOBJS = ${ADMINOBJS} ${VLSERVEROBJS} ${VOLSEROBJS} ${FSINTOBJS}

LIBVOSADMIN=${TOP_LIBDIR}/libvosadmin.a

all: ${TOP_INCDIR}/afs/afs_vosAdmin.h ${TOP_LIBDIR}/libvosadmin.a

${TOP_INCDIR}/afs/afs_vosAdmin.h: afs_vosAdmin.h
	${INSTALL_DATA} $? $@

${TOP_LIBDIR}/libvosadmin.a: libvosadmin.a
	${INSTALL_DATA} $? $@

install: afs_vosAdmin.h libvosadmin.a
	${INSTALL} -d ${DESTDIR}${includedir}/afs
	${INSTALL} -d ${DESTDIR}${libdir}/afs
	${INSTALL_DATA} afs_vosAdmin.h ${DESTDIR}${includedir}/afs/afs_vosAdmin.h
	${INSTALL_DATA} libvosadmin.a ${DESTDIR}${libdir}/afs/libvosadmin.a

dest: afs_vosAdmin.h libvosadmin.a
	${INSTALL} -d ${DEST}/include/afs
	${INSTALL} -d ${DEST}/lib/afs
	${INSTALL_DATA} afs_vosAdmin.h ${DEST}/include/afs/afs_vosAdmin.h
	${INSTALL_DATA} libvosadmin.a ${DEST}/lib/afs/libvosadmin.a

libvosadmin.a: ${LIBOBJS}
	-$(RM) -f $@
	$(AR) crv $@ ${LIBOBJS}
	${RANLIB} $@

afs_vosAdmin.o: afs_vosAdmin.h

vldbint.cs.o: ${VLSERVER}/vldbint.cs.c
	${CCRULE}

vldbint.xdr.o: ${VLSERVER}/vldbint.xdr.c
	${CCRULE}

volint.xdr.o: ${VOLSER}/volint.xdr.c
	${CCRULE}

volint.cs.o: ${VOLSER}/volint.cs.c
	${CCRULE}

afscbint.xdr.o: ${FSINT}/afscbint.xdr.c
	${CCRULE}

afsint.xdr.o: ${FSINT}/afsint.xdr.c
	${CCRULE}

clean:
	$(RM) -f *.o libvosadmin*
