PARENT =
MODULE = doc
RCSDIR=$(BASELINE)/$(PARENT)/$(MODULE)/RCS
PATHTOROOT=../src

MAN = install.man makews.man Makefiles.man source.man
MANPS = install.ps makews.ps Makefiles.ps source.ps
LONG = arch_overview.3.0.me sm3doc.me sm3docdiff.me using3.0.me
LONGPS = arch_overview.3.0.ps sm3doc.ps sm3docdiff.ps using3.0.ps

.SUFFIXES: .me .man .troff .ascii .spell .ps .xproof .ghostview .print .co .ci

ALL = $(LONG) $(MAN)
LOCALRCSFILES = README $(ALL) 

ALLPS = $(LONGPS) $(MANPS)

default:  allps
allps: $(ALLPS)

clean:
	rm *.troff  *.ascii *.ps 

ci:
	-for i in `echo $(ALL)`;\
		do ci $(LOCK) $(RCSDIR)/$$i,v; done;
co:
	-for i in `echo $(ALL)`;\
		do co $(LOCK) $(RCSDIR)/$$i,v; done;

.me.ci:
	ci $(LOCK) $*.me
.man.ci:
	ci $(LOCK) $*.man

.me.co:
	co $(LOCK) $*.me
.man.co:
	co $(LOCK) $*.man

.me.troff: 
	ditroff -me  -mpsfig -grn  -tbl -eqn -t  $*.me > $*.troff 

.man.troff: 
	ditroff -man  -tbl -eqn -t  $*.man > $*.troff 

.me.ascii:
	soelim $*.me | tbl | nroff -me | sed -e '1,$$s/.//g' > $*.ascii

.man.ascii: 
	soelim $*.man | tbl | nroff -man | sed -e '1,$$s/.//g' > $*.ascii

.me.spell:
	cat local_words | uniq -q > junk; mv junk local_words
	spell +local_words $*.me > junk
	echo misspelled words are in junk
	echo check them out, then run \"make newlist\"

newlist:
	cat local_words junk | uniq -q > /tmp/$$; mv /tmp/$$ local_words; rm junk

#
.troff.ps:
	psdit $*.troff > $*.ps

.troff.xproof:
	xproof $*.troff 

#
.ps.ghostview:
	ghostview $*.ps

.ps.print:
	lpr -P$(PRINTER) $*.ps
#

.man.ps:
	$(MAKE) $*.troff
	psdit $*.troff > $*.ps

.me.ps:
	$(MAKE) $*.troff
	psdit $*.troff > $*.ps

#
.me.xproof:
	$(MAKE) $*.troff
	xproof $*.troff

.man.xproof:
	$(MAKE) $*.troff
	xproof $*.troff

.me.print:
	$(MAKE) $*.ps
	lpr -P$(PRINTER) $*.ps

.man.print:
	$(MAKE) $*.ps
	lpr -P$(PRINTER) $*.ps

.me.ghostview:
	$(MAKE) $*.ps
	ghostview $*.ps

.man.ghostview:
	$(MAKE) $*.ps
	ghostview $*.ps


source_release: 
	-chmod +w *.ps
	$(MAKE) allps
	@rm -f *.troff *.ascii
	$(MAKE) install.ascii sm3doc.ascii
	chmod -w *.ps *.ascii

include $(PATHTOROOT)/makefile.common
