diff makefile @ 79:f3c95ee96cc4

Moved TOC from end to beginning; extended makefile. The TOC generation concept and idea was inspired by the book ``UNIX Text Processing''.
author markus schnalke <meillo@marmaro.de>
date Wed, 06 Jun 2012 10:56:14 +0200
parents 3e70450336a4
children e6f95015ba61
line wrap: on
line diff
--- a/makefile	Tue Jun 05 22:24:10 2012 +0200
+++ b/makefile	Wed Jun 06 10:56:14 2012 +0200
@@ -1,13 +1,23 @@
 NAME = thesis
-CHAPS = style front.roff dedication.roff abstract.roff preface.roff \
-	ch*.roff refs.roff toc.roff
+CHAPS = style front.roff dedication.roff abstract.roff toc.roff \
+	preface.roff ch*.roff refs.roff
 PDFFLAGS = -sPAPERSIZE=a4 -dPDFSETTINGS=/prepress
 
 all: $(NAME).ps
 
 $(NAME).ps: $(CHAPS) makefile bib
 	export TROFFONTS=fonts REFER=bib;\
-	cat $(CHAPS) | refer -e -P -sLAD -l,2 -k | troff -Tps -ms | dpost >$@
+	cat $(CHAPS) | refer -e -P -sLAD -l,2 -k | \
+		troff -Tps -ms 2>err.ig | dpost >$@
+
+err.ig: $(CHAPS)
+	export TROFFONTS=fonts REFER=bib;\
+	cat $(CHAPS) | refer -e -P -sLAD -l,2 -k | \
+		troff -Tps -ms -rZ1 -z 2>$@
+
+toc.roff: toc.ig
+toc.ig: err.ig
+	sed -n '/^TOC____/s///p' $< >$@
 
 pdf: $(NAME).pdf
 $(NAME).pdf: $(NAME).ps
@@ -21,4 +31,4 @@
 
 clean:
 	rm -f $(NAME).ps $(NAME).pdf book.ps book.pdf
-	rm -f bib.ig
+	rm -f *.ig