BUILD_DIR=build build: $(BUILD_DIR)/report.pdf .PHONY: build $(BUILD_DIR)/report.aux: report.tex references.bib @mkdir -p $(BUILD_DIR) @xelatex -interaction=nonstopmode -halt-on-error -shell-escape -output-directory=$(BUILD_DIR) report.tex $(BUILD_DIR)/report.bbl: $(BUILD_DIR)/report.aux references.bib @mkdir -p $(BUILD_DIR) @if ! (cmp -s $(BUILD_DIR)/report.aux $(BUILD_DIR)/report.aux.old && cmp -s references.bib $(BUILD_DIR)/references.bib.old); then \ echo "# Rebuilding $(BUILD_DIR)/report.bbl"; \ bibtex $(BUILD_DIR)/report; \ xelatex -interaction=batchmode -halt-on-error -shell-escape -output-directory=$(BUILD_DIR) report.tex >/dev/null; \ fi @cp $(BUILD_DIR)/report.aux $(BUILD_DIR)/report.aux.old @cp references.bib $(BUILD_DIR)/references.bib.old $(BUILD_DIR)/report.pdf: report.tex $(BUILD_DIR)/report.bbl @mkdir -p $(BUILD_DIR) @xelatex -interaction=batchmode -halt-on-error -shell-escape -output-directory=$(BUILD_DIR) report.tex >/dev/null