Skip to content

Instantly share code, notes, and snippets.

@jgru
Last active November 9, 2022 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgru/f35ce10e167950491147bddfc0f939df to your computer and use it in GitHub Desktop.
Save jgru/f35ce10e167950491147bddfc0f939df to your computer and use it in GitHub Desktop.
Makefile template for TeX-document
# Author:
# jgru
# Copyright:
# Copyright (c) 2022 jgru
# Define document to build
MAINFILE = draft
# Include sources in subdirectories eventually
TEX_SOURCES := $(MAINFILE).tex $(wildcard */*.tex)
BIB = $(shell echo *.bib)
# Use latexmk
COMPILE_TEX = latexmk -pdflatex=pdflatex -pdf
.PHONY: all clean purge
all: $(MAINFILE).pdf
$(MAINFILE).pdf: $(TEX_SOURCES)
$(COMPILE_TEX) $(MAINFILE).tex
# Clean intermediate files
clean:
-latexmk -c
-rm -f *.abs *.aux *.bbl *.bcf *.brf *.cut *.dqr .log *.lou \
*.blg *.fls *.fdb_latexmk *.idx *.ilg *.ind \
*.listing *.lob *.loc *.lod *.loe *.lof *.log *.lok \
*.lot *.mw *.out *.sol? *.spl *.toc *.upa *.thm
# Purge target files
purge: clean
-rm -f *.pdf *.ps *.dvi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment