# 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@

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}/libafscom_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

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

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

#
# 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: fsprobe.h libfsprobe.a
	${INSTALL} -d ${DESTDIR}${includedir}/afs
	${INSTALL} -d ${DESTDIR}${libdir}/afs
	${INSTALL_DATA} ${srcdir}/fsprobe.h ${DESTDIR}${includedir}/afs/fsprobe.h
	${INSTALL_DATA} libfsprobe.a ${DESTDIR}${libdir}/afs/libfsprobe.a 

dest: fsprobe.h libfsprobe.a
	${INSTALL} -d ${DEST}/include/afs
	${INSTALL} -d ${DEST}/lib/afs
	${INSTALL_DATA} ${srcdir}/fsprobe.h ${DEST}/include/afs/fsprobe.h
	${INSTALL_DATA} libfsprobe.a ${DEST}/lib/afs/libfsprobe.a 

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

include ../config/Makefile.version
