Skip to content

Instantly share code, notes, and snippets.

@SunnyRaj
Last active June 7, 2016 20:06
Show Gist options
  • Save SunnyRaj/d32528aee32698c6b04404b4d309cc5c to your computer and use it in GitHub Desktop.
Save SunnyRaj/d32528aee32698c6b04404b4d309cc5c to your computer and use it in GitHub Desktop.
Makefile for compiling latex documents
target = paper
.PHONY: ${target}.pdf all clean
all: ${target}.pdf
# CUSTOM BUILD RULES
# In case you didn't know, '$@' is a variable holding the name of the target,
# and '$<' is a variable holding the (first) dependency of a rule.
# "raw2tex" and "dat2tex" are just placeholders for whatever custom steps
# you might have.
%.tex: %.raw
./raw2tex $< > $@
%.tex: %.dat
./dat2tex $< > $@
${target}.pdf: ${target}.tex
latexmk -pdf -pdflatex="pdflatex -interaction=nonstopmode" -use-make ${target}.tex
clean:
latexmk -CA
# Credit: http://tex.stackexchange.com/questions/40738/how-to-properly-make-a-latex-project
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment