From 878376560664c1ab5eae6e781183c98a9596a3cc Mon Sep 17 00:00:00 2001
From: Mark Wooding <mdw@distorted.org.uk>
Date: Mon, 5 Aug 2019 14:27:50 +0100
Subject: [PATCH] doc/Makefile.am, doc/sod.tex: Include package version on
 title page.

Maybe this should be in the running header or footer, but I'm not quite
sure where.
---
 doc/Makefile.am | 11 ++++++++---
 doc/sod.tex     |  1 +
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/doc/Makefile.am b/doc/Makefile.am
index 5882527..5f090d8 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -34,6 +34,11 @@ EXTRA_DIST		+= $(TEX_FILES)
 TEXFLAGS		 = --interaction=nonstopmode \
 				--output-directory=$(abs_builddir)
 
+run_pdflatex		 = cd $(srcdir) && \
+	pdflatex $(TEXFLAGS) \
+		--jobname=$(basename $1) \
+		'\def\pkgversion{$(VERSION)}\input{$1}'
+
 ###--------------------------------------------------------------------------
 ### The manual.
 
@@ -74,10 +79,10 @@ MAINTAINERCLEANFILES	+= sod.pdf
 EXTRA_DIST		+= sod.pdf
 doc_DATA		+= sod.pdf
 sod.pdf: $(TEX_FILES)
-	cd $(srcdir) && pdflatex $(TEXFLAGS) sod.tex
+	$(call run_pdflatex,sod.tex)
 	bibtex sod.aux
-	cd $(srcdir) && pdflatex $(TEXFLAGS) sod.tex
+	$(call run_pdflatex,sod.tex)
 	makeindex sod.idx
-	cd $(srcdir) && pdflatex $(TEXFLAGS) sod.tex
+	$(call run_pdflatex,sod.tex)
 
 ###----- That's all, folks --------------------------------------------------
diff --git a/doc/sod.tex b/doc/sod.tex
index e140c1f..1203b68 100644
--- a/doc/sod.tex
+++ b/doc/sod.tex
@@ -55,6 +55,7 @@
 
 \title{A Sensible Object Design for C}
 \author{Mark Wooding}
+\date{\today; version \pkgversion}
 
 \begin{document}
 
-- 
2.11.0

