# 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
include @TOP_OBJDIR@/src/config/Makefile.lwp
include @TOP_OBJDIR@/src/config/Makefile.lwptool

LT_objs = rxstat.cs.lo rxstat.ss.lo rxstat.xdr.lo rxstat.lo
LT_deps = $(top_builddir)/src/rx/liboafs_rx.la

all: depinstall liboafs_rxstat.la librxstat_pic.la \
	${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: $(LT_objs)
	$(LT_LDLIB_lwp) $(LT_objs)

liboafs_rxstat.la: liboafs_rxstat.la.sym $(LT_objs) $(LT_deps)
	$(LT_LDLIB_shlib) $(LT_objs) $(LT_deps) $(LT_libs)

librxstat_pic.la: $(LT_objs)
	$(LT_LDLIB_pic) $(LT_objs)

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:
	$(LT_CLEAN)
	$(RM) -f rxstat.h *.xdr.c *.cs.c *.ss.c *.o *.a core AFS_component_version_number.c

include ../config/Makefile.version
