#!/bin/sh
#
# File: plexp
# Usage: plexp
# 
# Builds tar archive of plplot files for transport.  Only files
# modified since last import are exported.
# No binary or CVS files should be included.

# Build archive from parent directory.  It must also be unpacked from there.

pldir="`basename $PWD`"
tarfile=${pldir}.tar

if [ -f .import ]; then
        # export files newer than .import.
        echo "Exporting files modified since last import."

	check_new="-newer $pldir/.import"

else
        # Need to export all files.
        echo "Exporting entire file tree."

        check_new=" "
fi

cd ..

tar cvf plplot.tar \
	`find $pldir \
	$check_new \
	! -path \*CVS\* \
	! -path plplot/tmp\* \
	! -path \*repository\* \
	! -path \*.depend \
	! -path \*~ \
	! -path \*.o \
	! -path \*.a \
	! -path \*.sl \
	! -path \*.dat \
        -type f`

gzip ${tarfile}

echo "The resulting file is:"
ls -l plplot.tar.gz
echo "You may now download plplot.tar.gz to the remote site."
