Makefile 6.24 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
#----------------------------------------------------------------------------
#
# Makefile
#	Postgres documentation makefile
#	Thomas Lockhart
#
# Copyright (c) 1994, Regents of the University of California
#
#
# IDENTIFICATION
Peter Eisentraut's avatar
Peter Eisentraut committed
11
#    $Header: /cvsroot/pgsql/doc/src/sgml/Makefile,v 1.44 2001/11/16 16:29:56 petere Exp $
12 13
#
#----------------------------------------------------------------------------
14

15 16
subdir = doc/src/sgml
top_builddir = ../../..
17
include $(top_builddir)/src/Makefile.global
18

19
.SECONDARY:
20
.NOTPARALLEL:
21

22
ifndef DOCBOOKSTYLE
23
DOCBOOKSTYLE = /home/projects/pgsql/developers/thomas/db162.d/docbook
24 25 26 27 28
endif

ifndef JADE
JADE = jade
endif
29
SGMLINCLUDE = -D $(srcdir) -D $(srcdir)/ref
30 31 32 33 34 35 36 37

ifndef NSGMLS
NSGMLS = nsgmls
endif

ifndef SGMLSPL
SGMLSPL = sgmlspl
endif
38

39 40 41
CONVERT = convert
EPSTOPDF = epstopdf

42

43 44
# docbook2man generates man pages from docbook refentry source code.

45 46
ifndef D2MDIR
# This is where the (patched) docbook2man perl scripts reside on hub.org.
47
D2MDIR= /home/users/t/thomas/d2x/docbook2man
48
endif
49 50
D2MSCRIPT= $(D2MDIR)/docbook2man-spec.pl

51
vpath %.sgml ./ref
52

53
ALLBOOKS = admin developer programmer reference tutorial user
54

55
ALLSGML := $(wildcard $(srcdir)/*.sgml $(srcdir)/ref/*.sgml) bookindex.sgml setindex.sgml
56

57
CATALOG = $(DOCBOOKSTYLE)/catalog
58 59


60 61 62
##
## Man pages
##
63

64
.PHONY: man
65

66
DEFAULTSECTION := $(sqlmansect_dummy)
67

68 69 70 71 72 73 74 75 76
man: $(ALLSGML)
	$(NSGMLS) $(NSGMLS_FLAGS) $(srcdir)/book-decl.sgml $(srcdir)/reference.sgml \
	  | $(SGMLSPL) $(D2MSCRIPT) --lowercase --section $(DEFAULTSECTION)
# One more time, to resolve cross-references
	$(NSGMLS) $(NSGMLS_FLAGS) $(srcdir)/book-decl.sgml $(srcdir)/reference.sgml \
	  | $(SGMLSPL) $(D2MSCRIPT) --lowercase --section $(DEFAULTSECTION)
	$(mkinstalldirs) man1 man$(DEFAULTSECTION)
	mv *.1 man1/
	mv *.$(DEFAULTSECTION) man$(DEFAULTSECTION)/
77

78 79 80 81 82

##
## HTML
##

83
JADE.html = $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) -c $(CATALOG) -d stylesheet.dsl -i output-html -t sgml
84

85
postgres.html: postgres.sgml $(ALLSGML) stylesheet.dsl
86
	@rm -f *.html
87
	$(JADE.html) $<
88
	ln -sf index.html $@
89

90
$(addsuffix .html, $(ALLBOOKS)): %.html: %.sgml $(ALLSGML) stylesheet.dsl
91
	@rm -f *.html
92
	$(JADE.html) book-decl.sgml $<
93 94 95
	ln -sf index.html $@

programmer.html: catalogs.gif connections.gif
96
postgres.html: catalogs.gif connections.gif
97

98

99 100 101 102 103 104 105 106 107 108 109 110 111 112
COLLATEINDEX = $(PERL) $(DOCBOOKSTYLE)/bin/collateindex.pl -f -g -t 'Index'

ifeq (,$(wildcard HTML.index))
bookindex.sgml:
	$(COLLATEINDEX) -o $@ -N
setindex.sgml:
	$(COLLATEINDEX) -x -o $@ -N
else
bookindex.sgml: HTML.index
	$(COLLATEINDEX) -i 'bookindex' -o $@ $<
setindex.sgml: HTML.index
	$(COLLATEINDEX) -i 'setindex' -x -o $@ $<
endif

113

114 115 116
##
## Print
##
117

118
# RTF to allow minor editing for hardcopy
119 120
$(addsuffix .rtf, $(ALLBOOKS)): %.rtf: %.sgml $(ALLSGML) stylesheet.dsl
	$(JADE) $(JADEFLAGS) $(SGMLINCLUDE) -c $(CATALOG) -d stylesheet.dsl -t rtf -V rtf-backend -i output-print book-decl.sgml $<
121

122 123 124 125 126 127
# TeX
# Regular TeX and pdfTeX have slightly differing requirements, so we
# need to distinguish the path we're taking.

$(addsuffix .tex-ps, $(ALLBOOKS)): %.tex-ps: %.sgml $(ALLSGML) stylesheet.dsl
	$(JADE) $(JADEFLAGS) $(SGMLINCLUDE) -c $(CATALOG) -d stylesheet.dsl -t tex -V tex-backend -i output-print -V texdvi-output -o $@ book-decl.sgml $<
128 129 130
# TeX transforms '--' into en-dashes.  This hack should go away when
# OpenJade is fixed (ver. 1.4?)
	$(PERL) -pi -e 's/\-\-/\\mbox{}-\\mbox{}-\\mbox{}/g' $@
131 132 133
	$(PERL) -pi -e 's/\<\</\\mbox{}<\\mbox{}<\\mbox{}/g' $@
	$(PERL) -pi -e 's/\>\>/\\mbox{}>\\mbox{}>\\mbox{}/g' $@
	$(PERL) -pi -e "s/\'\'/\\\\mbox{}'\\\\mbox{}'\\\\mbox{}/g" $@
134

135 136 137 138 139 140 141 142 143 144 145 146
programmer.tex-ps: catalogs.eps connections.eps

$(addsuffix .tex-pdf, $(ALLBOOKS)): %.tex-pdf: %.sgml $(ALLSGML) stylesheet.dsl
	$(JADE) $(JADEFLAGS) $(SGMLINCLUDE) -c $(CATALOG) -d stylesheet.dsl -t tex -V tex-backend -i output-print -V texpdf-output -o $@ book-decl.sgml $<
	$(PERL) -pi -e 's/\-\-/\\mbox{}-\\mbox{}-\\mbox{}/g' $@
	$(PERL) -pi -e 's/\<\</\\mbox{}<\\mbox{}<\\mbox{}/g' $@
	$(PERL) -pi -e 's/\>\>/\\mbox{}>\\mbox{}>\\mbox{}/g' $@
	$(PERL) -pi -e "s/\'\'/\\\\mbox{}'\\\\mbox{}'\\\\mbox{}/g" $@

programmer.tex-pdf: catalogs.pdf connections.pdf

%.dvi: %.tex-ps
Peter Eisentraut's avatar
Peter Eisentraut committed
147
	@rm -f $*.aux $*.log
148 149
	jadetex $<
	jadetex $<
150
	jadetex $<
151 152 153 154 155

# Postscript from TeX
%.ps: %.dvi
	dvips -o $@ $<

156
%.pdf: %.tex-pdf
Peter Eisentraut's avatar
Peter Eisentraut committed
157
	@rm -f $*.aux $*.log $*.out
158 159 160 161 162
	pdfjadetex $<
	pdfjadetex $<
	pdfjadetex $<


163 164 165 166 167 168 169
# This generates an XML version of the flow-object tree.  It's useful
# for debugging DSSSL code, and possibly to interface to some other
# tools that can make use of this.
$(addsuffix .fot, $(ALLBOOKS)): %.fot: %.sgml $(ALLSGML) stylesheet.dsl
	$(JADE) $(JADEFLAGS) $(SGMLINCLUDE) -c $(CATALOG) -d stylesheet.dsl -t fot -i output-print -o $@ book-decl.sgml $<


170 171 172
# Graphics

%.gif:
173
	cp $(srcdir)/../graphics/$@ .
174

175 176 177 178 179 180
%.eps: %.gif
	$(CONVERT) $< eps:$@

%.pdf: %.eps
	$(EPSTOPDF) $<

181

182 183 184
##
## Semi-automatic generation of some text files.
##
185

186
JADE.text = $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) -c $(CATALOG) -d stylesheet.dsl -i output-text -t sgml
187

188
INSTALL HISTORY regress_README: % : %.html
189
	@echo "|";\
190 191
	 echo "| You should now take '$<', save it as a text file in Netscape,";\
	 echo "| and put it in place of the existing '$@' file.";\
192 193
	 echo "|"

194 195
INSTALL.html: standalone-install.sgml installation.sgml
	$(JADE.text) -V nochunks $+ >$@
196

197 198 199 200 201
HISTORY.html: release.sgml
	( echo '<!doctype appendix PUBLIC "-//OASIS//DTD DocBook V3.1//EN">'; \
	  cat $< ) >tempfile_HISTORY.sgml
	$(JADE.text) -V nochunks tempfile_HISTORY.sgml >$@
	rm tempfile_HISTORY.sgml
202

203 204 205 206 207 208 209
regress_README.html: regress.sgml
	( echo '<!doctype chapter PUBLIC "-//OASIS//DTD DocBook V3.1//EN" ['; \
	  echo '<!entity % standalone-ignore "IGNORE"> ]>'; \
	  cat $< ) >tempfile_regress_README.sgml
	$(JADE.text) -V nochunks tempfile_regress_README.sgml >$@
	rm tempfile_regress_README.sgml

210 211 212 213 214

##
## Check
##

215
check: $(addprefix check-, $(ALLBOOKS)) check-postgres
216 217

# Quick syntax check without style processing
218 219 220 221
$(addprefix check-, $(ALLBOOKS)): check-%: %.sgml
	$(NSGMLS) $(SGMLINCLUDE) -s book-decl.sgml $<

check-postgres: postgres.sgml
222 223 224 225 226 227 228 229 230
	$(NSGMLS) $(SGMLINCLUDE) -s $<


##
## Clean
##

clean distclean maintainer-clean:
# HTML
231
	rm -f HTML.manifest *.html *.gif
232
# man
233
	rm -rf *.1 *.$(DEFAULTSECTION) man1 man$(DEFAULTSECTION) manpage.refs manpage.links manpage.log
234
# print
235
	rm -f *.rtf *.tex-ps *.tex-pdf *.dvi *.aux *.log *.ps *.pdf *.out *.eps *.fot
236 237
# index
	rm -f HTML.index bookindex.sgml setindex.sgml