Makefile 6.11 KB
Newer Older
1 2
#----------------------------------------------------------------------------
#
3
# PostgreSQL documentation makefile
4
#
5
# $PostgreSQL: pgsql/doc/src/sgml/Makefile,v 1.66 2004/03/02 00:03:02 tgl Exp $
6 7
#
#----------------------------------------------------------------------------
8

9 10
subdir = doc/src/sgml
top_builddir = ../../..
11
include $(top_builddir)/src/Makefile.global
12

13
.SECONDARY:
14
.NOTPARALLEL:
15

16 17
ifndef COLLATEINDEX
COLLATEINDEX = $(DOCBOOKSTYLE)/bin/collateindex.pl
18 19
endif

20 21 22
ifndef JADE
JADE = jade
endif
23
SGMLINCLUDE = -D $(srcdir)
24

Peter Eisentraut's avatar
Peter Eisentraut committed
25 26 27 28 29 30 31
# If this is a vpath build, some generated SGML will be in the build
# tree, so we need to make sure we look there as well as in the
# source tree
ifeq ($(vpath_build), yes)
SGMLINCLUDE += -D .
endif

32 33 34 35 36 37 38
ifndef NSGMLS
NSGMLS = nsgmls
endif

ifndef SGMLSPL
SGMLSPL = sgmlspl
endif
39

40 41 42
CONVERT = convert
EPSTOPDF = epstopdf

43 44 45
# docbook2man generates man pages from docbook refentry source code.
D2MSCRIPT= $(D2MDIR)/docbook2man-spec.pl

46

47
GENERATED_SGML = bookindex.sgml version.sgml \
48 49 50
	features-supported.sgml features-unsupported.sgml

ALLSGML := $(wildcard $(srcdir)/*.sgml $(srcdir)/ref/*.sgml) $(GENERATED_SGML)
51

52 53 54
ifdef DOCBOOKSTYLE
CATALOG = -c $(DOCBOOKSTYLE)/catalog
endif
55

56 57
# Enable draft mode during development
ifneq (,$(findstring devel, $(VERSION)))
58
override JADEFLAGS += -V draft-mode
59 60
endif

61 62
# Enable some extra warnings
override SPFLAGS += -wall -wno-unused-param -wno-empty
63

64 65 66
##
## Man pages
##
67

68
.PHONY: man
69

70
DEFAULTSECTION := $(sqlmansect_dummy)
71

72 73
man: postgres.sgml $(ALLSGML)
	$(NSGMLS) $(NSGMLS_FLAGS) $< | $(SGMLSPL) $(D2MSCRIPT) --lowercase --section $(DEFAULTSECTION) --date "`date '+%Y-%m-%d'`"
74
# One more time, to resolve cross-references
75
	$(NSGMLS) $(NSGMLS_FLAGS) $< | $(SGMLSPL) $(D2MSCRIPT) --lowercase --section $(DEFAULTSECTION) --date "`date '+%Y-%m-%d'`"
76 77 78
	$(mkinstalldirs) man1 man$(DEFAULTSECTION)
	mv *.1 man1/
	mv *.$(DEFAULTSECTION) man$(DEFAULTSECTION)/
79

80 81 82 83 84

##
## HTML
##

85
all: html
86

87
.PHONY: html
88

89
html: postgres.sgml $(ALLSGML) stylesheet.dsl
90
	@rm -f *.html
91
	$(JADE) $(JADEFLAGS) $(SPFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -i output-html -t sgml $<
Peter Eisentraut's avatar
Peter Eisentraut committed
92 93 94
ifeq ($(vpath_build), yes)
	@cp $(srcdir)/stylesheet.css .
endif
95 96


97
COLLATEINDEX := LC_ALL=C $(PERL) $(COLLATEINDEX) -f -g
98 99 100 101 102 103 104 105 106

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

107 108 109 110 111 112
version.sgml: $(top_builddir)/src/Makefile.global
	{ \
	  echo "<!entity version \"$(VERSION)\">"; \
	  echo "<!entity majorversion \"`expr $(VERSION) : '\([0-9][0-9]*\.[0-9][0-9]*\)'`\">"; \
	} >$@

113 114 115 116 117 118
features-supported.sgml: $(top_srcdir)/src/backend/catalog/sql_feature_packages.txt $(top_srcdir)/src/backend/catalog/sql_features.txt
	$(PERL) $(srcdir)/mk_feature_tables.pl YES $^ > $@

features-unsupported.sgml: $(top_srcdir)/src/backend/catalog/sql_feature_packages.txt $(top_srcdir)/src/backend/catalog/sql_features.txt
	$(PERL) $(srcdir)/mk_feature_tables.pl NO $^ > $@

119

120 121 122
##
## Print
##
123

124
# RTF to allow minor editing for hardcopy
125 126 127 128

%.rtf: %.sgml $(ALLSGML) stylesheet.dsl
	$(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -t rtf -V rtf-backend -i output-print $<

129 130 131 132
# TeX
# Regular TeX and pdfTeX have slightly differing requirements, so we
# need to distinguish the path we're taking.

133 134
%.tex-ps: %.sgml $(ALLSGML) stylesheet.dsl
	$(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -t tex -V tex-backend -i output-print -V texdvi-output -o $@ $<
135

136 137
%.tex-pdf: %.sgml $(ALLSGML) stylesheet.dsl
	$(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -t tex -V tex-backend -i output-print -V texpdf-output -o $@ $<
138 139

%.dvi: %.tex-ps
Peter Eisentraut's avatar
Peter Eisentraut committed
140
	@rm -f $*.aux $*.log
141 142
	jadetex $<
	jadetex $<
143
	jadetex $<
144 145 146 147 148

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

149
%.pdf: %.tex-pdf
Peter Eisentraut's avatar
Peter Eisentraut committed
150
	@rm -f $*.aux $*.log $*.out
151 152 153 154 155
	pdfjadetex $<
	pdfjadetex $<
	pdfjadetex $<


156 157 158
# 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.
159 160
%.fot: %.sgml $(ALLSGML) stylesheet.dsl
	$(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -t fot -i output-print -o $@ $<
161 162


163 164 165
# Graphics

%.gif:
166
	cp $(srcdir)/../graphics/$@ .
167

168 169 170 171 172 173
%.eps: %.gif
	$(CONVERT) $< eps:$@

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

174

175 176 177
##
## Semi-automatic generation of some text files.
##
178

179
JADE.text = $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -i output-text -t sgml
180
LYNX = lynx
181

182
INSTALL HISTORY regress_README: % : %.html
183
	$(PERL) -p -e 's/<H(1|2)$$/<H\1 align=center/g' $< | $(LYNX) -force_html -dump -nolist -stdin >$@
184

185 186
INSTALL.html: standalone-install.sgml installation.sgml version.sgml
	$(JADE.text) -V nochunks standalone-install.sgml installation.sgml >$@
187

188
HISTORY.html: release.sgml
189
	( echo '<!doctype appendix PUBLIC "-//OASIS//DTD DocBook V4.2//EN">'; \
190 191 192
	  cat $< ) >tempfile_HISTORY.sgml
	$(JADE.text) -V nochunks tempfile_HISTORY.sgml >$@
	rm tempfile_HISTORY.sgml
193

194
regress_README.html: regress.sgml
195
	( echo '<!doctype chapter PUBLIC "-//OASIS//DTD DocBook V4.2//EN" ['; \
196 197 198 199 200
	  echo '<!entity % standalone-ignore "IGNORE"> ]>'; \
	  cat $< ) >tempfile_regress_README.sgml
	$(JADE.text) -V nochunks tempfile_regress_README.sgml >$@
	rm tempfile_regress_README.sgml

201

202 203 204 205 206 207 208 209
##
## Experimental XML stuff
##

OSX = osx # (may be called sx or sgml2xml on some systems)
XSLTPROC = xsltproc

postgres.xml: postgres.sgml $(GENERATED_SGML)
210 211 212 213
	$(OSX) -x lower $< | \
	  sed -e 's/\[\(lt\|gt\|amp\|nbsp\|copy\|quot\|ouml\|uuml\|egrave\) *\]/\&\1;/g' \
	      -e '1a\' -e '<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">' \
	  >$@
214 215

testxml: stylesheet.xsl postgres.xml
216
	$(XSLTPROC) $(XSLTPROCFLAGS) --stringparam pg.version '$(VERSION)' $^
217 218


219 220 221 222 223
##
## Check
##

# Quick syntax check without style processing
224
check: postgres.sgml $(ALLSGML)
225
	$(NSGMLS) $(SPFLAGS) $(SGMLINCLUDE) -s $<
226 227 228 229 230 231 232 233


##
## Clean
##

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