SAMPLE = spines.tex SAMPLEPDF = spines.pdf SAMPLESVG = bookshelf.svg MAINDOC = bookshelf.pdf CLS = bookshelf.cls PERLSCRIPTS = \ ../scripts/bookshelf-listallfonts \ ../scripts/bookshelf-mkfontsel MAN = $(notdir ${PERLSCRIPTS:%=%.1}) SCRIPTTEX = $(notdir ${PERLSCRIPTS:%=%.tex}) SCRIPTPDF = $(notdir ${PERLSCRIPTS:%=%.pdf}) all: ${MAN} allfonts ${SAMPLEPDF} ${SAMPLESVG} ${SCRIPTPDF} ${MAINDOC} # spines.pdf must rebuild whenever the owned-books catalogue changes # (prerequisite-only rule; the %.pdf pattern rule supplies the recipe) spines.pdf: physical.bib # Generate SVG from PDF using inkscape ${SAMPLESVG}: ${SAMPLEPDF} inkscape --pdf-poppler --export-text-to-path --export-plain-svg \ --export-area-drawing --export-filename=$@ $< %.1: ../scripts/% pod2man $< > $@ %.tex: ../scripts/% pod2latex -full $< > $@ # lualatex runs non-interactively under a hard timeout and is retried: the # spine typesetter draws fonts at random (random.tex, seeded from the clock # minute) and a bad draw once stalled the build (2026-09-24, three failed # deploys; root cause fixed by bookshelf-filterfonts). A retry keeps the # fontsel/*.tex choices already made, re-rolls only the spines not reached, # and waits a minute first so the seed actually changes. LUALATEX = timeout 900 lualatex -interaction=nonstopmode %.pdf: %.tex bookshelf.cls bookshelf-svgnam.tex pickfont.tex bookshelf.bst for try in 1 2 3; do \ if $(LUALATEX) $*; then break; fi; \ echo "*** lualatex attempt $$try failed or timed out"; \ if [ $$try = 3 ]; then exit 1; fi; sleep 61; \ done - bibtex $* for try in 1 2 3; do \ if $(LUALATEX) $*; then break; fi; \ echo "*** lualatex attempt $$try failed or timed out"; \ if [ $$try = 3 ]; then exit 1; fi; sleep 61; \ done %.pdf: %.dtx spines.pdf bookshelf.cls xelatex $< - biber $* xelatex $< - makeindex -s gind.ist -o $*.ind $*.idx - makeindex -s gglo.ist -o $*.gls $*.glo xelatex $< while ( grep -q 'rerun LaTeX' $*.log) \ do xelatex $<; done bookshelf.dtx: ../bookshelf.dtx cp $< $@ bookshelf.cls: ../bookshelf.cls cp $< $@ bookshelf.bst: ../bookshelf.bst cp $< $@ %.tex: ../%.tex cp $< $@ ../bookshelf.cls: ../bookshelf.ins ../bookshelf.dtx cd .. && ${MAKE} bookshelf.cls ../bookshelf-svgnam.tex: ../svgnam.sh cd .. && ${MAKE} bookshelf-svgnam.tex pickfont.tex: allfonts ../scripts/bookshelf-mkfontsel allfonts # The pool excludes huge CJK/emoji faces (see bookshelf-filterfonts): a # first-time luaotfload parse of one of those takes minutes and gigabytes. allfonts: luaotfload-tool --update --force ../scripts/bookshelf-listallfonts | ../scripts/bookshelf-filterfonts > allfonts clean: $(RM) *.bst *.cls *.aux *.bbl *.blg *.idx *.toc *.log \ *.bcf *.dtx *.dtx *.glo *.gls *.hd *.ilg *.ind *.out \ *.xml pickfont.tex ${SCRIPTTEX} bookshelf-svgnam.tex svgnam.csv $(RM) -r fontsel distclean: clean $(RM) ${MAN} allfonts ${SAMPLEPDF} ${SAMPLESVG} ${SCRIPTPDF} ${MAINDOC}