Re: [HACKERS] [PATCHES] SGML index build fix - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: [HACKERS] [PATCHES] SGML index build fix
Date
Msg-id 200701101807.l0AI7Ae29638@momjian.us
Whole thread Raw
In response to Re: [HACKERS] [PATCHES] SGML index build fix  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-patches
Peter Eisentraut wrote:
> Bruce Momjian wrote:
> > The rule re-runs the makefile for the specific target, and the target
> > modifies HTML.index, or it is only the HTML rule that modifies that.
>
> Only the html rule modifies HTML.index.
>
> > That was a question I had.  If that is true, it has to be:
> >
> >     %-A4.tex-ps: %.sgml $(ALLSGML) stylesheet.dsl bookindex.sgml
> >             $(JADE.tex.call) -V texdvi-output -V '%paper-type%'=A4 -o $@
> > $< ifndef DRAFT
> >             @cmp -s HTML.index.start HTML.index || $(MAKE) html $@
> >     endif
>
> It would much easier to just run the html rule before the other stuff.

OK, so just make HTML a depenency for those.  Patch attached and
applied.

--
  Bruce Momjian   bruce@momjian.us
  EnterpriseDB    http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +
Index: doc/src/sgml/Makefile
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/Makefile,v
retrieving revision 1.89
diff -c -c -r1.89 Makefile
*** doc/src/sgml/Makefile    10 Jan 2007 01:57:15 -0000    1.89
--- doc/src/sgml/Makefile    10 Jan 2007 17:45:35 -0000
***************
*** 89,94 ****
--- 89,95 ----

  .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,130 ****
      @cp $(srcdir)/stylesheet.css .
  endif
  ifndef DRAFT
!     @cmp -s HTML.index.start HTML.index || $(MAKE) $(MAKECMDGOALS)
  endif


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

  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
      @$(MAKE) DRAFT="Y" all
  endif
  endif

  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.
      test ! -s HTML.index || $(COLLATEINDEX) -i 'bookindex' -o $@ $<
  # save copy of HTML.index for later comparison
      @cp HTML.index HTML.index.start

  HTML.index:
! # create HTML.index if it does not exist
      @$(if $(wildcard HTML.index), , touch HTML.index)

  version.sgml: $(top_builddir)/src/Makefile.global
--- 97,132 ----
      @cp $(srcdir)/stylesheet.css .
  endif
  ifndef DRAFT
!     @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)
      @$(MAKE) DRAFT="Y" $(MAKECMDGOALS)
  else
! # 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.
      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 an empty HTML.index if it does not exist
      @$(if $(wildcard HTML.index), , touch HTML.index)

  version.sgml: $(top_builddir)/src/Makefile.global
***************
*** 156,184 ****

  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
      $(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
      $(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
      $(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
      $(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
--- 158,174 ----

  JADE.tex.call = $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d $(srcdir)/stylesheet.dsl -t tex -V tex-backend -i
output-print

! %-A4.tex-ps: %.sgml $(ALLSGML) html
      $(JADE.tex.call) -V texdvi-output -V '%paper-type%'=A4 -o $@ $<

! %-US.tex-ps: %.sgml $(ALLSGML) html
      $(JADE.tex.call) -V texdvi-output -V '%paper-type%'=USletter -o $@ $<

! %-A4.tex-pdf: %.sgml $(ALLSGML) html
      $(JADE.tex.call) -V texpdf-output -V '%paper-type%'=A4 -o $@ $<

! %-US.tex-pdf: %.sgml $(ALLSGML) html
      $(JADE.tex.call) -V texpdf-output -V '%paper-type%'=USletter -o $@ $<

  %.dvi: %.tex-ps
      @rm -f $*.aux $*.log

pgsql-patches by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] [PATCHES] SGML index build fix
Next
From: "Jim C. Nasby"
Date:
Subject: Re: [HACKERS] [PATCHES] COPY with no WAL, in certain circumstances