Skip to content

Commit f3a7068

Browse files
committed
Build SGML documention output several times if necessary to have proper
indexes; add 'draft' option to disable it.
1 parent 0764f41 commit f3a7068

File tree

2 files changed

+47
-17
lines changed

2 files changed

+47
-17
lines changed

doc/src/sgml/Makefile

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# PostgreSQL documentation makefile
44
#
5-
# $PostgreSQL: pgsql/doc/src/sgml/Makefile,v 1.87 2007/01/07 08:49:31 petere Exp $
5+
# $PostgreSQL: pgsql/doc/src/sgml/Makefile,v 1.88 2007/01/09 22:19:36 momjian Exp $
66
#
77
#----------------------------------------------------------------------------
88

@@ -65,7 +65,7 @@ override SPFLAGS += -wall -wno-unused-param -wno-empty
6565
## Man pages
6666
##
6767

68-
.PHONY: man
68+
.PHONY: man draft
6969

7070
DEFAULTSECTION := $(sqlmansect_dummy)
7171

@@ -95,21 +95,38 @@ html: postgres.sgml $(ALLSGML) stylesheet.dsl
9595
ifeq ($(vpath_build), yes)
9696
@cp $(srcdir)/stylesheet.css .
9797
endif
98+
ifndef DRAFT
99+
@cmp -s HTML.index.start HTML.index || $(MAKE) $*
100+
endif
98101

99102

100103
COLLATEINDEX := LC_ALL=C $(PERL) $(COLLATEINDEX) -f -g
101104

102-
# If HTML.index does not exist, create a dummy bookindex.sgml. During the
103-
# next build, create bookindex.sgml with the proper index contents. A proper
104-
# bookindex.sgml is required to have an index in the output.
105-
ifeq (,$(wildcard HTML.index))
106-
bookindex.sgml:
107-
$(COLLATEINDEX) -o $@ -N
105+
draft:
106+
ifndef DRAFT
107+
ifneq ($(MAKECMDGOALS), draft)
108+
# Call ourselves with the DRAFT value set. This seems to be the only
109+
# way to set gmake variables in a rule.
110+
@$(MAKE) DRAFT="Y" $(MAKECMDGOALS))
108111
else
109-
bookindex.sgml: HTML.index
110-
$(COLLATEINDEX) -i 'bookindex' -o $@ $<
112+
# run default 'all' rule
113+
@$(MAKE) DRAFT="Y" all
114+
endif
111115
endif
112116

117+
bookindex.sgml: HTML.index
118+
# create a dummy bookindex.html
119+
test -s HTML.index || $(COLLATEINDEX) -o $@ -N
120+
# If HTML.index is valid, create a valid bookindex.sgml. This
121+
# is required so the output has a proper index.
122+
test ! -s HTML.index || $(COLLATEINDEX) -i 'bookindex' -o $@ $<
123+
# save copy of HTML.index for later comparison
124+
@cp HTML.index HTML.index.start
125+
126+
HTML.index:
127+
# create HTML.index if it does not exist
128+
@$(if $(wildcard HTML.index), , touch HTML.index)
129+
113130
version.sgml: $(top_builddir)/src/Makefile.global
114131
{ \
115132
echo "<!entity version \"$(VERSION)\">"; \
@@ -141,15 +158,27 @@ JADE.tex.call = $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d $(srcdir)/styl
141158

142159
%-A4.tex-ps: %.sgml $(ALLSGML) stylesheet.dsl bookindex.sgml
143160
$(JADE.tex.call) -V texdvi-output -V '%paper-type%'=A4 -o $@ $<
161+
ifndef DRAFT
162+
@cmp -s HTML.index.start HTML.index || $(MAKE) $*
163+
endif
144164

145165
%-US.tex-ps: %.sgml $(ALLSGML) stylesheet.dsl bookindex.sgml
146166
$(JADE.tex.call) -V texdvi-output -V '%paper-type%'=USletter -o $@ $<
167+
ifndef DRAFT
168+
@cmp -s HTML.index.start HTML.index || $(MAKE) $*
169+
endif
147170

148171
%-A4.tex-pdf: %.sgml $(ALLSGML) stylesheet.dsl bookindex.sgml
149172
$(JADE.tex.call) -V texpdf-output -V '%paper-type%'=A4 -o $@ $<
173+
ifndef DRAFT
174+
@cmp -s HTML.index.start HTML.index || $(MAKE) $*
175+
endif
150176

151177
%-US.tex-pdf: %.sgml $(ALLSGML) stylesheet.dsl bookindex.sgml
152178
$(JADE.tex.call) -V texpdf-output -V '%paper-type%'=USletter -o $@ $<
179+
ifndef DRAFT
180+
@cmp -s HTML.index.start HTML.index || $(MAKE) $*
181+
endif
153182

154183
%.dvi: %.tex-ps
155184
@rm -f $*.aux $*.log
@@ -291,7 +320,7 @@ clean distclean maintainer-clean:
291320
# print
292321
rm -f *.rtf *.tex-ps *.tex-pdf *.dvi *.aux *.log *.ps *.pdf *.out *.eps *.fot
293322
# index
294-
rm -f HTML.index $(GENERATED_SGML)
323+
rm -f HTML.index HTML.index.start $(GENERATED_SGML)
295324
# text
296325
rm -f INSTALL HISTORY regress_README
297326
# XSLT

doc/src/sgml/docguide.sgml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/docguide.sgml,v 1.63 2006/12/15 16:50:07 momjian Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/docguide.sgml,v 1.64 2007/01/09 22:19:36 momjian Exp $ -->
22

33
<appendix id="docguide">
44
<title>Documentation</title>
@@ -542,11 +542,12 @@ checking for sgmlspl... sgmlspl
542542
</para>
543543

544544
<para>
545-
When the HTML documentation is built, the process also generates
546-
the linking information for the index entries. Thus, if you want
547-
your documentation to have a concept index at the end, you need to
548-
build the HTML documentation once, and then build the
549-
documentation again in whatever format you like.
545+
To create a proper index, the build might process several identical
546+
stages. If you do not care about an index, and just want to
547+
proof-read the output, use <literal>draft</>:
548+
<screen>
549+
<prompt>doc/src/sgml$ </prompt><userinput>gmake draft html</userinput>
550+
</screen>
550551
</para>
551552

552553
<para>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy