#
# @(#)Makefile	1.6 87/11/30 3.9 RPCSRC
#
#   Build and install everything.
#
# These directories are presumed to exist in DESTDIR:
#    ./lib ./bin ./include
#
DESTDIR=/usr/local
MAKE=make

SUBDIR= rpcgen etc 

all install:	rpclib rpcsvc ${SUBDIR}

rpclib:	FRC
	@echo "Building and installing RPC library"
	cd rpc; $(MAKE) ${MFLAGS} all DESTDIR=${DESTDIR}; \
        $(MAKE) ${MFLAGS} install DESTDIR=${DESTDIR}

rpcsvc:	FRC
	@echo "Building and installing files from: $@"
	cd $@; $(MAKE) ${MFLAGS} headers DESTDIR=${DESTDIR} ; \
        $(MAKE) ${MFLAGS} install DESTDIR=${DESTDIR}

${SUBDIR}:	FRC
	@echo "Building and installing files from: $@"
	cd $@; $(MAKE) ${MFLAGS} DESTDIR=${DESTDIR} ; \
        $(MAKE) ${MFLAGS} install DESTDIR=${DESTDIR}

FRC:

clean:
	cd etc; $(MAKE) clean
	cd rpc; $(MAKE) clean
	cd rpcgen; $(MAKE) clean
	cd rpcsvc; $(MAKE) clean

archive:
	cd .. && \
	tar cvf sunrpc3.9a.tar sunrpc3.9 && \
	compress sunrcp3.9a.tar && \
	mv sunrpc3.9a.tar.Z /usr/ftp/pub/apollo && \
	chmod 644 /usr/ftp/pub/apollo/sunrpc3.9a.tar.Z
