# Build targets for the resume.
#
# Single content source: resume.yaml
#
#   make           -> PDF (default; renders .tex from YAML, then pdflatex twice)
#   make odt       -> ODT (renders directly from YAML)
#   make docx      -> DOCX (ODT -> LibreOffice convert -> DOCX)
#   make all       -> PDF + ODT + DOCX
#   make clean     -> remove TeX aux files
#   make distclean -> also remove generated PDF/ODT/DOCX/TEX

YAML := resume.yaml
TEX  := MikeEberlein_Resume.tex
PDF  := MikeEberlein_Resume.pdf
ODT  := MikeEberlein_Resume.odt
DOCX := MikeEberlein_Resume.docx

.PHONY: all pdf odt docx clean distclean

all: $(PDF) $(ODT) $(DOCX)
pdf: $(PDF)
odt: $(ODT)
docx: $(DOCX)

$(TEX): $(YAML) render_tex.py
	python3 render_tex.py

$(PDF): $(TEX)
	pdflatex -interaction=nonstopmode -halt-on-error $(TEX)
	pdflatex -interaction=nonstopmode -halt-on-error $(TEX)

$(ODT): $(YAML) render_odt.py
	python3 render_odt.py

$(DOCX): $(ODT)
	soffice --headless --convert-to docx $(ODT)

clean:
	rm -f *.aux *.log *.out *.toc *.fls *.fdb_latexmk *.synctex.gz

distclean: clean
	rm -f $(PDF) $(ODT) $(DOCX) $(TEX)
