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


include ../config/Makefile.${SYS_NAME}
SHELL = /bin/sh
KERNELDIR = ../libafs/
UKERNELDIR = ../libuafs/

OBJS=afsaux.o afscbint.cs.o afscbint.ss.o afscbint.xdr.o afsint.cs.o afsint.ss.o afsint.xdr.o
CFLAGS=${DBUG} -I${TOP_SRCDIR}/config -I${TOP_INCDIR} ${XCFLAGS}
KDSRCS=Kcallback.ss.c Kcallback.h Kvice.cs.c Kvice.h Kvice.xdr.c afscbint.h \
afsint.h
KSRCS=${KDSRCS} afsaux.c
UKSRCS=${KSRCS}
UTILS=${RXGEN}

include ../config/Makefile.version

noversion: install

all: kinstall ukinstall ${TOP_LIBDIR}/libafsint.a ${TOP_INCDIR}/afs/afsint.h ${TOP_INCDIR}/afs/afscbint.h

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

afsaux.o: afsaux.c afsint.h

Kcallback.cs.c: common.xg afscbint.xg Kvice.h Kcallback.h $(UTILS)
	${RXGEN} -x -k -C -o Kcallback.cs.c afscbint.xg

Kcallback.ss.c: common.xg afscbint.xg Kvice.h Kcallback.h $(UTILS)
	${RXGEN} -x -k -S -o Kcallback.ss.c afscbint.xg

Kcallback.xdr.c: common.xg afscbint.xg Kvice.h Kcallback.h $(UTILS)
	${RXGEN} -x -k -y -c -o Kcallback.xdr.c afscbint.xg

Kvice.cs.c: common.xg afsint.xg Kvice.h  $(UTILS)
	${RXGEN} -x -k -C -o Kvice.cs.c afsint.xg

Kvice.ss.c: common.xg afsint.xg Kvice.h $(UTILS)
	${RXGEN} -x -k -S -o Kvice.ss.c afsint.xg

Kvice.xdr.c: common.xg afsint.xg $(UTILS)
	${RXGEN} -x -k -c -o Kvice.xdr.c afsint.xg

Kvice.h: common.xg afsint.xg $(UTILS)
	${RXGEN} -x -k -h -o Kvice.h afsint.xg

Kcallback.h: common.xg afscbint.xg $(UTILS)
	${RXGEN} -x -k -h -o Kcallback.h afscbint.xg

afscbint.cs.c: common.xg afscbint.xg afsint.h afscbint.h $(UTILS)
	${RXGEN} -x -C -o afscbint.cs.c afscbint.xg

afscbint.ss.c: common.xg afscbint.xg afsint.h afscbint.h $(UTILS)
	${RXGEN} -x -S -o afscbint.ss.c afscbint.xg

afscbint.xdr.c: common.xg afscbint.xg afsint.h afscbint.h $(UTILS)
	${RXGEN} -x -y -c -o afscbint.xdr.c afscbint.xg

afsint.cs.c: common.xg afsint.xg afsint.h $(UTILS)
	${RXGEN} -x -C -o afsint.cs.c afsint.xg

afsint.ss.c: common.xg afsint.xg afsint.h $(UTILS)
	${RXGEN} -x -S -o afsint.ss.c afsint.xg

afsint.xdr.c: common.xg afsint.xg $(UTILS)
	${RXGEN} -x -c -o afsint.xdr.c afsint.xg

afsint.h: common.xg afsint.xg $(UTILS)
	${RXGEN} -x -h -o afsint.h afsint.xg

afscbint.h: common.xg afscbint.xg $(UTILS)
	${RXGEN} -x -h -o afscbint.h afscbint.xg

system: install

kinstall: ${KSRCS} ${KERNELDIR}/afsint
	${INSTALL} $(KSRCS) ${KERNELDIR}/afsint
	${INSTALL} ${TOP_INCDIR}/afs/rxgen_consts.h ${KERNELDIR}/afsint
	-${INSTALL} ${KERNELDIR}/rx/rx.h ${KERNELDIR}/afsint/rx.h
	${INSTALL} afscbint.h ${KERNELDIR}/afs

${KERNELDIR}/afsint:
	mkdir -p $@

ukinstall webinstall: ${UKERNELDIR}/afsint ${UKSRCS}
	${INSTALL} $(UKSRCS) ${UKERNELDIR}/afsint
	${INSTALL} ${TOP_INCDIR}/afs/rxgen_consts.h ${UKERNELDIR}/afsint
	-${INSTALL} ${UKERNELDIR}/rx/rx.h ${UKERNELDIR}/afsint/rx.h
	${INSTALL} afscbint.h ${UKERNELDIR}/afs

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

install:    ${DESTDIR}${libdir}/afs/libafsint.a ${DESTDIR}${includedir}/afs/afsint.h ${DESTDIR}${includedir}/afs/afscbint.h

clean:
	$(RM) -f *.o *.cs.c *.ss.c *.er.c afsint.h afsint.xdr.c libafsint.a $(KDSRCS) core AFS_component_version_number.c afscbint.xdr.c
${DEST}/lib/afs/libafsint.a: libafsint.a
	${INSTALL} $? $@

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


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


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

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


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


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

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


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


dest:    ${DEST}/lib/afs/libafsint.a ${DEST}/include/afs/afsint.h ${DEST}/include/afs/afscbint.h

