#!/bin/sh

./configure
make doc

for mp in doc/*.[18]; do
  man2html $mp > `echo $mp | sed 's/\.[0-9]$/.html/'`
done

if [ "$1" = "home" ]; then
  TARGET='home.salstar.sk:sh/sagator'
else
  TARGET='ftp:public_html/pub/antivir/sagator'
  EXTRA_EXCLUDE="--exclude=rsync"
fi

rsync -v \
 --archive \
 --recursive \
 --links \
 --perms \
 --times \
 --delete \
 --stats --progress \
 -e 'ssh' \
 --exclude='DEADJOE' \
 --exclude='root/tmp/*' \
 --exclude='config.py' \
 --exclude='*.pyc' --exclude='*.pyo' \
 --exclude='*~' \
 --exclude='CVS*' \
 --exclude='*.o' --exclude='*.so' \
 $EXTRA_EXCLUDE \
 . "$TARGET"

if [ ! "$1" = "noco" ]; then
  cvs commit -m "$1"
fi
