#!/bin/bash

if [ $TRILINOS_HOME ]; then
  echo "TRILINOS_HOME has already been set!"
else
  echo "TRILINOS_HOME has not been set.  Setting it!"
  export TRILINOS_HOME=`pwd`/../../..
fi

echo
echo "Generating doxygen browser documentation for all of teuchos as a single doxygen collection ..."
echo

doxygen ../browser/doc/Doxyfile

echo
echo "Generating main teuchos doxygen documentation pages ..."
echo

doxygen Doxyfile

echo
echo "Generating RefCountPtrBeginnersGuideSAND.pdf file ..."
echo

if [ -e ../../../doc/RefCountPtr/beginners ] ; then
  pushd ../../../doc/RefCountPtr/beginners; make pdf ; popd
  cp ../../../doc/RefCountPtr/beginners/RefCountPtrBeginnersGuideSAND.pdf html/.
else
  echo "Skipping building RefCountPtrBeginnersGuideSAND.pdf because source directory does not exist!"
fi

echo
echo "Generating TeuchosMemoryManagementSAND.pdf file ..."
echo

if [ -e ../../../doc/TeuchosMemoryManagementSAND ] ; then
  pushd ../../../doc/TeuchosMemoryManagementSAND; make; popd
  cp ../../../doc/TeuchosMemoryManagementSAND/TeuchosMemoryManagementSAND.pdf html/.
else
  echo "Skipping building TeuchosMemoryManagementSAND.pdf because directory does not exist!"
fi
