# 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 fsprobe and its test program, all part of the AFS
# navigation and monitoring tool (gator).
#
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=-g -I. \
	-I${TOP_SRCDIR}/config \
	-I${TOP_INCDIR} \
	-I${TOP_INCDIR}/afs \
	-I${SRCDIR} \
	-I/usr/include ${XCFLAGS}

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

INCLS=fsprobe.h ${RPCINCLS}

LIBS=${TOP_LIBDIR}/libvolser.a ${TOP_LIBDIR}/vlib.a ${TOP_LIBDIR}/libacl.a \
        ${TOP_LIBDIR}/libsys.a ${TOP_LIBDIR}/libvldb.a \
        ${TOP_LIBDIR}/libubik.a \
        ${TOP_LIBDIR}/libauth.a ${TOP_LIBDIR}/libsys.a \
        ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/librxkad.a ${TOP_LIBDIR}/libdes.a \
        ${TOP_LIBDIR}/libcom_err.a ${TOP_LIBDIR}/libkauth.a \
	${TOP_LIBDIR}/libaudit.a \
	${TOP_LIBDIR}/libafsint.a \
	${TOP_LIBDIR}/librx.a \
	${TOP_LIBDIR}/liblwp.a \
	${TOP_LIBDIR}/libsys.a \
	${TOP_LIBDIR}/util.a

all: ${TOP_INCDIR}/afs/fsprobe.h ${TOP_LIBDIR}/libfsprobe.a fsprobe_test

#
# Build targets
#
libfsprobe.a: fsprobe.o fsprobe_callback.o AFS_component_version_number.o
	-$(RM) -f $@
	$(AR) crv $@ fsprobe.o fsprobe_callback.o AFS_component_version_number.o
	$(RANLIB) $@

fsprobe.o: fsprobe.c ${INCLS} AFS_component_version_number.c

fsprobe_callback.o: fsprobe_callback.c ${INCLS}

fsprobe_test: fsprobe_test.o libfsprobe.a ${LIBS}
	${CC} ${CFLAGS} -o fsprobe_test fsprobe_test.o libfsprobe.a \
		${LIBS} ${XLIBS}

#
# Install targets
#
install: ${DESTDIR}${includedir}/afs/fsprobe.h ${DESTDIR}${libdir}/afs/libfsprobe.a 

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

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

#
# Misc others
#
clean:
	$(RM) -f *.o fsprobe_test libfsprobe.a core AFS_component_version_number.c

include ../config/Makefile.version

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

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

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

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

dest: ${DEST}/include/afs/fsprobe.h ${DEST}/lib/afs/libfsprobe.a 

