TIMESTAMP=$(shell date +%Y-%m-%d_%H%M) CURRENT_TP1 := $(wildcard tp1_*.pdf) ifeq ($(strip $(CURRENT_TP1)),) override CURRENT_TP1 = bogus_tp1.pdf endif all: $(CURRENT_TP1) $(CURRENT_TP1): build/tp1.pdf @rm -f $(CURRENT_TP1) @cp build/tp1.pdf tp1_${TIMESTAMP}.pdf @echo Updated build/tp1.pdf: tp1.tex @latexmk -pdf tp1.tex clean: @rm -rf build 2>/dev/null