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

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

all: depinstall ${TOP_LIBDIR}/librxstat.a 

generated: \
	Krxstat.cs.c Krxstat.ss.c Krxstat.xdr.c \
	rxstat.cs.c rxstat.ss.c rxstat.xdr.c rxstat.h

depinstall: \
	${TOP_INCDIR}/rx/rxstat.h Krxstat.cs.c \
	Krxstat.ss.c Krxstat.xdr.c

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

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

#
# Build targets
#
rxstat.cs.c: rxstat.xg
	${RXGEN} -A -x -C -o $@ ${srcdir}/rxstat.xg

rxstat.ss.c: rxstat.xg
	${RXGEN} -A -x -S -o $@ ${srcdir}/rxstat.xg

rxstat.xdr.c: rxstat.xg
	${RXGEN} -A -x -c -o $@ ${srcdir}/rxstat.xg

rxstat.h: rxstat.xg
	${RXGEN} -A -x -h -o $@ ${srcdir}/rxstat.xg

rxstat.xdr.c: rxstat.h
rxstat.cs.c: rxstat.h
rxstat.ss.c: rxstat.h

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 $@ ${srcdir}/rxstat.xg

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

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

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

dest: rxstat.h librxstat.a
	${INSTALL} -d ${DEST}/include/rx
	${INSTALL} -d ${DEST}/lib
	${INSTALL_DATA} rxstat.h ${DEST}/include/rx/rxstat.h
	${INSTALL_DATA} librxstat.a ${DEST}/lib/librxstat.a

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