2019-06-03 15:37:03 +01:00
|
|
|
default: pdf
|
|
|
|
|
|
|
|
# Constants.
|
|
|
|
rootname = main
|
2019-06-17 16:15:12 +01:00
|
|
|
rootfile = src/$(rootname).tex
|
2019-06-03 15:37:03 +01:00
|
|
|
outdir = build
|
|
|
|
outfile = $(outdir)/$(rootname).pdf
|
|
|
|
|
|
|
|
# Compression with ghostscript.
|
|
|
|
compress = gs -sDEVICE=pdfwrite -dPDFSETTINGS=/$(1) -dCompatibilityLevel=1.4 -dNOPAUSE -dQUIET -dBATCH -sOutputFile=$(outdir)/$(rootname)-$(1).pdf $(outfile)
|
|
|
|
|
|
|
|
# Latex command to build pdf file.
|
2019-06-17 16:15:12 +01:00
|
|
|
latexmk = TEXINPUTS=.:./tlsflyleaf/:./src/: latexmk -lualatex -f -latexoption=-shell-escape -interaction=nonstopmode $< -outdir=$(outdir) $(1) $(rootfile)
|
2019-06-03 15:37:03 +01:00
|
|
|
|
|
|
|
# Build PDF version adapted to printers.
|
|
|
|
printer: pdf
|
|
|
|
$(call compress,printer)
|
|
|
|
|
|
|
|
# Build PDF version adapted to screens.
|
|
|
|
screen: pdf
|
|
|
|
$(call compress,screen)
|
|
|
|
|
|
|
|
# Build PDF version of the thesis manuscript.
|
|
|
|
pdf: $(rootfile)
|
|
|
|
make clean
|
|
|
|
$(call latexmk)
|
|
|
|
|
|
|
|
# Watch and automatically recompile when a file changes.
|
|
|
|
watch: $(rootfile)
|
|
|
|
$(call latexmk,-pvc -view=none)
|
|
|
|
|
|
|
|
# Remove intermediate build artifacts.
|
|
|
|
clean:
|
|
|
|
latexmk -c -outdir=$(outdir) $(rootfile)
|
|
|
|
|
|
|
|
# Remove all build artifacts.
|
|
|
|
clean-all:
|
|
|
|
rm -rf $(outdir)
|
|
|
|
|
|
|
|
# Phony targets will always trigger a re-run.
|
|
|
|
.PHONY: clean-all clean watch pdf
|