#!/bin/sh
# This script creates a Doxyfile and runs doxygen to create documentation.

if (which doxygen &> /dev/null); then
    echo "Found doxygen..."
else
    echo "Couldn't find doxygen!"
    exit
fi

project_name=Keso
project_number=$1
top_srcdir=$2
doc_files=$2/keso/*.h

# write the text that should be on the index page (html)
# or first chapter (latex)
echo "/** @mainpage libkeso source code documentation" > apiIndex
echo "This is the API documentation for $project_name
      ${project_number}. It describes the interface that
      you should use if you want to write your own Keso plugins
      or extend Keso in any other way." >> apiIndex
echo "@par" >> apiIndex
echo "The most recent version of this documentation can be found at 
      <a href=\"http://keso-project.sourceforge.net\">
      http://keso-project.sourceforge.net</a>." >> apiIndex

# copyright notice
echo ' * @subsection copyrightnote Copyright notice
      <pre>
      Copyright (c)  2001 - 2002  Lars Luthman
      Permission is granted to copy, distribute and/or modify this document
      under the terms of the GNU Free Documentation License, Version 1.1
      or any later version published by the Free Software Foundation;
      with no Invariant Sections, with no Front-Cover Texts, and with no 
      Back-Cover Texts.
      A copy of the license is included in the section entitled "GNU
      Free Documentation License" under "Related pages".
      </pre> */' >> apiIndex

# GNU Free Documentation License
echo ' /** @page gfdl GNU Free Documentation License
      <pre>' >> apiIndex
cat fdl.txt >> apiIndex
echo '</pre>' >> apiIndex

echo " */" >> apiIndex

# write the HTML footer
echo '<hr><address><small><center>
Copyright (C) 2003 Lars Luthman, see the section 
<a href="gfdl.html">GNU Free Documentation License.</a><br>
This documentation was generated from the $projectname source files
$datetime using Doxygen $doxygenversion.
</center></small></address>
</body>
</html>' >> footer.html

# configuration file
echo "
INPUT          = apiIndex ../keso/ ../gtkmm-gui/common
PROJECT_NAME   = ${project_name}
PROJECT_NUMBER = ${project_number}

HTML_FOOTER    = footer.html

GENERATE_RTF   = NO
GENERATE_MAN   = NO

EXTRACT_PRIVATE     = YES
JAVADOC_AUTOBRIEF   = YES
DETAILS_AT_TOP      = YES
HAVE_DOT            = YES
CLASS_GRAPH         = YES
TEMPLATE_RELATIONS  = YES
" > Doxyfile

doxygen
rm -rf Doxyfile apiIndex footer.html
