#!/bin/sh -

#	Create a tar file containing the binaries for bounds checking GCC.
#	By Richard W.M. Jones.

# GCC directories.
# Assume GCC is in $HOME.

GCC=gcc-2.7.2
cd $HOME/$GCC

# Place to put the packed file.

INST_DIR=$HOME

# Final tar file name. This must contain the GCC and BC version numbers, and
# the target name.

TARFILE=bounds-checking-2.7.2-1.02-binary-i486-unknown-linux.tgz

# The list of files that we need to pack up (excluding gcc.info* files).
# The `crt*.o' files are needed by Solaris, but not, apparently, by other
# machines, so ignore warnings from tar for these.

FILES="bounds cc1 cpp crt1.o crtbegin.o crtend.o crti.o crtn.o \
 include libgcc.a libcheck.a specs xgcc README.gcc-bin"

# Use `gtar' on systems where tar is broken. Use `gmake' if necessary on
# your system.

TAR="tar"
MAKE="make"
GZIP="gzip"
CAT="cat"
ECHO="echo"
RM="rm -f"
LS="ls -l"

#-----

$MAKE; $MAKE doc

# Make the README file

$CAT > README.gcc-bin << __END__

This is the binary distribution
	$TARFILE

Please consult the README file (in bounds/ subdir.) for details about how
to run this GCC.

RWMJ - 17/10/95.

__END__

#$ECHO "---------- Making bounds/lib clean. ----------"
#(cd bounds/lib; $MAKE distclean)

$ECHO "---------- Making results files in bounds/tests. ----------"
(cd bounds/tests; $MAKE results)

#$ECHO "---------- Making bounds/tools clean. ----------"
#(cd bounds/tools; $MAKE distclean)

$ECHO "---------- Cleaning up bounds/ and subdirectories. ----------"
for d in `find bounds -type d -print`; do
  (cd $d; $RM *~ *.BAK *.bak core *.orig *.rej *.old)
done

$ECHO "---------- Packing up tar file. ----------"
tarfiles=""
for f in gcc.info*; do
  tarfiles="$tarfiles $GCC/$f"
done
for f in $FILES; do
  if [ -f $f -o -d $f ]; then
    tarfiles="$tarfiles $GCC/$f"
  fi
done
cd $HOME
$TAR chf - $tarfiles | $GZIP > $INST_DIR/$TARFILE
cd $HOME/$GCC
$RM README.gcc-bin

$ECHO "---------- Result file: ----------"
$LS $INST_DIR/$TARFILE
