scripts_dest = @scripts_dest@
lib_dest     = @lib_dest@
config_dest  = @config_dest@
doc_dest     = @doc_dest@

#  This is slightly bad, but I don't want to introduce a new variable just
#  for manpages.  Assume manpages go in a sibling directory to doc_dest,
#  eg if doc_dest =     /usr/local/doc/yard-2.0, 
#        manfile_dest = /usr/local/man/man8
manfile_dest = $(doc_dest)/../../man/man8

LATEX = @LATEX@
DVIPS = @DVIPS@
GZIP  = @GZIP@
SGML2LATEX = @SGML2LATEX@
SGML2TXT   = @SGML2TXT@
SGML2HTML  = @SGML2HTML@
CP = @CP@
LN = @LN@
RM = @RM@
INSTALL      = @INSTALL@
INSTALL_DATA = @INSTALL@ -m 644

.SUFFIXES:	.dvi .ps .sgml
.PHONY:	clean docs install-info

MANPAGES = make_root_fs.8 check_root_fs.8 write_rescue_disk.8 \
	  create_loopback_file.8 conf_yard.8

%.ps: %.dvi
	$(DVIPS) $< -o $@

%.dvi: %.sgml
	$(SGML2LATEX) $*

%.txt: %.sgml
	$(SGML2TXT) --filter $*

%.man: %.sgml
	$(SGML2TXT) --manpage --filter $*

%.info: %.sgml
	$(SGML2INFO) $*

%.html: %.sgml
	$(SGML2HTML) $*

#docs:	Yard_doc.txt Yard_doc.ps Yard_doc.html
#	$(GZIP) -f Yard_doc.ps

docs:
	@echo Yard documentation has not been updated.
	@echo Nothing to be done.

man:	yard.8

install:
	$(INSTALL) --directory $(doc_dest) $(manfile_dest)
	$(INSTALL) --directory $(doc_dest)/html
	$(INSTALL) --mode=444 *.html $(doc_dest)/html
	$(INSTALL) --mode=444 Yard_doc.ps.gz $(doc_dest)
	$(INSTALL) --mode=444 Yard_doc.txt $(doc_dest)
	$(INSTALL) --mode=444 yard.8 $(manfile_dest)
	
	cd $(manfile_dest) ; gzip -9 yard.8 
	cd $(manfile_dest) ; for i in $(MANPAGES); do \
		$(LN) -sf yard.8.gz ./$$i.gz; \
	done

clean:
	$(RM) -f *.log *~ *.~ .*~ *.*.~ *.OLD *.ls \#* *.bak
	$(RM) -f *.dvi *.log *.aux *.toc *.[1-9] *.man *.tex
