NAME = paper BIB = references .PHONY: all clean all: $(NAME).pdf clean: find ./ -type f -regex ".*/\($(NAME)\|$(BIB)\).*" ! -regex ".*/\($(NAME).tex\|$(BIB).bib\)" -exec rm '{}' \; $(NAME).pdf: $(NAME).tex $(BIB).bib latexmk -pdf -pdflatex="pdflatex -interaction=nonstopmode" $(NAME).tex