#!/bin/bash

set -e
cd `dirname $0`

LATEX="pdflatex --synctex=1 --output-directory=build -interaction=nonstopmode"
BASENAME="t29-application"

function compile {
	$LATEX "\def\LANG{$1}\input{$BASENAME.tex}"
}

rm build/*
compile EN
compile EN
mv build/$BASENAME.pdf $BASENAME-EN.pdf
rm build/*

compile DE
compile DE
mv build/$BASENAME.pdf $BASENAME-DE.pdf

echo "Build $BASENAME-DE.pdf and $BASENAME-EN.pdf files"
rm build/*
