#!/bin/bash --norc
# ============================================================================
# Name:
#    make_manual - Run pdflatex and latex2html on manual.tex, run epydoc
#    on Python source, clean-up.
#
# Usage:
#    make_manual
#
# Notes:
# - Script is assumed to be in qtcm/doc.
# - Commands/paths are configured to work on my MacBook.
# - This script uses pdflatex to generate a PDF file, using the current
#   directory as workspace, and cleans up all aux, dvi, and log files.
# - Latex2html is used to generate an HTML version of the manual.
# - 
# - All files generated by pdflatex except the input and *.aux file are
#   deleted or moved.  The PDF generated by the script is moved up to the
#   parent directory.  The HTML version is moved up to the parent directory
#   and renamed html.
# ============================================================================

source ${HOME}/.bashrc
echo "Script must run in same directory as tex file"

cd ./latex
python2.4 code_to_latex.py
inputfile=manual.tex
filenamebase=${inputfile%.tex}

pdflatex $inputfile
bibtex ${filenamebase}
pdflatex $inputfile
pdflatex $inputfile

pdffile="${filenamebase}.pdf"
\mv $pdffile ..
#preview ../${pdffile}

#\rm *.blg
#\rm *.log
#\rm *.out

latex2html -local_icons -split +1 $filenamebase
\rm -rf ../html/*
\mv ${filenamebase}/* ../html
rmdir $filenamebase

cd ..
epydoc -v --config epydocrc /Users/jlin/work/lib/otherpy/qtcm
