#!/bin/bash

#  syntax: galdoxy_html package

#  create the C documentation for GALAHAD.
#  currently this will produce html

#  Nick Gould, August 21st 2021

#  does the package exist?

export package=$1
if [ -d "$GALAHAD/src/$package" ]; then 
  export PACKAGE=${package^^}
elif [ $package == "galahad" ]; then
  export PACKAGE=
else
  echo "Error: package $package does not exist."
  exit 1
fi

#  make sure that required subdirectories exist

mkdir -p $package
mkdir -p $GALAHAD/html/C_doxy/$package

#  build the html documentation

echo "building html"
cp $GALAHAD/include/galahad_$package.h $package/.
#doxygen Doxyfile
( cd ./$package ; doxygen ../Doxyfile_html )
#mogrify -trim $GALAHAD/html/C/$package/*.png
cp $GALAHAD/html/C_doxy/$package/index.html $GALAHAD/html/C_doxy/$package/$package.html
rm $package/galahad_$package.h

