# Resume build — each variant is a src/*.tex, built to dist/*.pdf (pdflatex). DIST := dist VARIANTS := $(notdir $(basename $(wildcard src/*.tex))) PDFS := $(addprefix $(DIST)/,$(addsuffix .pdf,$(VARIANTS))) 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) .PHONY: all build watch clean distclean help $(VARIANTS) all: build ## build: compile every variant in src/ into dist/ build: $(PDFS) $(DIST)/%.pdf: src/%.tex $(LATEXMK) $< # Build a single variant by name, e.g. `make react-native` $(VARIANTS): %: $(DIST)/%.pdf ## watch: rebuild + live-preview a variant, e.g. `make watch V=react-native` watch: $(LATEXMK) -pvc src/$(V).tex ## 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.") ## clean: remove LaTeX aux files, keep the PDFs clean: -$(foreach v,$(VARIANTS),latexmk -c -output-directory=$(DIST) src/$(v).tex;) ## distclean: remove dist/ entirely distclean: rm -rf $(DIST) ## help: list available targets and variants help: @grep -E '^## ' $(MAKEFILE_LIST) | sed 's/## //' @echo "variants: $(VARIANTS)"