From f21d5b61ce4ecd60d4d671990f9c6b886e234809 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Wed, 10 Jan 2007 19:06:04 +0000 Subject: [PATCH] Improve SGML build rules for non-HTML output, per Peter. --- doc/src/sgml/Makefile | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/doc/src/sgml/Makefile b/doc/src/sgml/Makefile index 8b0b0f6da2..825dcc8e5d 100644 --- a/doc/src/sgml/Makefile +++ b/doc/src/sgml/Makefile @@ -2,7 +2,7 @@ # # PostgreSQL documentation makefile # -# $PostgreSQL: pgsql/doc/src/sgml/Makefile,v 1.89 2007/01/10 01:57:15 momjian Exp $ +# $PostgreSQL: pgsql/doc/src/sgml/Makefile,v 1.90 2007/01/10 19:06:04 momjian Exp $ # #---------------------------------------------------------------------------- @@ -89,6 +89,7 @@ all: html .PHONY: html +# This is run for all output formats because we need bookindex.sgml html: postgres.sgml $(ALLSGML) stylesheet.dsl @rm -f *.html $(JADE) $(JADEFLAGS) $(SPFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -i output-html -t sgml $< @@ -96,35 +97,36 @@ ifeq ($(vpath_build), yes) @cp $(srcdir)/stylesheet.css . endif ifndef DRAFT - @cmp -s HTML.index.start HTML.index || $(MAKE) $(MAKECMDGOALS) + @cmp -s HTML.index.start HTML.index || $(MAKE) $@ endif COLLATEINDEX := LC_ALL=C $(PERL) $(COLLATEINDEX) -f -g +# The draft rule calls $(MAKE) again and sets the DRAFT variable. +# This seems to be the only way to set gmake variables in a rule. draft: ifndef DRAFT ifneq ($(MAKECMDGOALS), draft) -# Call ourselves with the DRAFT value set. This seems to be the only -# way to set gmake variables in a rule. @$(MAKE) DRAFT="Y" $(MAKECMDGOALS) else -# run default 'all' rule +# simulate $(MAKE) with no arguments @$(MAKE) DRAFT="Y" all endif endif +# bookindex.sgml is required so there is a proper index for all output formats bookindex.sgml: HTML.index # create a dummy bookindex.html test -s HTML.index || $(COLLATEINDEX) -o $@ -N -# If HTML.index is valid, create a valid bookindex.sgml. This -# is required so the output has a proper index. +# If HTML.index is valid, create a valid bookindex.sgml. test ! -s HTML.index || $(COLLATEINDEX) -i 'bookindex' -o $@ $< # save copy of HTML.index for later comparison @cp HTML.index HTML.index.start +# HTML.index is used to create bookindex.sgml HTML.index: -# create HTML.index if it does not exist +# create an empty HTML.index if it does not exist @$(if $(wildcard HTML.index), , touch HTML.index) version.sgml: $(top_builddir)/src/Makefile.global @@ -156,29 +158,17 @@ features-unsupported.sgml: $(top_srcdir)/src/backend/catalog/sql_feature_package JADE.tex.call = $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d $(srcdir)/stylesheet.dsl -t tex -V tex-backend -i output-print -%-A4.tex-ps: %.sgml $(ALLSGML) stylesheet.dsl bookindex.sgml +%-A4.tex-ps: %.sgml $(ALLSGML) html $(JADE.tex.call) -V texdvi-output -V '%paper-type%'=A4 -o $@ $< -ifndef DRAFT - @cmp -s HTML.index.start HTML.index || $(MAKE) $@ -endif -%-US.tex-ps: %.sgml $(ALLSGML) stylesheet.dsl bookindex.sgml +%-US.tex-ps: %.sgml $(ALLSGML) html $(JADE.tex.call) -V texdvi-output -V '%paper-type%'=USletter -o $@ $< -ifndef DRAFT - @cmp -s HTML.index.start HTML.index || $(MAKE) $@ -endif -%-A4.tex-pdf: %.sgml $(ALLSGML) stylesheet.dsl bookindex.sgml +%-A4.tex-pdf: %.sgml $(ALLSGML) html $(JADE.tex.call) -V texpdf-output -V '%paper-type%'=A4 -o $@ $< -ifndef DRAFT - @cmp -s HTML.index.start HTML.index || $(MAKE) $@ -endif -%-US.tex-pdf: %.sgml $(ALLSGML) stylesheet.dsl bookindex.sgml +%-US.tex-pdf: %.sgml $(ALLSGML) html $(JADE.tex.call) -V texpdf-output -V '%paper-type%'=USletter -o $@ $< -ifndef DRAFT - @cmp -s HTML.index.start HTML.index || $(MAKE) $@ -endif %.dvi: %.tex-ps @rm -f $*.aux $*.log