# While this makefile works, it is intended more as guidance in
# formatting the documents than as an absolute method. 
# Caveats:
# 	For things like TeX documents, you may need to run lt twice
# to get indexes and suchlike straight.
# 	You have to manually edit the TeX file and specify
# the \documentstyle to be dvidoc if you want a .doc, or something
# else for a .ps.
#	For troff documents that use pic/grap/tbl/eqn/psfig, you'll have
# to setup specific subsidiary lines - see those for c-news or ihstyle
# as examples.
#
# 	- moraes, Feb 20

# Some Make rules for processing documents

.SUFFIXES: .ms .me .man .mm .mX .ps .doc .tex .dvi

.ms.doc:
	rm -f $*.doc
	nroff -ms $*.ms > $*.doc

.me.doc:
	rm -f $*.doc
	nroff -me $*.me > $*.doc

.man.doc:
	rm -f $*.doc
	nroff -man $*.man > $*.doc

.mm.doc:
	rm -f $*.doc
	nroff -mm $*.mm > $*.doc

.mX.doc:
	rm -f $*.doc
	nroff -mX $*.mX > $*.doc

.tex.dvi:
	rm -f $*.dvi
	lt $*

.dvi.doc:
	rm -f $*.doc
	dvidoc $* > $*.doc

.dvi.ps:
	rm -f $*.ps
	dvi2ps $* > $*.ps

.ms.ps:
	rm -f $*.ps
	psroff -t -ms $*.ms > $*.ps

.me.ps:
	rm -f $*.ps
	psroff -t -me $*.me > $*.ps

.man.ps:
	rm -f $*.ps
	psroff -t -man $*.man > $*.ps

.mm.ps:
	rm -f $*.ps
	psroff -t -mm $*.mm > $*.ps

.mX.ps:
	rm -f $*.ps
	psroff -t -mX $*.mX > $*.ps

# The list of documents
DOCS=ihstyle.doc c-news.doc steal.doc pikestyle.doc \
	setuid.doc

PS=${DOCS:.doc=.ps}

doc: $(DOCS)

ps: $(PS)

tcpip-cookbook.ps: tcpip-cookbook.dvi

tcpip-cookbook.doc: tcpip-cookbook.dvi

ihstyle.ms: ihstyle.tbl.ms
	tbl ihstyle.tbl.ms > ihstyle.ms

c-news.ms: c-news.tbl.ms
	tbl c-news.tbl.ms > c-news.ms

clean:
	rm -f *.dvi *.toc *.aux *.log *.bak *.CKP *.BAK \#* *~ \
		ihstyle.ms c-news.ms

veryclean:
	rm -f *.ps *.doc
