#!/bin/sh

# make source code tarballs 
# This script assumes that the bootstrap script has already been run successfully.


# makeSourceDist <tarball directory>

if [ ! -d @top_srcdir@ ] 
then
    echo "@top_srcdir@ does not exist"
    exit 1
fi

if [ ! -d $1 ] 
then
    echo "$1 does not exist"
    exit 1
fi

##set -x

# make sure we have the full paths
thisdir=`pwd`
cd @top_srcdir@/..; srccodedir=`pwd`
cd $thisdir
cd $1; tardir=`pwd`

cd $srccodedir;
tar -zcf $tardir/clhep-@VERSION@-src.tgz CLHEP

for pkg in `ls $srccodedir/CLHEP`
do
    if [ -e $srccodedir/CLHEP/$pkg/configure.in ] 
    then
        cd $srccodedir;
        tar -zcf $tardir/clhep-$pkg-@VERSION@-src.tgz CLHEP/$pkg
    fi
done
