#!/bin/sh
# find the Doxyfile, or quit
if [ ! -f Doxyfile ]
then
echo 'No Doxyfile found in current directory' `pwd`
exit
fi
# find the doxygen command, or quit
DOXCMD=`which doxygen`
if [ "$DOXCMD" = "" ]
then
echo 'No doxygen command found in path' $PATH
exit
fi
# find the tagfile, if any
TAGFILE=`grep ^GENERATE_TAGFILE Doxyfile | sed s/GENERATE_TAGFILE\ *=\ *//`
TAGXSLT=Lurch-doxygen-tag.xsl
if [ "$TAGFILE" = "" ]
then
WILLDOTAG="Doxyfile does not generate tag file."
else
WILLDOTAG=""
fi
# find info about generating XML
XMLYN=`grep ^GENERATE_XML Doxyfile | sed s/GENERATE_XML\ *=\ *//`
if [ "$XMLYN" != "YES" ]
then
WILLDOXML="Doxyfile does not generate XML output."
else
TOPLOC=`grep ^OUTPUT_DIRECTORY Doxyfile | sed s/OUTPUT_DIRECTORY\ *=\ *//`
XMLPATH=`grep ^XML_OUTPUT Doxyfile | sed s/XML_OUTPUT\ *=\ *//`
XMLLOC=$TOPLOC/$XMLPATH
XMLXSLT=Lurch-doxygen-xml.xsl
if [ ! -f $XMLXSLT ]
then
WILLDOXML="Cannot find Doxygen XSLT stylesheet $XMLXSLT"
else
WILLDOXML=""
fi
fi
# run doxygen
echo "Running $DOXCMD Doxyfile"
$DOXCMD Doxyfile
# find the Doxygen XML output
if [ \( "$WILLDOXML" = "" \) -a \( ! -d $XMLLOC \) ]
then
WILLDOXML="Cannot find Doxygen XML output directory $XMLLOC"
fi
# find the Doxygen tagfile
if [ \( "$WILLDOTAG" = "" \) -a \( ! -f $TAGFILE \) ]
then
WILLDOTAG="Cannot find Doxygen tagfile $TAGFILE"
fi
# if any XML processing to be done (Doxygen XML or tag file) then find xsltproc
XSLTCMD=`which xsltproc`
if [ \( \( "$WILLDOXML" != "" \) -o \( "$WILLDOTAG" != "" \) \) -a \( "$XSLTCMD" = "" \) ]
then
echo "Cannot do any additional processing; xsltproc command not found in path $PATH"
exit
fi
# process XML or explain why we're not
if [ "$WILLDOXML" = "" ]
then
# recreate cumulative file
XMLOUTPUT=Lurch-doxygen.xml.processed
if [ -f $XMLOUTPUT ]
then
rm $XMLOUTPUT
fi
touch $XMLOUTPUT
# fill it with data from several .xml files
for file in $XMLLOC/class_lob.xml $XMLLOC/class_lob_address.xml \
$XMLLOC/class_*_package.xml $XMLLOC/class_*_extension.xml \
$XMLLOC/class_user_action_tracker.xml
do
if [ ! -f $file ]
then
echo "Could not find this file to process: $file"
else
echo "Executing $XSLTCMD $XMLXSLT $file >> $XMLOUTPUT"
$XSLTCMD $XMLXSLT $file >> $XMLOUTPUT
fi
done
else
echo "Not processing XML: $WILLDOXML"
fi
# process the tagfile, if any
if [ "$WILLDOTAG" = "" ]
then
echo "Executing $XSLTCMD $TAGXSLT $TAGFILE > $TAGFILE.processed"
$XSLTCMD $TAGXSLT $TAGFILE > $TAGFILE.processed
else
echo "Not processing tagfile: $WILLDOTAG"
fi