Commit 41017efddd9db456343c336ad0eb2bc492db9741

Steffen Jaeckel 2014-09-28T14:10:59

deterministic build of bn.pdf

diff --git a/makefile b/makefile
index 6ef47b7..f7a7c82 100644
--- a/makefile
+++ b/makefile
@@ -163,6 +163,15 @@ docs:   docdvi
 
 #LTM user manual
 mandvi: bn.tex
+	cp bn.tex bn.bak
+	touch --reference=bn.tex bn.bak
+	(printf "%s" "\def\fixedpdfdate{"; date +'D:%Y%m%d%H%M%S%:z' -d @$$(stat --format=%Y bn.tex) | sed "s/:\([0-9][0-9]\)$$/'\1'}/g") > bn-deterministic.tex
+	printf "%s\n" "\pdfinfo{" >> bn-deterministic.tex
+	printf "%s\n" "  /CreationDate (\fixedpdfdate)" >> bn-deterministic.tex
+	printf "%s\n}\n" "  /ModDate (\fixedpdfdate)" >> bn-deterministic.tex
+	cat bn.tex >> bn-deterministic.tex
+	mv bn-deterministic.tex bn.tex
+	touch --reference=bn.bak bn.tex
 	echo "hello" > bn.ind
 	latex bn > /dev/null
 	latex bn > /dev/null
@@ -172,6 +181,8 @@ mandvi: bn.tex
 #LTM user manual [pdf]
 manual:	mandvi
 	pdflatex bn >/dev/null
+	sed -b -i 's,^/ID \[.*\]$$,/ID [<0> <0>],g' bn.pdf
+	mv bn.bak bn.tex
 	rm -f bn.aux bn.dvi bn.log bn.idx bn.lof bn.out bn.toc
 
 pretty: