#!/bin/sh

## Avoid the use of shell builtin echo (for -e option)
alias echo='/bin/echo -e'

## Check dependencies
##-------------------

## Sphinx, BibTeX extension and "Read The Docs" theme
if [ -n "$( ./check_pkg.py sphinx sphinxcontrib.bibtex sphinx_rtd_theme )" ]; then
    echo 'One of the Python dependencies is missing => QUIT'
    exit 2
fi

echo "\t¤ Clean previous build"
make clean
echo

echo "\t¤ Generation of the guide"
make html > /dev/null
echo

echo "\t¤ End of building run"
echo "Open ./build/html/guide.html"

exit 0
