2026-06-25 13:46:15 -04:00
|
|
|
# Resume build — each variant is a src/*.tex, built to dist/*.pdf (pdflatex).
|
2026-05-04 10:41:59 -04:00
|
|
|
|
2026-06-25 13:46:15 -04:00
|
|
|
DIST := dist
|
|
|
|
|
VARIANTS := $(notdir $(basename $(wildcard src/*.tex)))
|
|
|
|
|
PDFS := $(addprefix $(DIST)/,$(addsuffix .pdf,$(VARIANTS)))
|
2026-05-04 10:41:59 -04:00
|
|
|
|
2026-06-25 13:46:15 -04:00
|
|
|
LATEXMK := latexmk -pdf -interaction=nonstopmode -halt-on-error -output-directory=$(DIST)
|
|
|
|
|
VIEWER := $(shell command -v xdg-open 2>/dev/null || command -v open 2>/dev/null)
|
2026-05-04 10:41:59 -04:00
|
|
|
|
2026-06-25 13:46:15 -04:00
|
|
|
.PHONY: all build watch clean distclean help $(VARIANTS)
|
2026-05-04 10:41:59 -04:00
|
|
|
|
|
|
|
|
all: build
|
|
|
|
|
|
2026-06-25 13:46:15 -04:00
|
|
|
## build: compile every variant in src/ into dist/
|
|
|
|
|
build: $(PDFS)
|
2026-05-04 10:41:59 -04:00
|
|
|
|
2026-06-25 13:46:15 -04:00
|
|
|
$(DIST)/%.pdf: src/%.tex
|
|
|
|
|
$(LATEXMK) $<
|
2026-05-04 10:41:59 -04:00
|
|
|
|
2026-06-25 13:46:15 -04:00
|
|
|
# Build a single variant by name, e.g. `make react-native`
|
|
|
|
|
$(VARIANTS): %: $(DIST)/%.pdf
|
2026-05-04 10:41:59 -04:00
|
|
|
|
2026-06-25 13:46:15 -04:00
|
|
|
## watch: rebuild + live-preview a variant, e.g. `make watch V=react-native`
|
|
|
|
|
watch:
|
|
|
|
|
$(LATEXMK) -pvc src/$(V).tex
|
2026-05-04 10:41:59 -04:00
|
|
|
|
2026-06-25 13:46:15 -04:00
|
|
|
## preview: build a variant and open it, e.g. `make preview V=react-native`
|
|
|
|
|
preview: $(DIST)/$(V).pdf
|
|
|
|
|
$(if $(VIEWER),$(VIEWER) $(DIST)/$(V).pdf,@echo "No PDF viewer found. PDF is at $(DIST)/$(V).pdf.")
|
2026-05-04 10:41:59 -04:00
|
|
|
|
2026-06-25 13:46:15 -04:00
|
|
|
## clean: remove LaTeX aux files, keep the PDFs
|
2026-05-04 10:41:59 -04:00
|
|
|
clean:
|
2026-06-25 13:46:15 -04:00
|
|
|
-$(foreach v,$(VARIANTS),latexmk -c -output-directory=$(DIST) src/$(v).tex;)
|
2026-05-04 10:41:59 -04:00
|
|
|
|
|
|
|
|
## distclean: remove dist/ entirely
|
|
|
|
|
distclean:
|
|
|
|
|
rm -rf $(DIST)
|
|
|
|
|
|
2026-06-25 13:46:15 -04:00
|
|
|
## help: list available targets and variants
|
2026-05-04 10:41:59 -04:00
|
|
|
help:
|
|
|
|
|
@grep -E '^## ' $(MAKEFILE_LIST) | sed 's/## //'
|
2026-06-25 13:46:15 -04:00
|
|
|
@echo "variants: $(VARIANTS)"
|