TARFILES = Makefile gateway.cls report.tex report.bib at91sam7l-block-diagram.pdf hp20b.jpg

report.pdf : report.tex report.bib

%.pdf : %.tex 
	pdflatex $< < /dev/null
	if grep -s Citation $*.log; then \
	    bibtex $*; \
	    pdflatex $< < /dev/null; \
	    pdflatex $< < /dev/null; \
        fi

report-template.zip : $(TARFILES)
	cd .. && zip report-template/report-template.zip $(TARFILES:%=report-template/%)

report-template.tar.gz : $(TARFILES)
	cd .. && tar zhcf report-template/report-template.tar.gz $(TARFILES:%=report-template/%)

.PHONY : clean
clean :
	rm -rf *.aux *.bbl *.blg *.log *.out report.pdf
