#!/bin/make

# fuer die Dissertation
# 09-Aug-2002: prepare, reproduce exact pages
# 09-Apr-2002, Georg Fischer

all: prep1 prep2 combine

prep1:
	sed -n "2,36p" orig/da0.cc >  da01tit.cc
	cp                       orig/da02abs.ca .
	sed -n -e "57,$$$$p" orig/da0.cc > da03ack.ca
	sed "1,1s/.*/1/" orig/da42.ca    > da42.ca
	cat er120.ca orig/extra0.ca \
	| sed -n -e '1,10p' -e '20,$$p' > da120.ca
	echo "277a\\" >  ed434.tmp
	echo " "   >> ed434.tmp
	sed -f ed434.tmp orig/da434.ca  > da434.ca

prep2: filelist
	echo   > toc.htm
	echo   > ref.htm
	echo '<hr />' > hr.tmp
	perl surecr.pl filelist.tmp > diss.tmp
combine:
	echo 1 > page.tmp
	perl arbeit.pl da01tit.cc > tit.htm
	perl arbeit.pl diss.tmp   > diss.htm
	sed -n -e "7,$$$$p" toc.htm > toc2.htm
	csplit --prefix=dis diss.htm '/          103/'
	  # creates dis00, dis01
	sed -n -e "2,$$$$p" dis01 > toc1.htm
	cat ind0.htm tit.htm hr.tmp toc1.htm toc2.htm hr.tmp \
	  dis00 ind9.htm > diss.html
#	ref.htm is the complet list of algorithms
filelist:
	ls -1 da*.ca | sed "s/\.ca$$//" | sort  > filelist.tmp

#-------------------------
run:	filelist.tmp
	echo   > cr.tmp
	echo 0 > page.tmp
	rm -f da*.html
	cat ind0.htm  > index.htm
	sed 's/$$/.html/' filelist.tmp | xargs -l -iq make q
	cat ind9.htm >> diss.htm

rename:
	perl ren.pl -f
	rm *.bak *.tmp

show:	filelist.tmp
	cat filelist.tmp | xargs -l -iq less q.ca


s1:
	sed -e '1a\
	test' da42.ca | less
col1:
	grep -E "^[^ 12467]" d* e*
col2:
	grep -E "^2" d* e*
ref:
	grep -E "\d(\.\d)*\-\d" diss.tmp

