@@ -61,15 +61,22 @@ ALLSGML := $(wildcard $(srcdir)/*.sgml $(srcdir)/ref/*.sgml) $(GENERATED_SGML)
6161ALL_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
6876man 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
132139html : 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
141147htmlhelp : 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
167171XSLTPROC_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
185187epub : 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
196201DB2X_XSLTPROC = db2x_xsltproc
197202MAKEINFO = 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
0 commit comments