#!/bin/sh

sage -b

if [ $? -ne 0 ]; then
    echo "Error building SAGE."
    exit 1
fi

#make clean

if [ $? -ne 0 ]; then
    echo "Error doing a make clean on the docs"
    exit 1
fi


rm -f paper-letter/*.pdf
touch */*.tex
cd ref
./update

if [ $? -ne 0 ]; then
    echo "Error updating the reference manual."
    exit 1
fi


cd ..
rm */*.ind

make html
if [ $? -ne 0 ]; then
    echo "Error making html documentation"
    exit 1
fi

# The pdf file produced by "make pdf" on my computer
# completely suck.  But I don't know a better way to make them.
# They look fine in acrobat. 
make pdf
if [ $? -ne 0 ]; then
    echo "Error making pdf documentation"
    exit 1
fi


