# 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

# Makefile for the module providing the client side of the File Server
# and Cache Manager extended statistics gathering.

DEST=@DEST@
TOP_INCDIR=@TOP_INCDIR@
TOP_LIBDIR=@TOP_LIBDIR@
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
sbindir=@sbindir@
libexecdir=@libexecdir@
libdir=@libdir@
includedir=@includedir@
mandir=@mandir@
afssrvbindir=@afssrvbindir@
afssrvsbindir=@afssrvsbindir@
afssrvlibexecdir=@afssrvlibexecdir@
COMPILE_ET=${TOP_SRCDIR}/comerr/compile_et
RXGEN=${TOP_SRCDIR}/rxgen/rxgen
TOP_SRCDIR=@TOP_SRCDIR@
SYS_NAME=@AFS_SYSNAME@

SHELL = /bin/sh

include ../config/Makefile.${SYS_NAME}

CFLAGS=${DBUG} -I. \
	-I${TOP_SRCDIR}/config \
	-I${TOP_INCDIR} \
	-I${TOP_INCDIR}/afs \
	-I/usr/include ${XCFLAGS}

RPCINCLS=${TOP_INCDIR}/lwp.h ${TOP_INCDIR}/rx/rx.h

LIBS=${TOP_LIBDIR}/libafsint.a \
	${TOP_LIBDIR}/libcmd.a \
	${TOP_LIBDIR}/librx.a \
	${TOP_LIBDIR}/liblwp.a \
	${TOP_LIBDIR}/libsys.a \
	${TOP_LIBDIR}/util.a

all: \
	${TOP_INCDIR}/afs/xstat_fs.h \
	${TOP_INCDIR}/afs/xstat_cm.h \
	${TOP_LIBDIR}/libxstat_fs.a \
	${TOP_LIBDIR}/libxstat_cm.a \
	xstat_fs_test \
	xstat_cm_test

#
# File Server data collection
#
FSINCLS=xstat_fs.h ${RPCINCLS}

libxstat_fs.a: xstat_fs.o xstat_fs_callback.o AFS_component_version_number.o
	-$(RM) -f $@
	$(AR) crv $@ xstat_fs.o xstat_fs_callback.o AFS_component_version_number.o
	$(RANLIB) $@

xstat_fs.o: xstat_fs.c ${FSINCLS}

xstat_fs_callback.o: xstat_fs_callback.c ${FSINCLS}

xstat_fs_test.: xstat_fs_test.c ${FSINCLS}

xstat_fs_test: xstat_fs_test.o libxstat_fs.a ${LIBS}
	${CC} ${CFLAGS} -o xstat_fs_test xstat_fs_test.o libxstat_fs.a ${LIBS} ${XLIBS}

#
# Cache Manager data collection
#
CMINCLS=xstat_cm.h ${RPCINCLS}

libxstat_cm.a: xstat_cm.o AFS_component_version_number.o
	-$(RM) -f libxstat_cm.a
	$(AR) crv libxstat_cm.a xstat_cm.o AFS_component_version_number.o
	$(RANLIB) libxstat_cm.a

xstat_cm.o: xstat_cm.c ${CMINCLS}

xstat_cm_test.o: xstat_cm_test.c ${CMINCLS}

xstat_cm_test: xstat_cm_test.o libxstat_cm.a ${LIBS}
	${CC} ${CFLAGS} -o xstat_cm_test xstat_cm_test.o libxstat_cm.a ${LIBS} ${XLIBS}

#
# Installation targets
#
install: \
	${DESTDIR}${includedir}/afs/xstat_fs.h \
	${DESTDIR}${includedir}/afs/xstat_cm.h \
	${DESTDIR}${libdir}/afs/libxstat_fs.a \
	${DESTDIR}${libdir}/afs/libxstat_cm.a \
	${DESTDIR}${bindir}/xstat_fs_test \
	${DESTDIR}${bindir}/xstat_cm_test

${DEST}/include/afs/xstat_fs.h: xstat_fs.h
	${INSTALL} $? $@

${DEST}/include/afs/xstat_cm.h: xstat_cm.h
	${INSTALL} $? $@

${DEST}/lib/afs/libxstat_fs.a: libxstat_fs.a
	${INSTALL} $? $@

${DEST}/lib/afs/libxstat_cm.a: libxstat_cm.a
	${INSTALL} $? $@

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

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

#
# Misc targets
#
clean:
	$(RM) -f *.o *.a xstat_fs_test xstat_cm_test core AFS_component_version_number.c

include ../config/Makefile.version

${DESTDIR}${includedir}/afs/xstat_fs.h: xstat_fs.h
	${INSTALL} $? $@

${TOP_INCDIR}/afs/xstat_fs.h: xstat_fs.h
	${INSTALL} $? $@

${DESTDIR}${includedir}/afs/xstat_cm.h: xstat_cm.h
	${INSTALL} $? $@

${TOP_INCDIR}/afs/xstat_cm.h: xstat_cm.h
	${INSTALL} $? $@

${DESTDIR}${libdir}/afs/libxstat_fs.a: libxstat_fs.a
	${INSTALL} $? $@

${TOP_LIBDIR}/libxstat_fs.a: libxstat_fs.a
	${INSTALL} $? $@

${DESTDIR}${libdir}/afs/libxstat_cm.a: libxstat_cm.a
	${INSTALL} $? $@

${TOP_LIBDIR}/libxstat_cm.a: libxstat_cm.a
	${INSTALL} $? $@

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

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

dest: \
	${DEST}/include/afs/xstat_fs.h \
	${DEST}/include/afs/xstat_cm.h \
	${DEST}/lib/afs/libxstat_fs.a \
	${DEST}/lib/afs/libxstat_cm.a \
	${DEST}/bin/xstat_fs_test \
	${DEST}/bin/xstat_cm_test

