# Retep Documentation makefile
#
# This makefile contains the common docbook details, and is included by each
# of the subdirectories

# This should hold where the docbook style sheets are located
DOCBOOKHOME=/usr/local/lib

# documentation
HSTYLE= $(DOCBOOKHOME)/docbook/html
PSTYLE= $(DOCBOOKHOME)/docbook/print

# This is my extension dsl for html.
#To overide, define HDSL before importing GNUmakefile.global
ifeq ($(HDSL), )
HDSL=../retepHTML.dsl
endif
#HDSL=$(HSTYLE)/docbook.dsl

# This is my extension dsl for printing.
# For now, we use the default.
# To overide, define PDSL before importing GNUmakefile.global
ifeq ($(PDSL), )
PDSL=$(PSTYLE)/docbook.dsl
endif

# Options for DocBook style sheets

DBOPTS= -D ../global
#DBOPTS= -D ref -D ../graphics
#DBOPTS+= -V %no-split-output% -V %no-make-index%
# use-id-as-filename picks up the "Id=" fields to use as file names.
# If this is omitted then file names are generic "c01.htm"
#  as in v6.3 documentation. Yuck.
#DBOPTS+= -V %use-id-as-filename%

TAR= tar
ZIP= gzip
TAREXCLUDE= --exclude=Makefile --exclude='*.sgml' --exclude=ref

# Hmm, made this optional but jade _really_ doesn't like them missing
# - thomas 1998-03-01
ifneq ($(HDSL), )
HTMLOPTS= -d $(HDSL)
endif
ifneq ($(PDSL), )
PRINTOPTS= -d $(PDSL)
endif

# This forces the page background to be white
# (define %body
.PHONY: install all clean distclean

install::
#       $(MAKE) all
#       (mv -rf *.gz ..)

clean::
	rm -rf HTML.manifest *.html *.htm *.aux *.log *.tex *.dvi *.ps *.pdf *~

distclean::
	$(MAKE) clean

#
# Generic production rules
#

# Compressed file

%.gz:   %
	(gzip -f $<)

# TAR file for HTML package

%.tar:  %.html # %.ps
	($(TAR) cf $@ $*.html index.html *.htm *.gif) # $*.ps
	rm -rf index.html *.htm

# HTML
# Include some softlinks to the generic default file names

%.html: %.sgml #$(HDSL)
	rm -rf *.htm *.html
	jade $(DBOPTS) $(HTMLOPTS) -t sgml $<
#	ln -sf $*.htm index.html
#	ln -sf $*.htm $*.html

# RTF to allow minor editing for hardcopy
# This is used for v6.3 docs

%.rtf: %.sgml #$(PDSL)
	jade $(DBOPTS) $(PRINTOPTS) -t rtf $<

# TeX and DVI

%.tex: %.sgml #$(PDSL)
	jade $(DBOPTS) $(PRINTOPTS) -t tex $<

%.dvi: %.tex
	jadetex $<
	jadetex $<

# Postscript from TeX

%.ps: %.dvi
	dvips -o $@ $<

# Adobe PDF from Postscript

%pdf: %.ps
	pstoedit -f pdf $< $@

# Graphics

%.gif:
	cp -p ../graphics/$@ .

