-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
43 lines (32 loc) · 1.06 KB
/
Makefile
File metadata and controls
43 lines (32 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
QUARTO ?= quarto
PREAMBLE := preamble_consulting.tex
QMD := StandardResume.qmd
DOCXQMD := WordResume.qmd
DOCXREF := resume-reference.docx
OUTDIR := FinalProducts
UID := $(shell id -u)
GID := $(shell id -g)
qmd_includes = $(shell grep -oP '(?<=\{\{< include )[^ >]+' $(1) 2>/dev/null)
SECTIONS := $(call qmd_includes,$(QMD))
PDF := $(OUTDIR)/StandardResume.pdf
DOCX := $(OUTDIR)/WordResume.docx
.PHONY: all clean docker-render
all: $(OUTDIR) $(PDF) $(DOCX)
docker-render:
docker run --rm -v "$(PWD):/workspace" --user $(UID):$(GID) -e HOME=/tmp quartocv make
$(OUTDIR):
@mkdir -p $@
$(PDF): $(QMD) $(PREAMBLE) $(SECTIONS) | $(OUTDIR)
@echo "==> Rendering $(QMD)"
@$(QUARTO) render "$(QMD)"
@mv "$(basename $(QMD)).pdf" "$(PDF)"
@echo "==> Output: $(PDF)"
$(DOCX): $(DOCXQMD) $(DOCXREF) scripts/postprocess_docx.py | $(OUTDIR)
@echo "==> Rendering $(DOCXQMD)"
@$(QUARTO) render "$(DOCXQMD)"
@mv "$(basename $(DOCXQMD)).docx" "$(DOCX)"
@python3 scripts/postprocess_docx.py
@echo "==> Output: $(DOCX)"
clean:
@rm -rf $(OUTDIR)
@rm -f *.pdf *.html *.docx