#!/bin/sh

sage -b

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

make distclean

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 -f */*.ind

make html pdf

