# 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
#
# Portions Copyright (c) 2003 Apple Computer, Inc.

srcdir=@srcdir@
include @TOP_OBJDIR@/src/config/Makefile.config
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@

all: depinstall

generated: afs_trace.h afs_trace.msf unified_afs.c unified_afs.h

afs_trace.h afs_trace.msf: afs_trace.et
	${COMPILE_ET} -v 2 -p ${srcdir} afs_trace.et

unified_afs.c unified_afs.h: unified_afs.et
	$(RM) -f unified_afs.c unified_afs.h
	${COMPILE_ET} -p ${srcdir} unified_afs -h unified_afs

afszcm.cat: afs_trace.msf
	-$(RM) -f afszcm.cat
	case ${SYS_NAME} in \
		sgi_* ) \
			gencat -m afszcm.cat afs_trace.msf ;; \
		sun*_4* ) \
			/usr/etc/gencat afszcm.cat afs_trace.msf ;; \
		*_linux* | *_umlinux* ) \
			gencat --new afszcm.cat afs_trace.msf ;; \
		*_darwin_* ) \
			gencat -new afszcm.cat afs_trace.msf ;; \
		* ) \
			gencat afszcm.cat afs_trace.msf ;; \
	esac

depinstall: afszcm.cat AFS_component_version_number.c \
	${TOP_INCDIR}/afs/afs_consts.h \
	${TOP_INCDIR}/afs/afs.h \
	${TOP_INCDIR}/afs/osi_inode.h \
	${TOP_INCDIR}/afs/afs_stats.h \
	${TOP_INCDIR}/afs/exporter.h \
	${TOP_INCDIR}/afs/nfsclient.h \
	${TOP_INCDIR}/afs/unified_afs.h \
	${TOP_INCDIR}/afs/sysctl.h

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

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

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

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

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

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

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

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

install: unified_afs.h
	${INSTALL} -d ${DESTDIR}${includedir}/afs
	${INSTALL_DATA} ${srcdir}/afs.h ${DESTDIR}${includedir}/afs/afs.h
	${INSTALL_DATA} ${srcdir}/afs_consts.h ${DESTDIR}${includedir}/afs/afs_consts.h
	${INSTALL_DATA} ${srcdir}/afs_stats.h ${DESTDIR}${includedir}/afs/afs_stats.h
	${INSTALL_DATA} ${srcdir}/exporter.h ${DESTDIR}${includedir}/afs/exporter.h
	${INSTALL_DATA} ${srcdir}/nfsclient.h ${DESTDIR}${includedir}/afs/nfsclient.h
	${INSTALL_DATA} ${srcdir}/${MKAFS_OSTYPE}/osi_inode.h \
	    ${DESTDIR}${includedir}/afs/osi_inode.h
	${INSTALL_DATA} ${srcdir}/sysctl.h ${DESTDIR}${includedir}/afs/sysctl.h
	${INSTALL_DATA} unified_afs.h ${DESTDIR}${includedir}/afs/unified_afs.h
	${INSTALL_DATA} afszcm.cat ${DESTDIR}${afsdatadir}/C/afszcm.cat
	case ${SYS_NAME} in \
	    *linux*) \
		${INSTALL_DATA} ${srcdir}/${MKAFS_OSTYPE}/osi_vfs.h \
		    ${DESTDIR}${includedir}/afs/osi_vfs.h || true ;;\
	    *) \
		echo No vfs headers to install for ${SYS_NAME};; \
	esac

dest: unified_afs.h
	${INSTALL} -d ${DEST}/include/afs
	${INSTALL_DATA} ${srcdir}/afs.h ${DEST}/include/afs/afs.h
	${INSTALL_DATA} ${srcdir}/afs_consts.h ${DEST}/include/afs/afs_consts.h
	${INSTALL_DATA} ${srcdir}/afs_stats.h ${DEST}/include/afs/afs_stats.h
	${INSTALL_DATA} ${srcdir}/exporter.h ${DEST}/include/afs/exporter.h
	${INSTALL_DATA} ${srcdir}/nfsclient.h ${DEST}/include/afs/nfsclient.h
	${INSTALL_DATA} ${srcdir}/${MKAFS_OSTYPE}/osi_inode.h ${DEST}/include/afs/osi_inode.h
	${INSTALL_DATA} ${srcdir}/sysctl.h ${DEST}/include/afs/sysctl.h
	${INSTALL_DATA} unified_afs.h ${DEST}/include/afs/unified_afs.h
	${INSTALL_DATA} afszcm.cat ${DEST}/root.client/usr/vice/etc/C/afszcm.cat
	case ${SYS_NAME} in \
	    *linux*) \
		${INSTALL_DATA} ${srcdir}/${MKAFS_OSTYPE}/osi_vfs.h \
		    ${DEST}/include/afs/osi_vfs.h || true ;;\
	    *) \
		echo No vfs headers to install for ${SYS_NAME};; \
	esac

clean:
	-$(RM) -f *.o core AFS_component_version_number.c afs_trace.h afs_trace.msf afszcm.cat
	-$(RM) -f unified_afs.c unified_afs.h

include ../config/Makefile.version
