| summaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a48ac73 --- /dev/null +++ b/Makefile @@ -0,0 +1,65 @@ +################################################################################ +## Document Parameters ######################################################### +################################################################################ +# Name of the main file, without the .tex extension. +DOCUMENT_FILENAME ?= main + +################################################################################ +## Binaries #################################################################### +################################################################################ +PDFLATEX ?= pdflatex + +################################################################################ +## Deducing Main Target ######################################################## +################################################################################ +ifeq ($(strip $(PDFVIEWER)),) +main_target: compile + +else +main_target: view + +endif + +################################################################################ +## Basic Makefile Shenanigans ################################################## +################################################################################ +COMMA =, + +################################################################################ +## Localising Relevant Files ################################################### +################################################################################ +TEX_FILES = $(shell find ${CURDIR} -iname \*.tex) + +################################################################################ +## Making the Actual PDF ####################################################### +################################################################################ +$(DOCUMENT_FILENAME).pdf: $(TEX_FILES) Makefile + $(PDFLATEX) $(DOCUMENT_FILENAME).tex + $(PDFLATEX) $(DOCUMENT_FILENAME).tex + grep -i "\\(Reference\\|Citation\\).*undefined" \ + $(DOCUMENT_FILENAME).log || true + +################################################################################ +## Secondary Targets ########################################################### +################################################################################ +view: compile + $(PDFVIEWER) $(DOCUMENT_FILENAME).pdf + +compile: $(DOCUMENT_FILENAME).pdf + $(MAKE) clean_mess + +edit: + $(EDITOR) $(TEX_FILES) + +clean: + rm -f \ + $(filter-out $(DOCUMENT_FILENAME).tex,$(wildcard $(DOCUMENT_FILENAME).*)) + +################################################################################ +clean_mess: + rm -f \ + $(filter-out $(DOCUMENT_FILENAME).tex, \ + $(filter-out $(DOCUMENT_FILENAME).pdf, \ + $(wildcard $(DOCUMENT_FILENAME)\.*) \ + ) \ + ) |


