main = report latexmk = latexmk -pdf git_add_files = *.tex imgs/ ref.bib Makefile latexmkrc .PHONY : main clean cleanall autopush main: $(main).tex mkdir -pv tikzcache $(latexmk) $< clean: $(latexmk) -c $(main).tex cleanall: $(latexmk) -C $(main).tex autopush: main git add $(git_add_files) git diff --cached --quiet || (git commit -m "update: auto commit" && git push)