#!/bin/sh

set -e

echo -n "cvs... "
#make -C .. ksi/keyword.h > /dev/null
sh scripts/mkkeyword . . 2> /dev/null
ver=`cat VERSION`
cvs -Q commit -m "release pre$ver"
cvs -Q tag pre$ver
rm -rf cvs
mkdir cvs
(cd cvs; cvs -Q get ksi)
cp keyword.[hc] cvs/ksi
make -C cvs/ksi/doc > /dev/null
echo done
name=ksi-pre$ver.tar.gz
echo -n "taring $name... "
cd cvs
mv ksi ksi-pre$ver
tar zcf ../$name ksi-pre$ver
cd ..
rm -rf cvs
echo done
if [ $(id -un) = malekith ] ; then
  mkdir -p ~/backup/ksi
  mv $name ~/backup/ksi
fi
cat *.def expr.c ksi.h lex.c stmts.c unit.c types.c | wc
echo $(($ver+1)) > VERSION
cvs -Q commit -m "pre$(($ver+1))" VERSION > /dev/null
