C.4. The fundamental makefile: doc/sgml.mak

This is the makefile that calls our document-processing tools. All of the book makefiles call this with an include statement.

# -*-Makefile-*-
# makefile.sgml: rules for building sgml documentation
#
# Most of the targets in this makefile eventually call the
# doc/bin/cogsgml program to process the documents.
#

%.ps2: %.ps
	psnup -2 $< > $@

# Variables that identify stylesheets.
SS   = ../../config/cogent-both.dsl
ISS   = ../../config/index.dsl
CFG  = ../../config/jadetex.cfg
XHSS = ../../config/html-x.xsl

# Variables for Windows HTML Help parameters to be used by cogsgml.
WHSS = `sed -n '1p' winparms.txt`
WHNAME = `sed -n '2p' winparms.txt`
WHSTART = `sed -n '3p' winparms.txt`

validate:
	nsgmls -E20 -s main.sgml 2>&1 | sed -e s/^nsgmls://

all: html help dvi ps ps2 pdf rtf

.index:
	touch .index

.sgml: .index

.sgml: main.sgml
	touch .sgml

help: .help

.help : .sgml $(GIF) $(SS)
	@echo "Notes:"
	@echo "1) If you get any warnings about missing index*.sgml files"
	@echo "you should process the document one more time to get an index"
	@echo "file with the correct page numbers."
	@echo ""
	@echo "2) If you are processing a single book from the"
	@echo "Cogent Bookset, you can expect errors of the form:"
	@echo "jade:<filename>:reference to non-existent ID <link ID>"
	@echo "These can be ignored."
	@echo ""
	rm -f help/*.html help/*.toc help/*.gif help/*.txt
	cogsgml -help $(SS) main.sgml
	rm -f $@

help4:: .help4

.help4: help
	rm -rf help4
	mv help help4
	touch $@

help6::  .help6

.help6: help
	rm -rf help6
	mv help help6
	touch $@

html: .html

.html: .sgml
	@echo "Notes:"
	@echo "1) If you get any warnings about missing index*.sgml files"
	@echo "you should process the document one more time to get an index"
	@echo "file with the correct page numbers."
	@echo ""
	@echo "2) If you are processing a single book from the"
	@echo "Cogent Bookset, you can expect errors of the form:"
	@echo "jade:<filename>:reference to non-existent ID <link ID>"
	@echo "These can be ignored."
	@echo ""
	rm -f html/*.html html/*.gif
	cogsgml -hindex $(ISS) main.sgml
	cogsgml -html $(XHSS) main.sgml
	touch .html

winhelp: .winhelp

.winhelp: .sgml
	rm -f winhelp/*.html winhelp/*.gif winhelp/*.h winhelp/*.hh*
	cogsgml -winhelp $(WHSS) main.sgml ${WHNAME} ${WHSTART}
	touch .winhelp

# Note: this uses DSSSL, now no longer used.
html-s: .html-s

.html-s: .sgml $(GIF) $(SS)
	@echo "Notes:"
	@echo "1) If you get any warnings about missing index*.sgml files"
	@echo "you should process the document one more time to get an index"
	@echo "file with the correct page numbers."
	@echo ""
	@echo "2) If you are processing a single book from the"
	@echo "Cogent Bookset, you can expect errors of the form:"
	@echo "jade:<filename>:reference to non-existent ID <link ID>"
	@echo "These can be ignored."
	@echo ""
	rm -f html/*.html html/*.gif
	cogsgml -html-s $(SS) main.sgml
	touch .html-s

tex: .tex

.tex: .sgml
	@echo "Note:"
	@echo "You can ignore virtually all warnings. If the make"
	@echo "completes without errors the PDF file should be built."
	@echo ""
	cogsgml -tex $(SS) main.sgml
	touch .tex

pdf: .pdf 

.pdf: .tex
	cogsgml -hindex $(ISS) main.sgml
	cogsgml -pdf tex/main.tex $(CFG)
	touch .pdf

dvi: .dvi

.dvi: .tex
	cogsgml -dvi tex/main.tex
	touch .dvi

rtf: .rtf

.rtf: .sgml $(EPS) $(SS)
	cogsgml -rtf $(SS) main.sgml
	touch .rtf

ps: .ps

.ps: .dvi $(EPS)
	@mkdir -p ps
	dvips dvi/main.dvi -o ps/main.ps
	touch .ps

ps2: .ps2

.ps2: .ps
	psnup -pletter -2 ps/main.ps ps/main.ps2
	touch .ps2

clean:
	rm -f *~ *.log *.aux *.log

fresh:
	rm -f .sgml .html

empty: clean
	rm -f main.ps main.dvi main.tex main.rtf main.pdf
	rm -f *.gif *.pdf *.eps date.sgml index*.sgml 
	rm -rf html help dvi tex ps pdf
	rm -f .html .help .tex .ps .ps2 .dvi .pdf .rtf .articles 

.PHONY:	html help dvi tex ps pdf rtf