#! /bin/csh
        set ZEBUDIR =  `pwd`
	set ZEBUVERSION = `cat $ZEBUDIR/Version`
	set ZEBUARCHIVE = $ZEBUDIR/../zebu-$ZEBUVERSION.tar
	echo "tar zebu to $ZEBUARCHIVE"
	if (-d /tmp/zebu) then 
		rm -r /tmp/zebu
	endif
 	mkdir /tmp/zebu

 	cd $ZEBUDIR
	./clean
	find . \( -name '*.lisp' -o -name '*.zb' -o -name 'README' \
	-o -name 'machine' -o -name '*.doc' -o -name '*.text' \
	-o -name 'Zebu_intro.tex' -o -name 'Zebu_intro.dvi' \
	-o -name 'Zebu_intro.ps' -o -name 'Make*' -o -name 'sample-*' \
	-o -name 'Version' -o -name 'ChangeLog' -o -name 'COPYRIGHT'  \
	-o -name 'Tar-zebu' -o -name 'shar-zebu' -o -name 'clean' \
	-o -name 'Install.*' \)\
	-type f -print | cpio -pamvhd /tmp/zebu

	echo "Cleaning up /tmp/zebu"
	cd /tmp/zebu
	find .  \( -name 'Z-info.*' -o -name 'Z-shake' -o -name '*~' \)\
	-type f -print -exec rm {} \;

	if !( -d test) then
	mkdir test
	endif
	
	echo "Cleaning up /tmp/zebu/test"
	cd /tmp/zebu/test
	find . \( -name '*-domain.*' -o -name 'bibtex*' \
	-o -name 'zebra*' -o -name 'time*' -o -name '*foo*' \)\
	-type f -print -exec rm {} \;

	if !( -d binary) then
	mkdir binary
	endif

	echo "Making tar file"
 	cd /tmp/zebu
	tar cvf $ZEBUARCHIVE . 
	cd /tmp
	rm -r zebu

 	cd $ZEBUDIR/..
	echo "Compressing to " `pwd`"/zebu-"$ZEBUVERSION.tar".gz using gzip."

	gzip $ZEBUARCHIVE

