#!/bin/sh

clean() {
    ## Not sure if this step is needed, guess latexmk should be able to detect a change
    printf "\t¤ Clean previous build"
    find latex/$1/build -mindepth 1 -prune -not -name $1_manual.pyg -exec rm -rf {} \;

    ## HTML exports
    #printf '   - possible HTML export'
    #find latex/$1 -type d -name 'html*'    -exec rm -r {} \;

    echo
}

build() {
    printf "\t¤ Generation of the PDF format\n"
    latexmk -r  ./latex/global/latexmkrc  \
	    -cd ./latex/$1/main/$1_manual \
	    1> /dev/null
    [ -f ./latex/$1/build/$1_manual.pdf ] && mv ./latex/$1/build/$1_manual.pdf .
    echo
}

