#!/bin/sh

# Build a test copy of artemis 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 gds2 feff atoms2 path file data athena firstshell
palettes fit plot zip project record macro mru prefs log logview
feffit rc misc'


## parse the command line argument
devel=1
# 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 ARTEMIS (diana_parts/)..."
# else
#     echo "Making a stable copy of ARTEMIS (artemis_parts/)..."
# fi
# echo

echo "Making a stable copy of ARTEMIS (artemis_parts/)..."

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