2019-07-01 19:40:34 +02:00
|
|
|
## ---- user config ----
|
2019-06-27 20:14:41 +02:00
|
|
|
|
2019-07-01 19:40:34 +02:00
|
|
|
# Set to anything non-empty to suppress most of latex's messaging. To diagnose
|
|
|
|
# LaTeX errors, you may want to do `make latex_quiet=""` to get verbose output
|
|
|
|
latex_quiet := true
|
2019-06-27 20:14:41 +02:00
|
|
|
|
2019-07-01 19:40:34 +02:00
|
|
|
# Set to anything non-empty to reprocess TeX files every time we make a PDF.
|
|
|
|
# Otherwise these files will be regenerated only when the source markdown
|
|
|
|
# changes; in that case, if you change other dependencies (e.g. a
|
|
|
|
# bibliography), use the -B option to make in order to force regeneration.
|
|
|
|
always_latexmk := true
|
|
|
|
|
|
|
|
# Set to anything non-empty to use xelatex rather than pdflatex. I always do
|
|
|
|
# this in order to use system fonts and better Unicode support. pdflatex is
|
|
|
|
# faster, and there are some packages with which xelatex is incompatible.
|
|
|
|
xelatex := true
|
|
|
|
|
|
|
|
# list of markdown files that are not to be made into PDFs
|
2021-02-01 00:53:14 +01:00
|
|
|
EXCLUDE :=
|
2019-07-01 19:40:34 +02:00
|
|
|
|
|
|
|
# Extra options to pandoc (e.g. "-H mypreamble.tex")
|
|
|
|
PANDOC_OPTIONS :=
|
|
|
|
|
|
|
|
## ---- special external file ----
|
|
|
|
|
|
|
|
# Normally this does not need to be changed:
|
|
|
|
# works if the template is local or in ~/.pandoc/templates
|
2021-01-10 11:35:29 +01:00
|
|
|
PANDOC_TMPL := assets/one-column.tex
|
2019-07-01 19:40:34 +02:00
|
|
|
|
|
|
|
## ---- subdirectories (normally, no need to change) ----
|
|
|
|
|
|
|
|
# temporary file subdirectory; will be removed after every latex run
|
2021-02-01 00:53:14 +01:00
|
|
|
TEMP_DIR := tmp
|
2019-07-01 19:40:34 +02:00
|
|
|
|
2019-12-05 20:38:45 +01:00
|
|
|
# name of output directory for .pdf files
|
2021-02-01 00:53:14 +01:00
|
|
|
OUT_DIR := output
|
2019-12-05 20:38:45 +01:00
|
|
|
# name of input directory for .yml and .latex files
|
2021-02-01 00:53:14 +01:00
|
|
|
IN_DIR := input
|
2019-07-01 19:40:34 +02:00
|
|
|
|
|
|
|
## ---- commands ----
|
|
|
|
|
|
|
|
# Change these only to really change the behavior of the whole setup
|
|
|
|
|
|
|
|
PANDOC := pandoc --template $(PANDOC_TMPL) $(PANDOC_OPTIONS)
|
|
|
|
|
|
|
|
LATEXMK := latexmk $(if $(xelatex),-xelatex,-pdflatex="pdflatex %O %S") \
|
2019-12-05 20:38:45 +01:00
|
|
|
$(if $(latex_quiet),-silent,-verbose)
|
2019-07-01 19:40:34 +02:00
|
|
|
|
|
|
|
## ---- build rules ----
|
|
|
|
|
2021-02-01 00:53:14 +01:00
|
|
|
ymls := $(filter-out $(addprefix $(IN_DIR)/,$(EXCLUDE)),$(wildcard $(IN_DIR)/*.yml))
|
|
|
|
pdfs_path := $(filter-out $(addprefix $(OUT_DIR)/,$(EXCLUDE)),$(wildcard $(OUT_DIR)/*.pdf))
|
2019-07-01 19:40:34 +02:00
|
|
|
texs := $(patsubst %.yml,%.tex,$(ymls))
|
|
|
|
pdfs := $(patsubst %.yml,%.pdf,$(ymls))
|
2021-02-01 00:53:14 +01:00
|
|
|
bibs := $(wildcard $(IN_DIR)/*.bib)
|
2019-07-01 19:40:34 +02:00
|
|
|
|
|
|
|
$(texs): %.tex: %.yml $(bibs) $(PANDOC_TMPL)
|
2020-05-21 02:48:18 +02:00
|
|
|
$(PANDOC) -o $@ $<
|
2019-07-01 19:40:34 +02:00
|
|
|
|
2021-02-01 00:53:14 +01:00
|
|
|
.PHONY: all clean
|
2019-07-01 19:40:34 +02:00
|
|
|
|
|
|
|
$(pdfs): %.pdf: %.tex
|
|
|
|
@echo $(bibs)
|
|
|
|
$(LATEXMK) $<
|
|
|
|
|
2019-07-08 15:14:28 +02:00
|
|
|
all: $(pdfs) clean
|
2019-07-01 19:40:34 +02:00
|
|
|
|
|
|
|
# clean up everything except final pdfs
|
|
|
|
clean:
|
2019-12-05 20:38:45 +01:00
|
|
|
latexmk -c .
|
2019-07-01 19:40:34 +02:00
|
|
|
|
|
|
|
.DEFAULT_GOAL := all
|