#!/bin/bash
# build.sh
# GPLv3+
set -x
rm -f forksand-it-manual.pdf source/forksand-it-manual.pdf
cd source || exit
# Generate Source-gen.tex, for auto source code inclusion
time ./resources/make-sources-list.sh
cd ~/FORKSAND/IT/forksand-it-manual/source/ || exit

# Build main LaTeX file
# Run BibTeX
#bibtex                                                                  \
#        forksand-it-manual
# Build PDF
xelatex                                                                 \
         -halt-on-error                                                  \
         -shell-escape                                                   \
         -interaction=nonstopmode                                        \
        forksand-it-manual.tex

mv *.pdf ../

exit 0

# Use latexmk for final build, takes 5x+ longer to run...
latexmk									\
	-xelatex							\
        -halt-on-error                                                  \
        -shell-escape                                                   \
        -interaction=nonstopmode                                        \
        forksand-it-manual.tex

# Faster, may not be enough runs:
xelatex                                                                 \
         -halt-on-error                                                  \
         -shell-escape                                                   \
         -interaction=nonstopmode                                        \
        forksand-it-manual.tex
