Files
tepbc-ross-retyped/Makefile
T
bdeshiandClaude Sonnet 5.5 4424cc9887 Add the EPUB edition: converter, class-based audit, shared front matter
tools/make_epub.py converts the same src/ the PDF is set from, running
polish.py first, with original page numbers as page-list metadata, endnotes
gathered in one linked Notes section, and the colophon and errata included.
It raises on any macro it does not declare. tools/epub_audit.py checks by
class of fault (LaTeX residue, escaping, empty blocks, links, images, XML,
content, typography drift from the PDF); make epub runs both.

\byedition{PDF}{EPUB} lets the colophon carry the sentences that are true of
only one edition; the errata introduction moves into src/errata.tex so both
editions print one copy. reprocheck.py now accepts an .epub and skips
environment parameters that are layout, not copy.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-09-29 14:36:18 +06:00

64 lines
2.6 KiB
Makefile

# All heavy tools run inside the container; the host drives via make.
# Set NODOCKER=1 to run directly if xelatex/poppler/tesseract are installed locally.
# zsh does not export UID/GID; compose.yaml needs them to run as the tree's owner.
export UID := $(shell id -u)
export GID := $(shell id -g)
RUN := $(if $(NODOCKER),,docker compose run --rm -T tex)
OUT := ross-1988-retypeset.pdf
SOURCES := build.sh tools/polish.py tools/gen_seal.py tools/gen_cover_mosaic.py tools/optimize_plates.py src/preamble.tex src/cover.tex src/colophon.tex \
src/errata.tex $(wildcard src/pages/*.tex)
.DEFAULT_GOAL := pdf
.PHONY: pdf build image prep plate cover epub check reprocheck verify clean distclean shell help
# The PDF is a build product and is not in git. This remakes it from src/ and
# plates/, neither of which needs the ProQuest scan — only prep and plate do.
pdf: $(OUT) ## typeset the edition (only if a source changed)
$(OUT): $(SOURCES)
$(RUN) ./build.sh
build: ## typeset unconditionally, even if nothing changed
$(RUN) ./build.sh
image: ## build the toolchain image (once)
docker compose build
prep: ## rasterize + OCR-scaffold pages A..B: make prep A=19 B=32 [needs source/]
$(RUN) tools/prep.sh $(A) $(B)
plate: ## crop plate image for PDF page N: make plate N=40 [ARGS="--top 0.06"] [needs source/]
$(RUN) python3 tools/crop_plate.py $(N) $(ARGS)
check: ## consistency checks (manifest <-> files <-> macros), no build
$(RUN) python3 tools/check.py
reprocheck: ## every token of src/pages must reach the built PDF
$(RUN) python3 tools/reprocheck.py $(OUT)
# Depends on `build`, not `pdf`: `pdf` is timestamp-conditional, and a source edited
# while a build is running leaves a PDF NEWER than the source it does not contain,
# so make would skip the rebuild and verify would pass against stale output.
verify: check build reprocheck ## the full gate: check, typeset unconditionally, then prove nothing was dropped
epub: ## build the reflowable EPUB (needs the PDF built, for its cover), then audit it
$(RUN) python3 tools/make_epub.py
$(RUN) python3 tools/epub_audit.py
cover: ## rebuild the cover mosaic from plates/ and fonts/
$(RUN) python3 tools/gen_cover_mosaic.py --force
shell: ## interactive shell in the container
docker compose run --rm tex bash
clean: ## remove LaTeX aux and scratch rasters (keeps plates and the PDF)
rm -rf work/*
distclean: clean ## also drop the page rasters and the built PDF
rm -rf scans/* $(OUT)
help:
@grep -E '^[a-z-]+:.*##' Makefile | sed 's/:.*##/ —/'