From ddddcf2e71e55796313d61661eb9666e9d52a5df Mon Sep 17 00:00:00 2001
From: Steffen Jaeckel <s@jaeckel.eu>
Date: Tue, 9 May 2017 14:01:11 +0200
Subject: [PATCH] move all documentation to doc/

---
 bn.tex => doc/bn.tex                  |   0
 doc/makefile                          |  69 ++++++++++++++++++++++++++
 {pics => doc/pics}/design_process.sxd | Bin
 {pics => doc/pics}/design_process.tif | Bin
 {pics => doc/pics}/expt_state.sxd     | Bin
 {pics => doc/pics}/expt_state.tif     | Bin
 {pics => doc/pics}/makefile           |   0
 {pics => doc/pics}/primality.tif      | Bin
 {pics => doc/pics}/radix.sxd          | Bin
 {pics => doc/pics}/sliding_window.sxd | Bin
 {pics => doc/pics}/sliding_window.tif | Bin
 makefile                              |  57 +--------------------
 12 files changed, 71 insertions(+), 55 deletions(-)
 rename bn.tex => doc/bn.tex (100%)
 create mode 100644 doc/makefile
 rename {pics => doc/pics}/design_process.sxd (100%)
 rename {pics => doc/pics}/design_process.tif (100%)
 rename {pics => doc/pics}/expt_state.sxd (100%)
 rename {pics => doc/pics}/expt_state.tif (100%)
 rename {pics => doc/pics}/makefile (100%)
 rename {pics => doc/pics}/primality.tif (100%)
 rename {pics => doc/pics}/radix.sxd (100%)
 rename {pics => doc/pics}/sliding_window.sxd (100%)
 rename {pics => doc/pics}/sliding_window.tif (100%)

diff --git a/bn.tex b/doc/bn.tex
similarity index 100%
rename from bn.tex
rename to doc/bn.tex
diff --git a/doc/makefile b/doc/makefile
new file mode 100644
index 0000000..fcc47c9
--- /dev/null
+++ b/doc/makefile
@@ -0,0 +1,69 @@
+ifeq ($V,1)
+silent_stdout=
+else
+silent_stdout= > /dev/null
+endif
+
+PLATFORM := $(shell uname | sed -e 's/_.*//')
+ifeq ($(PLATFORM), Darwin)
+err:
+	$(error Docs can't be built on Mac)
+
+docdvi poster docs mandvi manual: err
+endif
+
+# makes the LTM book DVI file, requires tetex, perl and makeindex [part of tetex I think]
+docdvi: tommath.src
+	cd pics ; MAKE=${MAKE} ${MAKE}
+	echo "hello" ${silent_stdout}
+	perl booker.pl
+	latex tommath ${silent_stdout}
+	latex tommath ${silent_stdout}
+	makeindex tommath
+	latex tommath ${silent_stdout}
+
+# poster, makes the single page PDF poster
+poster: poster.tex
+	cp poster.tex poster.bak
+	touch --reference=poster.tex poster.bak
+	(printf "%s" "\def\fixedpdfdate{"; date +'D:%Y%m%d%H%M%S%:z' -d @$$(stat --format=%Y poster.tex) | sed "s/:\([0-9][0-9]\)$$/'\1'}/g") > poster-deterministic.tex
+	printf "%s\n" "\pdfinfo{" >> poster-deterministic.tex
+	printf "%s\n" "  /CreationDate (\fixedpdfdate)" >> poster-deterministic.tex
+	printf "%s\n}\n" "  /ModDate (\fixedpdfdate)" >> poster-deterministic.tex
+	cat poster.tex >> poster-deterministic.tex
+	mv poster-deterministic.tex poster.tex
+	touch --reference=poster.bak poster.tex
+	pdflatex poster
+	sed -b -i 's,^/ID \[.*\]$$,/ID [<0> <0>],g' poster.pdf
+	mv poster.bak poster.tex
+	rm -f poster.aux poster.log poster.out
+
+# makes the LTM book PDF file, requires tetex, cleans up the LaTeX temp files
+docs: docdvi
+	dvipdf tommath
+	rm -f tommath.log tommath.aux tommath.dvi tommath.idx tommath.toc tommath.lof tommath.ind tommath.ilg
+	cd pics ; MAKE=${MAKE} ${MAKE} clean
+
+#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 ${silent_stdout}
+	latex bn ${silent_stdout}
+	makeindex bn
+	latex bn ${silent_stdout}
+
+#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
diff --git a/pics/design_process.sxd b/doc/pics/design_process.sxd
similarity index 100%
rename from pics/design_process.sxd
rename to doc/pics/design_process.sxd
diff --git a/pics/design_process.tif b/doc/pics/design_process.tif
similarity index 100%
rename from pics/design_process.tif
rename to doc/pics/design_process.tif
diff --git a/pics/expt_state.sxd b/doc/pics/expt_state.sxd
similarity index 100%
rename from pics/expt_state.sxd
rename to doc/pics/expt_state.sxd
diff --git a/pics/expt_state.tif b/doc/pics/expt_state.tif
similarity index 100%
rename from pics/expt_state.tif
rename to doc/pics/expt_state.tif
diff --git a/pics/makefile b/doc/pics/makefile
similarity index 100%
rename from pics/makefile
rename to doc/pics/makefile
diff --git a/pics/primality.tif b/doc/pics/primality.tif
similarity index 100%
rename from pics/primality.tif
rename to doc/pics/primality.tif
diff --git a/pics/radix.sxd b/doc/pics/radix.sxd
similarity index 100%
rename from pics/radix.sxd
rename to doc/pics/radix.sxd
diff --git a/pics/sliding_window.sxd b/doc/pics/sliding_window.sxd
similarity index 100%
rename from pics/sliding_window.sxd
rename to doc/pics/sliding_window.sxd
diff --git a/pics/sliding_window.tif b/doc/pics/sliding_window.tif
similarity index 100%
rename from pics/sliding_window.tif
rename to doc/pics/sliding_window.tif
diff --git a/makefile b/makefile
index 96578ee..3fd47d2 100644
--- a/makefile
+++ b/makefile
@@ -108,61 +108,8 @@ timing: $(LIBNAME)
 coveralls: coverage
 	cpp-coveralls
 
-# makes the LTM book DVI file, requires tetex, perl and makeindex [part of tetex I think]
-docdvi: tommath.src
-	cd pics ; MAKE=${MAKE} ${MAKE}
-	echo "hello" > tommath.ind
-	perl booker.pl
-	latex tommath > /dev/null
-	latex tommath > /dev/null
-	makeindex tommath
-	latex tommath > /dev/null
-
-# poster, makes the single page PDF poster
-poster: poster.tex
-	cp poster.tex poster.bak
-	touch --reference=poster.tex poster.bak
-	(printf "%s" "\def\fixedpdfdate{"; date +'D:%Y%m%d%H%M%S%:z' -d @$$(stat --format=%Y poster.tex) | sed "s/:\([0-9][0-9]\)$$/'\1'}/g") > poster-deterministic.tex
-	printf "%s\n" "\pdfinfo{" >> poster-deterministic.tex
-	printf "%s\n" "  /CreationDate (\fixedpdfdate)" >> poster-deterministic.tex
-	printf "%s\n}\n" "  /ModDate (\fixedpdfdate)" >> poster-deterministic.tex
-	cat poster.tex >> poster-deterministic.tex
-	mv poster-deterministic.tex poster.tex
-	touch --reference=poster.bak poster.tex
-	pdflatex poster
-	sed -b -i 's,^/ID \[.*\]$$,/ID [<0> <0>],g' poster.pdf
-	mv poster.bak poster.tex
-	rm -f poster.aux poster.log poster.out
-
-# makes the LTM book PDF file, requires tetex, cleans up the LaTeX temp files
-docs:   docdvi
-	dvipdf tommath
-	rm -f tommath.log tommath.aux tommath.dvi tommath.idx tommath.toc tommath.lof tommath.ind tommath.ilg
-	cd pics ; MAKE=${MAKE} ${MAKE} clean
-
-#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
-	makeindex bn
-	latex bn > /dev/null
-
-#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
+docdvi poster docs mandvi manual:
+	$(MAKE) -C doc/ $@ V=$(V)
 
 pretty:
 	perl pretty.build