# Makefile for ~lp/html/glossary

DIR = glossary

.SUFFIXES: .html .tex

.tex.html: 
	sed -f ../tex2html $*.tex | sed -f ../tex2html > $*.html

all: files

again:
	make clean Makefile 
	make all

Makefile: clean 
	mv Makefile Makefile.bak
	/bin/rm -f Index.html *.tex
	ln -s ../../help/${DIR}/*.tex .
	grep -v '^files:' Makefile.bak > Makefile
	echo '<pre>' > Index.html
	for i in `ls *.tex | sed "s/.tex/.html/"`;		\
	    do echo files: $$i >> Makefile;			\
	       echo "<a href=\"$$i\">$$i</a>" >> Index.html;	\
	    done
	echo '</pre>' >> Index.html

xref:
	cat *.html						\
	  | tr '>' '\012' 					\
          | sed -n '/.*<a href="\([^"]*\)"/s//\1/p' 		\
          | sort -u						\
	  > tmp
	for j in `grep -v \# tmp`;				\
	    do if test -s $$j;					\
	       then true;					\
	       else echo $$j; 					\
	       fi;						\
	    done
	sed -n '/\(.*\)\#\(.*\)/s//if ( ! { grep -s name=\\"\2\\" \1 } ) echo \1	\2/p' tmp > tmp1
	csh -f tmp1

tidy:
	@/bin/rm -f *~ *.bak *.tex tmp tmp1

clean: tidy
	@/bin/rm -f *.html *.tex

files: accessible.html
files: capture.html
files: confluent.html
files: conservative.html
files: convergent.html
files: prenex.html
files: skolem.html
files: substitution.html
files: terminate.html
