make arxiv/<dir>/<name>.tar.gz: a paper's sources with ../shared/ flattened and its .bbl, compiled alone without bibtex before it is packed.

Co-authored-by: Hanzo Dev <[email protected]>
This commit is contained in:
2026-09-27 12:08:52 -07:00
co-authored by Hanzo Dev
parent 8917c48fe1
commit 0a9310f7b6
2 changed files with 22 additions and 0 deletions
+1
View File
@@ -22,6 +22,7 @@
# Build output. Tracking it made the CI gate vacuous: a checkout supplied
# the PDFs the gate was looking for, before anything was compiled.
pdfs/
arxiv/
# MacOS files
.DS_Store
+21
View File
@@ -99,6 +99,26 @@ pdfs/%.pdf: %.tex \
@touch $@
@echo " OK $@"
# An arXiv upload is a paper's sources, which arXiv compiles without running
# bibtex, from one flat directory. So it is the paper directory's tracked TeX,
# the shared files it names with the ../shared/ prefix dropped, and the .bbl
# latexmk wrote. The upload is then compiled alone, without bibtex, the way
# arXiv will; one that needs anything outside itself fails here, not after
# submission. For a paper in its own directory: make arxiv/kai/kai.tar.gz
arxiv/%.tar.gz: pdfs/%.pdf
@rm -rf arxiv/$* arxiv/$*.check && mkdir -p arxiv/$*
@cd $(dir $*) && git ls-files -- '*.tex' '*.sty' '*.cls' '*.bst' '*.pdf' '*.png' '*.jpg' \
| tar -cf - -T - | tar -xf - -C $(CURDIR)/arxiv/$*
@for n in $$(grep -rhoE '\.\./shared/[A-Za-z0-9_-]+' arxiv/$* | sort -u | sed 's|.*/||'); do \
cp shared/$$n.* arxiv/$*/; done
@find arxiv/$* -name '*.tex' -exec sed -i.orig 's|\.\./shared/||g' {} + && find arxiv/$* -name '*.orig' -delete
@cp pdfs/$*.bbl arxiv/$*/
@cp -R arxiv/$* arxiv/$*.check && cd arxiv/$*.check \
&& latexmk -pdf -bibtex- -halt-on-error -interaction=nonstopmode -quiet $(notdir $*).tex > /dev/null 2>&1 \
|| { echo " FAIL arxiv/$*: the upload does not compile alone"; false; }
@rm -rf arxiv/$*.check && tar -czf $@ -C arxiv/$* .
@echo " OK $@ ($$(tar -tzf $@ | wc -l | tr -d ' ') files)"
# Clean auxiliary files (keep PDFs). The second sweep clears what the previous
# rule left at the repo root; latexmk writes beside the PDF and never there.
.PHONY: clean
@@ -129,6 +149,7 @@ help:
@echo "Targets:"
@echo " make -k all - Compile all $(words $(ALL_TEX)) papers, report every failure"
@echo " make pdfs/<name>.pdf - Compile a specific paper"
@echo " make arxiv/<dir>/<name>.tar.gz - arXiv upload of a paper in its own directory"
@echo " make list - List all discovered papers"
@echo " make clean - Remove auxiliary files"
@echo " make clean-all - Remove all generated files"