#/bin/bash
# Guess what: this code works for me!
parent=$(cd ..;pwd)
version=${PWD##$parent/}
splat
cd C
cd ../H
cd ../OPTYap
cd ../VC
cd ../LGPL
cd pillow
cd examples
cd ../../../include
/bin/cp config.h config.h.mine
/bin/cp ../../../bins/cyg/*.h .
/bin/mv config.h.mine config.h
cd ../../console
cd ../docs
if test "$1" = "--small"; then
make realclean
else
make
make clean
fi
cd ../include
cd ../library
cd regex
cd ../yap2swi
cd ../../m4
cd ../misc
cd ../pl
cd ../CLPQR
cd clpq
cd ../clpqr
cd SESSION
cd ../monash
cd ../../../clpr
cd ../../CHR
cd chr
cd ../../../..
tar cvzf "$version"-small.tar.gz --exclude=CVS --exclude=CHR/chr/examples --exclude=CLPQR/clpqr/examples "$version"/{Artistic,INSTALL,README*,changes*,config*,install-sh,Makefile.in,.depend.in,distribute,C,H,VC,console,docs,include,library,m4,misc,pl,LGPL/README,LGPL/CVS,LGPL/pillow/[C-Z]*,LGPL/pillow/*.pl,LGPL/pillow/doc/*info*,build-distr,OPTYap,CLPQR,CHR}
tar cvzf "$version".tar.gz --exclude=CVS "$version"/{Artistic,INSTALL,README*,changes*,config*,install-sh,Makefile.in,.depend.in,distribute,C,H,VC,console,docs,include,library,m4,misc,pl,LGPL,build-distr,OPTYap,CLPQR,CHR,Logtalk}