#!/bin/sh

rm -f Doxyfile.input
rm -f index.dox

# Create Doxyfile.input

echo "# DO NOT EDIT THIS FILE, IT IS GENERATED BY ./build_docs" >> Doxyfile.input
echo >> Doxyfile.input

for i in ../stk_*/doc/Doxyfile.input; do
  echo "@INCLUDE = $i" >> Doxyfile.input
done
echo >> Doxyfile.input

echo "# OVERRIDES, CHANGE ./build_docs IF YOU NEED TO CHANGE THESE" >> Doxyfile.input
echo "# If there needs to be a different configuration when generating doxygen" >> Doxyfile.input
echo "# STK-wide via build_docs versus generating doxygen for individual STK" >> Doxyfile.input
echo "# products, express that here" >> Doxyfile.input

# Create index.dox

echo "/** \mainpage  Sierra Toolkit" > index.dox
echo " *" >> index.dox

echo " * @section stk_products The Sierra Toolkit contains the following products:" >> index.dox
echo " *" >> index.dox
for i in ../stk_*/doc/Doxyfile.input; do
  gawk -- '/#BANNER/{print " * - "substr($0, 8)}' $i >> index.dox
  echo " *" >> index.dox
done
echo " *" >> index.dox

echo " * @section stk_howto How to..." >> index.dox
echo " *" >> index.dox
for i in ../stk_*/doc/Doxyfile.input; do
  gawk -- '/#HOWTO/{print " * - "substr($0, 7)}' $i >> index.dox
  echo " *" >> index.dox
done
echo " *" >> index.dox

echo " */" >> index.dox

doxygen
