WWW =	nwf.ps nwf.html nwf_toc.html nwf.txt

###########################################################################

all: nwf.info nwf.dvi nwf.ps nwf.html nwf.txt 

#####

nwf.dvi: nwf.ti pic1.eps pic2.eps
	texi2dvi nwf.ti

nwf.info: nwf.ti
	makeinfo nwf.ti

nwf.html: nwf.ti Makefile pic1.txt pic1_txt.txt pic2.txt pic2_txt.txt
	-rm -fr nwf.html nwf_toc.html
	ln -fs nwf.ti nwf
	./texi2html -verbose nwf
	( echo '<A NAME="pic1"><pre>';cat pic1.txt;echo '</pre>' ) >pic1.html
	( echo '<A NAME="pic2"><pre>';cat pic2.txt;echo '</pre>' ) >pic2.html
	sed -e '/@paragraphindent/d' \
	    -e '/@bigskip/d' \
	    -e '/@parindent/d' nwf.html \
	    -e '/@psfig{figure=pic1.eps/r pic1.html' \
	    -e '/@psfig{figure=pic1.eps/d' \
	    -e '/@psfig{figure=pic2.eps/r pic2.html' \
	    -e '/@psfig{figure=pic2.eps/d' \
	    -e 's/\*\*\*Picture 1/<A HREF="#pic1">Picture 1<\/A>/g' \
	    -e 's/\*\*\*picture 1/<A HREF="#pic1">picture 1<\/A>/g' >xxx
	mv xxx nwf.html
	sed -e 's/{}//g' nwf_toc.html >xxx
	mv xxx nwf_toc.html
	rm nwf

nwf.ps: nwf.dvi
	dvips nwf.dvi

nwf.txt: nwf.info
	egrep -vh '^File:.*Node:' *.info-* >xxx
	egrep -v '^.$$' xxx >nwf.txt
	rm xxx

#####

pic1.txt pic1_txt.txt pic2.txt pic2_txt.txt: nwf.ti
	./cutout nwf.ti

pic1.eps: pic1.fig 
	fig2dev -L ps pic1.fig >pic1.eps
				
pic2.eps: pic2.fig 		
	fig2dev -L ps pic2.fig >pic2.eps

#####

show: nwf.dvi
	xdvi -nogrey -s 4 -copy nwf.dvi

WWW-update: all
	-rsh dusk -l hubert 'cd ~/www/NetBSD/NWF ; rm $(WWW)'
	tar cf - $(WWW) | rsh dusk -l hubert tar vvxCf '~/www/NetBSD/NWF' -

###

clean:
	-rm nwf.aux nwf.cp nwf.fn nwf.ky nwf.log nwf.pg
	-rm nwf.toc nwf.tp nwf.vr xxx
	-rm pic1.html pic2.html
	-rm pic1.eps pic2.eps
	-rm pic1.txt pic2.txt
	-rm nwf.dvi

###

veryclean: clean
	-rm nwf.dvi
	-rm nwf.info*
	-rm -fr nwf.html nwf_toc.html
	-rm nwf.ps
	-rm nwf.txt

###

backup:
	cd .. ; $(HOME)/bin/gtar zvcf NWF.tar.gz NWF
