Skip to content

Instantly share code, notes, and snippets.

@25077667
Created May 6, 2022 09:12
Show Gist options
  • Save 25077667/63af56430e90db993f00430ec80b147a to your computer and use it in GitHub Desktop.
Save 25077667/63af56430e90db993f00430ec80b147a to your computer and use it in GitHub Desktop.
Universal pdflatex Makefile
src=$(wildcard *.tex)
target=$(patsubst %.tex,%.pdf,$(src))
middles=$(shell pwd)/build
.PHONY:mkdir all clean deepclean
%.pdf: %.tex mkdir
pdflatex -no-shell-escape -output-directory="$(middles)" $<
pdflatex -no-shell-escape -output-directory="$(middles)" $<
all: $(target)
mv $(middles)/$< .
mkdir:
mkdir -p $(middles)
clean:
$(RM) -r $(middles)
deepclean: clean
$(RM) *.pdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment