#	@(#)Makefile	8.1 (Berkeley) 5/31/93

PROG=	rstat
SRCS=	rstat.c rstat_clnt.c rstat_xdr.c
HDRS=	rstat.h
XFILES=	rstat.x
CFLAGS+=-I.
DPADD=  ${LIBRPC}
LDADD=  -lrpc
# man page is installed via the man directory
NOMAN=

CLEANFILES+=rstat.h rstat_clnt.c rstat_xdr.c

BINDIR=	/usr/bin
RPCCOM = rpcgen

.PATH:	${.CURDIR}/..

all:	${HDRS}

.SUFFIXES:	.x

.x.h:
	${RPCCOM} -h ${.IMPSRC}  -o ${.TARGET}

rstat_clnt.c:	rstat.x
	${RPCCOM} -l ${.CURDIR}/rstat.x  | sed 's~${.CURDIR}/~~g' > ${.TARGET}
rstat_xdr.c:	rstat.x
	${RPCCOM} -c ${.CURDIR}/rstat.x  | sed 's~${.CURDIR}/~~g' > ${.TARGET}

afterinstall:
	install ${COPY} -o ${BINOWN} -g ${BINGRP} -m 444 \
	    ${HDRS} ${DESTDIR}/usr/include/rpcsvc
	install ${COPY} -o ${BINOWN} -g ${BINGRP} -m 444 \
	    ${.CURDIR}/${XFILES} ${DESTDIR}/usr/include/rpcsvc

.include <bsd.prog.mk>
