22#
33# PostgreSQL documentation makefile
44#
5- # $PostgreSQL: pgsql/doc/src/sgml/Makefile,v 1.128 2009/08/26 22:24:42 petere Exp $
5+ # $PostgreSQL: pgsql/doc/src/sgml/Makefile,v 1.129 2009/08/28 20:26:18 petere Exp $
66#
77# ----------------------------------------------------------------------------
88
3232ifndef JADE
3333JADE = jade
3434endif
35- SGMLINCLUDE = -D$(srcdir )
35+ SGMLINCLUDE = -D. -D $(srcdir )
3636
3737ifndef NSGMLS
3838NSGMLS = nsgmls
@@ -75,13 +75,9 @@ override SPFLAGS += -wall -wno-unused-param -wno-empty -wfully-tagged
7575
7676man : man-stamp
7777
78- ifeq ($(vpath_build ) ,yes)
79- XSLTPROC_MAN_FLAGS = --stringparam man.output.base.dir '$(srcdir ) /'
80- endif
81-
82- $(srcdir ) /man-stamp : stylesheet-man.xsl postgres.xml
78+ man-stamp : stylesheet-man.xsl postgres.xml
8379$(XSLTPROC ) $(XSLTPROCFLAGS ) $(XSLTPROC_MAN_FLAGS ) $^
84- rm$( srcdir ) / man1/dblink*
80+ rm man1/dblink*
8581touch$@
8682
8783
@@ -92,47 +88,43 @@ $(srcdir)/man-stamp: stylesheet-man.xsl postgres.xml
9288.PHONY : draft
9389
9490JADE.html.call =$(JADE ) $(JADEFLAGS ) $(SPFLAGS ) $(SGMLINCLUDE ) $(CATALOG ) -d stylesheet.dsl -t sgml -i output-html
95- ifeq ($(vpath_build ) ,yes)
96- # This only works with openjade, not with the older jade.
97- JADE.html.call += -V '(define %output-dir% "$(srcdir ) /html")'
98- endif
9991
10092# The draft target creates HTML output in draft mode, without index (for faster build).
10193draft : postgres.sgml$(ALMOSTALLSGML ) stylesheet.dsl
102- $(MKDIR_P ) $( srcdir ) / html
94+ $(MKDIR_P ) html
10395$(JADE.html.call ) -V draft-mode$<
104- cp$(srcdir ) /stylesheet.css$( srcdir ) / html/
96+ cp$(srcdir ) /stylesheet.css html/
10597
10698html : html-stamp
10799
108- $( srcdir ) / html-stamp : postgres.sgml$(ALLSGML ) stylesheet.dsl
109- $(MKDIR_P ) $( srcdir ) / html
100+ html-stamp : postgres.sgml$(ALLSGML ) stylesheet.dsl
101+ $(MKDIR_P ) html
110102$(JADE.html.call ) -i include-index$<
111- cp$(srcdir ) /stylesheet.css$( srcdir ) / html/
103+ cp$(srcdir ) /stylesheet.css html/
112104touch$@
113105
114- $( srcdir ) / HTML.index : postgres.sgml$(ALMOSTALLSGML ) stylesheet.dsl
115- @$(MKDIR_P ) $( srcdir ) / html
106+ HTML.index : postgres.sgml$(ALMOSTALLSGML ) stylesheet.dsl
107+ @$(MKDIR_P ) html
116108$(JADE.html.call ) -V html-index$<
117109
118- $( srcdir ) / bookindex.sgml : HTML.index
110+ bookindex.sgml : HTML.index
119111LC_ALL=C$(PERL ) $(COLLATEINDEX ) -f -g -i' bookindex' -o$@ $<
120112
121113# Technically, this should depend on Makefile.global, but then
122114# version.sgml would need to be rebuilt after every configure run,
123115# even in distribution tarballs. So this is cheating a bit, but it
124116# will achieve the goal of updating the version number when it
125117# changes.
126- $( srcdir ) / version.sgml :$(top_srcdir ) /configure
118+ version.sgml :$(top_srcdir ) /configure
127119{ \
128120echo " <!entity version\" $( VERSION) \" >" ; \
129121echo " <!entity majorversion\" $( MAJORVERSION) \" >" ; \
130122}> $@
131123
132- $( srcdir ) / features-supported.sgml :$(top_srcdir ) /src/backend/catalog/sql_feature_packages.txt$(top_srcdir ) /src/backend/catalog/sql_features.txt
124+ features-supported.sgml :$(top_srcdir ) /src/backend/catalog/sql_feature_packages.txt$(top_srcdir ) /src/backend/catalog/sql_features.txt
133125$(PERL ) $(srcdir ) /mk_feature_tables.pl YES$^ > $@
134126
135- $( srcdir ) / features-unsupported.sgml :$(top_srcdir ) /src/backend/catalog/sql_feature_packages.txt$(top_srcdir ) /src/backend/catalog/sql_features.txt
127+ features-unsupported.sgml :$(top_srcdir ) /src/backend/catalog/sql_feature_packages.txt$(top_srcdir ) /src/backend/catalog/sql_features.txt
136128$(PERL ) $(srcdir ) /mk_feature_tables.pl NO$^ > $@
137129
138130
@@ -232,10 +224,6 @@ postgres.xml: postgres.sgml $(ALMOSTALLSGML)
232224> $@
233225# ' hello Emacs
234226
235- ifeq ($(vpath_build ) ,yes)
236- XSLTPROC_HTML_FLAGS = --stringparam base.dir '$(srcdir ) /html'
237- endif
238-
239227xslthtml : stylesheet.xsl postgres.xml
240228$(XSLTPROC ) $(XSLTPROCFLAGS ) $(XSLTPROC_HTML_FLAGS ) $^
241229
@@ -280,9 +268,11 @@ check: postgres.sgml $(ALMOSTALLSGML)
280268# # Install
281269# #
282270
283- found_html =$(wildcard $(srcdir ) /html-stamp)
271+ vpathsearch =$(firstword $(wildcard $(addsuffix /$(1 ) ,$(subst :, ,.$(VPATH ) ) ) ) )
272+
273+ found_html =$(wildcard html-stamp$(srcdir ) /html-stamp)
284274
285- ifneq ($(wildcard $(srcdir ) /man-stamp) ,)
275+ ifneq ($(wildcard man-stamp $(srcdir ) /man-stamp) ,)
286276# SCO OpenServer's man system is sufficiently different to not bother.
287277ifneq ($(PORTNAME ) , sco)
288278found_man = yes
@@ -301,7 +291,7 @@ uninstall:
301291# # Install html
302292
303293install-html : html installdirs
304- cp -R$(srcdir ) / html' $(DESTDIR)$(htmldir)'
294+ cp -R$(call vpathsearch, html) ' $(DESTDIR)$(htmldir)'
305295
306296
307297# # Install man
@@ -316,7 +306,7 @@ sqlmansectnum = $(shell expr X'$(sqlmansect)' : X'\([0-9]\)')
316306#
317307ifeq ($(sqlmansectnum ) ,7)
318308install-man :
319- cp -R$(addprefix $( srcdir ) / ,man1 man3 man7) ' $(DESTDIR)$(mandir)'
309+ cp -R$(foreach dir ,man1 man3 man7, $( call vpathsearch, $( dir ) ) ) ' $(DESTDIR)$(mandir)'
320310
321311else # sqlmansectnum != 7
322312fix_sqlmansectnum = sed -e '/^\.TH/s/"7"/"$(sqlmansect ) "/'\