#!/bin/sh
#------------------------------------------------------------------------------
# Projekt: APPLY - A Practicable And Portable Lisp Implementation
#          ------------------------------------------------------
# Function : tar CLiCC Release into archive ./clicc-xxx.tar
#
# $Source:$
# $Author:$
# $Revision:$
# $Date:$
#------------------------------------------------------------------------------

curdir=`pwd`

# Determining the name of the release directory
echo ";;; Changing working directory to $CLICCROOT"
cd $CLICCROOT
base=`/usr/bin/pwd`
base=`basename $base`

tarfile=$base.tar
include=/tmp/tar-include$$
exclude=/tmp/tar-exclude$$
rm -f $include $exclude

# Directories with extra files which are not RCS controled
rtlc=$base/src/runtime/lisp2c
lib=$base/lib
doc=$base/doc

# RCS controled files
echo "Assembling list of RCS controled files"
for dir in `tail +2 RCS-directories`; do
 for file in `tail +2 $dir/RCS-files`; do
  echo $base/$dir/$file >>$include
 done
done

# Building the exlude list
cd ..
echo "Assembling list of files which will be excluded from the release"
ls -d $base/bib $base/doc/*.tex $base/doc/*.fig >$exclude

echo ";;; Assembling CLiCC source code release in directory `/usr/bin/pwd` ..."
tar cvfX $curdir/$tarfile $exclude -I $include \
 $lib/inline.h $lib/lisp.* $lib/sys.h \
 $doc/*.Z \
 $rtlc/*.[ch]

echo ";;; $curdir/$tarfile created."

# tidy up
rm $include $exclude
echo ";;; Changing working directory back to $curdir"
cd $curdir

