#!/bin/csh -f
#
# Run a global "cake" in the report by going to all paper directories.

echo ""
if ($1 == "burn"   || $1 == "figures"  \
 || $1 == "burnRps"  || $1 == "burnCRps"  \
 || $1 == "clean"  || $1 == "install"  \
 || $1 == "unvplot"|| $1 == "prepcd" || $1 == "lib" ) then 
	echo "Running Tour with option "$1
else
	echo 'Usage: Tour arg'
	echo 'Your starts in the current directory and executes:'
	echo '  cake arg   ,it descents then into the subdirectory tree'
	echo ' '
	echo 'To make the whole book or report:'
	echo ' Tour install                  installs globally executables'
	echo ' Tour figures                  builds figures'
	echo ' '
	echo "Other options are:"
	echo "clean	remove all intermediate files"
	echo "burnRps	remove all reproducible postscript plots"
	echo "burnCRps	remove all conditionally reproducible plots"
	echo "burn	remove all plots and movies includes previous two"
	exit
endif


cd ..
echo starting at `pwd`

foreach j ( [a-z]* Adm )

	echo ++++++++++++++++++++++++++++++++++++++++++++ $j
	cd $j
		if ($1 == "install" ) then
			cake clean
			cake install
			cake clean
		endif

		if ($1 == "burn" ) then
			cake burn
		endif

		if ($1 == "figures" ) then
			cake clean
			cake vplots figures
			cake clean
		endif

		if ($1 == "clean" )  then
			cake clean
		endif

		if ($1 == "burnRps" )  then
			cake burnCRps
		endif

		if ($1 == "burnRps" )  then
			cake burnCRps
		endif

		if ($1 == "unvplot" )  then
			cake unvplot clean
		endif

		if ($1 == "prepcd" )  then
			cake clean
			cake figures
			cake clean unvplot
		endif

		if ($1 == "lib" )  then
			cake libclean
			cake includes
			cake lib
		endif

	cd ..
	end

echo "Tour done."
