From 9979dacb0991c2e462bf5b9a01a7a79ecc5306fe Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Mon, 2 Jun 2025 23:21:46 -0400 Subject: [PATCH] manual: Add build targets for printable manual Specifying `media=print` changes Asciidoctor so that URLs are included inline in a way that can be read in printed media. For printed manuals this is obviously what we want, though we should still keep the regular version around for the binary distributions, since they retain the internal links. --- manual/Makefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/manual/Makefile b/manual/Makefile index ec825ce6..db590b8e 100644 --- a/manual/Makefile +++ b/manual/Makefile @@ -11,11 +11,15 @@ ASCIIDOCTOR_FLAGS = -a pdf-page-size=A5 MANUAL_ADOC_FILES=$(wildcard freedoom-manual-??.adoc) MANUAL_PDF_FILES=$(subst .adoc,.pdf,$(MANUAL_ADOC_FILES)) +PRINT_PDF_FILES=$(subst .adoc,-print.pdf,$(MANUAL_ADOC_FILES)) COVER_PDF_FILES=cover-en.pdf cover-es.pdf cover-fr.pdf COVER_SVG_FILES=$(patsubst %.pdf,cover/%.svg,$(COVER_PDF_FILES)) all: $(MANUAL_PDF_FILES) +# `make print` builds all the PDFs for printed versions of the manuals. +print: covers $(PRINT_PDF_FILES) + # We only build the cover PDFs if the user explicitly runs `make covers`; # this is because it requires Inkscape and we don't want it as a build # dependency. Most users won't ever need these, we only use them when we're @@ -25,6 +29,9 @@ covers: $(COVER_PDF_FILES) freedoom-manual-%.pdf: freedoom-manual-%.adoc -asciidoctor-pdf $(ASCIIDOCTOR_FLAGS) $< -o $@ +freedoom-manual-%-print.pdf: freedoom-manual-%.adoc + -asciidoctor-pdf $(ASCIIDOCTOR_FLAGS) -a media=print $< -o $@ + cover/cover-%.svg: cover/cover-%.sed cover/template.svg sed -f $< < cover/template.svg > $@ @@ -32,7 +39,8 @@ cover-%.pdf: cover/cover-%.svg cover/serpentipede.png cover/minigunner.png inkscape -o $@ $< clean: - $(RM) $(MANUAL_PDF_FILES) $(COVER_PDF_FILES) $(COVER_SVG_FILES) + $(RM) $(MANUAL_PDF_FILES) $(COVER_PDF_FILES) $(COVER_SVG_FILES) \ + $(PRINT_PDF_FILES) # Inkscape can't process files in parallel, it has to be sequential: .NOTPARALLEL: covers