# 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
TOP_SRCDIR=@TOP_SRCDIR@
SYS_NAME=@AFS_SYSNAME@

SHELL = /bin/sh
include ../config/Makefile.${SYS_NAME}

KERNELDIR = ../libafs/
UKERNELDIR = ../libuafs/
RXGEN=${TOP_SRCDIR}/rxgen/rxgen

KSRCS=rxstat.c rxstat.h Krxstat.ss.c Krxstat.xdr.c

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

LIBOBJS = rxstat.cs.o rxstat.ss.o rxstat.xdr.o rxstat.o

all: kinstall ukinstall ${TOP_INCDIR}/rx/rxstat.h ${TOP_LIBDIR}/librxstat.a

#
# Build targets
#
rxstat.cs.c rxstat.ss.c rxstat.xdr.c rxstat.h: rxstat.xg
	${RXGEN} -x rxstat.xg

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

Krxstat.cs.c: rxstat.xg
	${RXGEN} -x -k -C -o $@ rxstat.xg

Krxstat.ss.c: rxstat.xg
	${RXGEN} -x -k -S -o $@ rxstat.xg

Krxstat.xdr.c: rxstat.xg
	${RXGEN} -x -k -c -o $@ rxstat.xg

#
# Install targets
#
install:   ${DESTDIR}${includedir}/rx/rxstat.h ${DESTDIR}${libdir}/librxstat.a

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

${DEST}/include/rx/rxstat.h: rxstat.h
	${INSTALL} $? $@

kinstall: ${KERNELDIR}/afsint \
	${KERNELDIR}/afsint/rxstat.c \
	${KERNELDIR}/afsint/rxstat.h \
	${KERNELDIR}/afsint/Krxstat.ss.c \
	${KERNELDIR}/afsint/Krxstat.xdr.c 

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

${KERNELDIR}/afsint/rxstat.c: rxstat.c
	${INSTALL} $? $@

${KERNELDIR}/afsint/rxstat.h: rxstat.h
	${INSTALL} $? $@

${KERNELDIR}/afsint/Krxstat.ss.c: Krxstat.ss.c
	${INSTALL} $? $@

${KERNELDIR}/afsint/Krxstat.xdr.c: Krxstat.xdr.c
	${INSTALL} $? $@

ukinstall: ${UKERNELDIR}/afsint \
	${UKERNELDIR}/afsint/rxstat.c \
	${UKERNELDIR}/afsint/rxstat.h \
	${UKERNELDIR}/afsint/Krxstat.ss.c \
	${UKERNELDIR}/afsint/Krxstat.xdr.c

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

${UKERNELDIR}/afsint/rxstat.c: rxstat.c
	${INSTALL} $? $@

${UKERNELDIR}/afsint/rxstat.h: rxstat.h
	${INSTALL} $? $@

${UKERNELDIR}/afsint/Krxstat.ss.c: Krxstat.ss.c
	${INSTALL} $? $@

${UKERNELDIR}/afsint/Krxstat.xdr.c: Krxstat.xdr.c
	${INSTALL} $? $@

#
# Misc. targets
#
clean:
	$(RM) -f rxstat.h *.xdr.c *.cs.c *.ss.c *.o *.a core AFS_component_version_number.c

include ../config/Makefile.version
${DESTDIR}${includedir}/rx/rxstat.h: rxstat.h
	${INSTALL} $? $@

${TOP_INCDIR}/rx/rxstat.h: rxstat.h
	${INSTALL} $? $@

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

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

dest:   ${DEST}/include/rx/rxstat.h ${DEST}/lib/librxstat.a

