# 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

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}

KERNELDIR = ../libafs/
UKERNELDIR = ../libuafs/

INCDIRS=-I${TOP_SRCDIR}/config -I${TOP_INCDIR} ${XINCLS}
CFLAGS = ${OPTMZ} ${INCDIRS} ${XCFLAGS}

OBJS=buffer.o dir.o salvage.o
include ../config/Makefile.version

noversion: install

cmdall: all test

all: kinstall ukinstall ${TOP_LIBDIR}/libdir.a ${TOP_INCDIR}/afs/dir.h

libdir.a: ${OBJS} AFS_component_version_number.o
	$(RM) -f $@
	$(AR) crv $@ $(OBJS) AFS_component_version_number.o
	$(RANLIB) $@

kinstall:
	${INSTALL} dir.h ${KERNELDIR}/afs
	${INSTALL} dir.c ${KERNELDIR}/afs/afs_dir.c

ukinstall webinstall: ${UKERNELDIR}/afs
	${INSTALL} dir.h ${UKERNELDIR}/afs
	${INSTALL} dir.c ${UKERNELDIR}/afs/afs_dir.c

${UKERNELDIR}/afs:
	mkdir -p $@

install:    ${DESTDIR}${libdir}/afs/libdir.a ${DESTDIR}${includedir}/afs/dir.h

test: 
	(cd test; $(MAKE) )

buffer.o: buffer.c

dir.o: dir.c dir.h

salvage.o: salvage.c dir.h

clean:
	$(RM) -f *.o *.a core AFS_component_version_number.c
${DEST}/lib/afs/libdir.a: libdir.a
	${INSTALL} $? $@

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


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


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

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


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


dest:    ${DEST}/lib/afs/libdir.a ${DEST}/include/afs/dir.h

