# $Header: /home/jaguar/u0/vern/bro/bro-doc/RCS/Makefile,v 1.16 2002/11/16 01:26:03 vern Exp vern $

MAKEINDEX = makeindex/src/makeindex

SRCS =	\
	analysis_.tex \
	bib.tex \
	doc.tex \
	index.tex \
	intro.tex \
	predefined_.tex \
	started_.tex \
	todo_.tex \
	stmts_.tex \
	values_.tex \
	vars_.tex

doc.dvi: $(SRCS)
	latex doc.tex

doc.ps: doc.dvi
	dvips doc.dvi >doc.ps

doc.html: doc.dvi
	@mv doc.aux doc.aux.HOLD
	hevea doc
	@mv doc.aux.HOLD doc.aux

analysis_.tex: analysis.tex munge-unders
	@rm -f analysis_.tex
	./munge-unders <analysis.tex >analysis_.tex
	chmod 444 analysis_.tex

predefined_.tex: predefined.tex munge-unders
	@rm -f predefined_.tex
	./munge-unders <predefined.tex >predefined_.tex
	chmod 444 predefined_.tex

started_.tex: started.tex munge-unders
	@rm -f started_.tex
	./munge-unders <started.tex >started_.tex
	chmod 444 started_.tex

todo_.tex: todo.tex munge-unders
	@rm -f todo_.tex
	./munge-unders <todo.tex >todo_.tex
	chmod 444 todo_.tex

stmts_.tex: stmts.tex munge-unders
	@rm -f stmts_.tex
	./munge-unders <stmts.tex >stmts_.tex
	chmod 444 stmts_.tex

values_.tex: values.tex munge-unders
	@rm -f values_.tex
	./munge-unders <values.tex >values_.tex
	chmod 444 values_.tex

vars_.tex: vars.tex munge-unders
	@rm -f vars_.tex
	./munge-unders <vars.tex >vars_.tex
	chmod 444 vars_.tex

munge-unders: munge-unders.l
	flex munge-unders.l
	g++ -o munge-unders lex.yy.c

remake:
	-rm doc.dvi
	$(MAKE)

tar:
	@rm -f bro-doc bro-doc.tar.gz
	@ln -s . bro-doc
	tar cfz bro-doc.tar.gz \
		bro-doc/*[^_].tex bro-doc/munge-unders.l bro-doc/Makefile \
		bro-doc/doc.ind
	@rm -f bro-doc

html:
	@rm -rf doc-html doc-html.tex
	@ln -s doc.tex doc-html.tex
	./latex2html/bin/latex2html -split 4 -index_in_navigation doc-html
	# ./latex2html/bin/latex2html -split 0 -index_in_navigation doc-html

index:
	$(MAKEINDEX) doc
	@sed 's/\([^\\]\)_/\1\\_/g' <doc.ind >tmp.ind
	@mv tmp.ind doc.ind

clean:
	rm -f *_.tex munge-unders lex.yy.c \
		*.aux *.dvi *.idx *.ilg *.ind *.lof *.log *.lot *.ps *.toc \
		bro-doc.tar.gz
	touch doc.ind
