#!/bin/sh

PUB_SOURCE="."
PUB_BUILD="$1"
TAR="`which tar`"

if test "x$PUB_BUILD" = "x"; then
  echo "usage: $0 <build-dir>"
  exit 1
fi

echo "$0: copy $PUB_SOURCE to $PUB_BUILD"

#for DIR in `find . -type d`; do
#  if test "x`basename $DIR`" = "xCVS";     then continue; fi
#  if test "x`basename $DIR`" = "x.xvpics"; then continue; fi
#  if test "x$DIR" = "x.";       then continue; fi
#  if test "x$DIR" = "x./BUILD"; then continue; fi
#  if test "x$DIR" = "x./cms";   then continue; fi
#
#  #echo "DIR: $DIR"
#done

$TAR chf - \
    --exclude=CVS \
    --exclude=".svn" \
    --exclude=".xvpics" \
    --exclude="TARGET"  \
    --exclude="BUILD"   \
    --exclude="cms"     \
    --exclude="GNUmakefile" \
    --exclude="NOTES"       \
    --exclude="export.sh"   \
    --exclude="www*.tar.gz" \
    --to-stdout $PUB_SOURCE \
| (cd $PUB_BUILD; $TAR xf -)
