curriculum-vitae/Makefile

79 lines
2.3 KiB
Makefile
Raw Normal View History

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
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
2019-12-05 20:38:45 +01:00
EXCLUDE := README.org
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
2019-12-06 19:43:04 +01:00
PANDOC_TMPL := Assets/template.tex
2019-07-01 19:40:34 +02:00
## ---- subdirectories (normally, no need to change) ----
# source of YAML spec files
2019-12-05 20:38:45 +01:00
#yml_dir := .
2019-07-01 19:40:34 +02:00
# temporary file subdirectory; will be removed after every latex run
temp_dir := tmp
2019-12-05 20:38:45 +01:00
# name of output directory for .pdf files
out_dir := Output
# name of input directory for .yml and .latex files
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 ----
2019-12-05 20:38:45 +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))
2019-12-05 20:38:45 +01:00
bibs := $(wildcard $(in_dir)/*.bib)
2019-07-01 19:40:34 +02:00
$(texs): %.tex: %.yml $(bibs) $(PANDOC_TMPL)
$(PANDOC) -o $@ $< # pandoc template > .tex
phony_pdfs := $(if $(always_latexmk),$(pdfs) $(notes_pdf))
.PHONY: $(phony_pdfs) all clean
$(pdfs): %.pdf: %.tex
@echo $(bibs)
$(LATEXMK) $<
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