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.
This commit is contained in:
Simon Howard 2025-06-02 23:21:46 -04:00
parent 398a7c01f4
commit 9979dacb09

View file

@ -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