#!/bin/sh

# Build a test copy of athena from its parts

# Bruce uses this during development, it is not normally needed
# because the Makefile.PL performs the same chore as this script

files='top head main_window draw_properties set_properties file group_ops
align pixel calibrate deglitch truncate sa_fluo mee diff lograt peakfit lcf rebin
smooth convolve demo macro palettes plot plotstyles project report rc setup
mru prefs registry keys teach_ft misc'


## parse the command line argument
devel=0
if [ -z $1 ]; then
    devel=0
elif [ $1 == 'devel' ]; then
    devel=1
else
    devel=0
fi


echo
if [ $devel -eq 1 ]; then
    echo "Making a development copy of ATHENA (minerva_parts/)..."
else
    echo "Making a stable copy of ATHENA (athena_parts/)..."
fi
echo

rm -f test.pl
for f in $files; do
    echo -n $f " "
    if [ $devel -eq 1 ]; then
	cat minerva_parts/$f.pl >> test.pl
    else
	cat athena_parts/$f.pl >> test.pl
    fi
done
echo
echo
echo "Wrote test.pl";
chmod +x test.pl
