-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
104 lines (94 loc) · 4.45 KB
/
Copy pathMakefile
File metadata and controls
104 lines (94 loc) · 4.45 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# Thesis build.
#
# Engine config lives in .latexmkrc (LuaLaTeX + -shell-escape + biber), not
# here -- this Makefile only drives latexmk so there is one source of truth.
#
# LuaLaTeX : Unicode identifiers in the Lean listings (₀, ≃, →, Σ)
# -shell-escape : required by minted
# biber : biblatex backend
#
# Run `make doctor` first if the build fails; there is a known minted version
# mismatch on this machine.
MAIN := main
LATEXMK := latexmk
.DEFAULT_GOAL := pdf
.PHONY: pdf watch clean distclean errata doctor untrack-hint help
## pdf Build main.pdf (default target)
pdf:
$(LATEXMK) $(MAIN).tex
## watch Rebuild continuously on save
watch:
$(LATEXMK) -pvc $(MAIN).tex
## clean Remove build artifacts, keep the PDF
clean:
$(LATEXMK) -c $(MAIN).tex
@rm -rf _minted*/ *.bbl-SAVE-ERROR
@echo "note: tracked artifacts will now show as deleted in 'git status'"
@echo " until you untrack them -- see 'make untrack-hint'"
## distclean Remove build artifacts and the generated PDF
## (never touches THESIS_HOTT_LEAN_FIN.pdf -- latexmk keys off
## the jobname, so only main.pdf is removed)
distclean:
$(LATEXMK) -C $(MAIN).tex
@rm -rf _minted*/ *.bbl-SAVE-ERROR _*.config.minted
## errata List outstanding FIXME(errata) markers by tier
errata:
@printf '\n\033[1mCORRECTNESS\033[0m — fix before circulating\n'
@grep -n 'FIXME(errata,correctness)' $(MAIN).tex \
| sed 's/:%* *FIXME(errata,correctness): */ /' || true
@printf '\n\033[1mPRESENTATION\033[0m\n'
@grep -n 'FIXME(errata,presentation)' $(MAIN).tex \
| sed 's/:%* *FIXME(errata,presentation): */ /' || true
@printf '\ntotal: %s marker(s). Full context: grep -n -A8 "FIXME(errata" %s.tex\n\n' \
"$$(grep -c 'FIXME(errata' $(MAIN).tex)" "$(MAIN)"
## doctor Diagnose the toolchain (run this if the build fails)
doctor:
@echo "engine ------------------------------------------------------------"
@for t in lualatex latexmk biber; do \
printf ' %-12s %s\n' "$$t" "$$(command -v $$t || echo 'MISSING')"; \
done
@echo
@echo "minted ------------------------------------------------------------"
@sty=$$(kpsewhich minted.sty); \
styver=$$(grep -m1 -oE 'v[0-9]+\.[0-9]+\.[0-9]+' "$$sty" | tr -d v); \
pyver=$$(latexminted --version 2>/dev/null | head -1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+'); \
printf ' minted.sty %s (%s)\n' "$${styver:-unknown}" "$$sty"; \
printf ' latexminted %s (%s)\n' "$${pyver:-MISSING}" "$$(command -v latexminted || echo '-')"; \
echo; \
req=3.8.0; \
if [ -n "$$styver" ] && [ "$$(printf '%s\n%s\n' "$$req" "$$styver" | sort -V | head -1)" != "$$req" ]; then \
echo " MISMATCH: latexminted needs minted.sty >= $$req, found $$styver."; \
echo " The Homebrew latexminted has outrun TeX Live's bundled minted.sty."; \
echo; \
echo " Fix, best option first:"; \
echo " 1) Drop a newer minted.sty into your personal tree (no sudo):"; \
echo " mkdir -p ~/Library/texmf/tex/latex/minted"; \
echo " curl -L -o ~/Library/texmf/tex/latex/minted/minted.sty \\"; \
echo " https://mirrors.ctan.org/macros/latex/contrib/minted/minted.sty"; \
echo " It shadows the distribution copy; delete it to revert."; \
echo " 2) sudo tlmgr update --self && sudo tlmgr update minted"; \
echo " (may refuse if the TeX Live 2025 repo is frozen)"; \
echo " 3) Pin latexminted back to a 3.6-compatible release:"; \
echo " brew uninstall latexminted && pipx install 'latexminted==0.5.*'"; \
else \
echo " minted versions look compatible."; \
fi
## untrack-hint Print the command to stop tracking build artifacts
untrack-hint:
@echo "Build artifacts are still tracked from before .gitignore existed."
@echo "To untrack them (files stay on disk; reversible with 'git reset'):"
@echo
@echo " git rm --cached main.aux main.bcf main.blg main.lof main.log \\"
@echo " main.out main.run.xml main.toc \\"
@echo " main.bbl-SAVE-ERROR test.bbl test.blg .DS_Store \\"
@echo " _*.config.minted"
@echo
@echo "Decide separately on main.bbl. It is regenerable, but keeping it"
@echo "tracked lets the archived thesis render its bibliography without"
@echo "biber -- worth keeping for a submitted document."
@echo
@echo "THESIS_HOTT_LEAN_FIN.pdf stays tracked: it is the April 2026"
@echo "submission of record."
## help Show this list
help:
@grep -E '^## ' $(MAKEFILE_LIST) | sed 's/^## / /'