Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ab39352

Browse files
committed
Run xmllint validation only once
Before, each documentation target that built something from postgres.sgml ran xmllint first to validate the input. Here, we change it so that the validation only runs once and produces an output file, and all the other targets build from that output file. This avoids redundant work when building multiple documentation targets (such as html and man). Also, when we run xmllint, we can resolve entities (included files). This helps with tools that don't support vpath builds, such as dbtoepub. All this also organizes the make targets a bit better for implementing equivalent steps in meson. Discussion: https://www.postgresql.org/message-id/e3ae16de-c9f9-f559-2d11-70b1342ae3d1@enterprisedb.com
1 parent 8b60db7 commit ab39352

File tree

2 files changed

+30
-24
lines changed

2 files changed

+30
-24
lines changed

doc/src/sgml/Makefile

+26-20
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,22 @@ ALLSGML := $(wildcard $(srcdir)/*.sgml $(srcdir)/ref/*.sgml) $(GENERATED_SGML)
6161
ALL_IMAGES := $(wildcard $(srcdir)/images/*.svg)
6262

6363

64+
# Run validation only once, common to all subsequent targets. While
65+
# we're at it, also resolve all entities (that is, copy all included
66+
# files into one big file). This helps tools that don't understand
67+
# vpath builds (such as dbtoepub).
68+
postgres-full.xml: postgres.sgml $(ALLSGML)
69+
$(XMLLINT) $(XMLINCLUDE) --output $@ --noent --valid $<
70+
71+
6472
##
6573
## Man pages
6674
##
6775

6876
man distprep-man: man-stamp
6977

70-
man-stamp: stylesheet-man.xsl postgres.sgml $(ALLSGML)
71-
$(XMLLINT) $(XMLINCLUDE) --noout --valid $(word 2,$^)
72-
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_MAN_FLAGS) $(wordlist 1,2,$^)
78+
man-stamp: stylesheet-man.xsl postgres-full.xml
79+
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_MAN_FLAGS) $^
7380
touch $@
7481

7582

@@ -117,7 +124,7 @@ INSTALL.html: %.html : stylesheet-text.xsl %.xml
117124
$(XMLLINT) --noout --valid $*.xml
118125
$(XSLTPROC) $(XSLTPROCFLAGS) $(XSLTPROC_HTML_FLAGS) $^ >$@
119126

120-
INSTALL.xml: standalone-profile.xsl standalone-install.xml postgres.sgml $(ALLSGML)
127+
INSTALL.xml: standalone-profile.xsl standalone-install.xml postgres-full.xml
121128
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) --xinclude $(wordlist 1,2,$^) >$@
122129

123130

@@ -131,25 +138,22 @@ endif
131138

132139
html: html-stamp
133140

134-
html-stamp: stylesheet.xsl postgres.sgml $(ALLSGML) $(ALL_IMAGES)
135-
$(XMLLINT) $(XMLINCLUDE) --noout --valid $(word 2,$^)
141+
html-stamp: stylesheet.xsl postgres-full.xml $(ALL_IMAGES)
136142
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_HTML_FLAGS) $(wordlist 1,2,$^)
137143
cp $(ALL_IMAGES) html/
138144
cp $(srcdir)/stylesheet.css html/
139145
touch $@
140146

141147
htmlhelp: htmlhelp-stamp
142148

143-
htmlhelp-stamp: stylesheet-hh.xsl postgres.sgml $(ALLSGML) $(ALL_IMAGES)
144-
$(XMLLINT) $(XMLINCLUDE) --noout --valid $(word 2,$^)
149+
htmlhelp-stamp: stylesheet-hh.xsl postgres-full.xml $(ALL_IMAGES)
145150
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(wordlist 1,2,$^)
146151
cp $(ALL_IMAGES) htmlhelp/
147152
cp $(srcdir)/stylesheet.css htmlhelp/
148153
touch $@
149154

150155
# single-page HTML
151-
postgres.html: stylesheet-html-nochunk.xsl postgres.sgml $(ALLSGML) $(ALL_IMAGES)
152-
$(XMLLINT) $(XMLINCLUDE) --noout --valid $(word 2,$^)
156+
postgres.html: stylesheet-html-nochunk.xsl postgres-full.xml $(ALL_IMAGES)
153157
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_HTML_FLAGS) -o $@ $(wordlist 1,2,$^)
154158

155159
# single-page text
@@ -166,13 +170,11 @@ postgres.pdf:
166170

167171
XSLTPROC_FO_FLAGS += --stringparam img.src.path '$(srcdir)/'
168172

169-
%-A4.fo: stylesheet-fo.xsl %.sgml $(ALLSGML)
170-
$(XMLLINT) $(XMLINCLUDE) --noout --valid $(word 2,$^)
171-
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_FO_FLAGS) --stringparam paper.type A4 -o $@ $(wordlist 1,2,$^)
173+
%-A4.fo: stylesheet-fo.xsl %-full.xml
174+
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_FO_FLAGS) --stringparam paper.type A4 -o $@ $^
172175

173-
%-US.fo: stylesheet-fo.xsl %.sgml $(ALLSGML)
174-
$(XMLLINT) $(XMLINCLUDE) --noout --valid $(word 2,$^)
175-
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_FO_FLAGS) --stringparam paper.type USletter -o $@ $(wordlist 1,2,$^)
176+
%-US.fo: stylesheet-fo.xsl %-full.xml
177+
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_FO_FLAGS) --stringparam paper.type USletter -o $@ $^
176178

177179
%.pdf: %.fo $(ALL_IMAGES)
178180
$(FOP) -fo $< -pdf $@
@@ -183,8 +185,11 @@ XSLTPROC_FO_FLAGS += --stringparam img.src.path '$(srcdir)/'
183185
##
184186

185187
epub: postgres.epub
186-
postgres.epub: postgres.sgml $(ALLSGML) $(ALL_IMAGES)
187-
$(XMLLINT) --noout --valid $<
188+
postgres.epub: postgres-full.xml $(ALL_IMAGES)
189+
ifeq ($(vpath_build),yes)
190+
$(MKDIR_P) images
191+
cp $(ALL_IMAGES) images/
192+
endif
188193
$(DBTOEPUB) -o $@ $<
189194

190195

@@ -196,8 +201,7 @@ DB2X_TEXIXML = db2x_texixml
196201
DB2X_XSLTPROC = db2x_xsltproc
197202
MAKEINFO = makeinfo
198203

199-
%.texixml: %.sgml $(ALLSGML)
200-
$(XMLLINT) --noout --valid $<
204+
%.texixml: %-full.xml
201205
$(DB2X_XSLTPROC) -s texi -g output-file=$(basename $@) $< -o $@
202206

203207
%.texi: %.texixml
@@ -284,6 +288,7 @@ check-tabs:
284288
# This allows removing some files from the distribution tarballs while
285289
# keeping the dependencies satisfied.
286290
.SECONDARY: $(GENERATED_SGML)
291+
.SECONDARY: postgres-full.xml
287292
.SECONDARY: INSTALL.html INSTALL.xml
288293
.SECONDARY: postgres-A4.fo postgres-US.fo
289294

@@ -297,6 +302,7 @@ clean:
297302
rm -f *.fo *.pdf
298303
# generated SGML files
299304
rm -f $(GENERATED_SGML)
305+
rm -f postgres-full.xml
300306
# HTML Help
301307
rm -rf htmlhelp/ htmlhelp-stamp
302308
# EPUB

doc/src/sgml/standalone-install.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ in the stand-alone version.
2222
C++</productname>, see the main documentation instead.
2323
</para>
2424

25-
<xi:include href="postgres.sgml" xpointer="install-short" xmlns:xi="http://www.w3.org/2001/XInclude"/>
26-
<xi:include href="postgres.sgml" xpointer="install-requirements" xmlns:xi="http://www.w3.org/2001/XInclude"/>
27-
<xi:include href="postgres.sgml" xpointer="install-procedure" xmlns:xi="http://www.w3.org/2001/XInclude"/>
28-
<xi:include href="postgres.sgml" xpointer="install-post" xmlns:xi="http://www.w3.org/2001/XInclude"/>
25+
<xi:include href="postgres-full.xml" xpointer="install-short" xmlns:xi="http://www.w3.org/2001/XInclude"/>
26+
<xi:include href="postgres-full.xml" xpointer="install-requirements" xmlns:xi="http://www.w3.org/2001/XInclude"/>
27+
<xi:include href="postgres-full.xml" xpointer="install-procedure" xmlns:xi="http://www.w3.org/2001/XInclude"/>
28+
<xi:include href="postgres-full.xml" xpointer="install-post" xmlns:xi="http://www.w3.org/2001/XInclude"/>
2929

3030
<sect1 id="install-getting-started">
3131
<title>Getting Started</title>

0 commit comments

Comments
 (0)