Thread: Remove of .SECONDARY from SGML Makefile

Remove of .SECONDARY from SGML Makefile

From
Bruce Momjian
Date:
To get the new html dependency to work properly, I removed the
.SECONDARY tag from the Makefile.  SECONDARY prevents missing files from
being built.  Patch attached and applied.  The rules now work properly
and are less error-prone.

--
  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.90
diff -c -c -r1.90 Makefile
*** doc/src/sgml/Makefile    10 Jan 2007 19:06:04 -0000    1.90
--- doc/src/sgml/Makefile    11 Jan 2007 00:00:13 -0000
***************
*** 10,16 ****
  top_builddir = ../../..
  include $(top_builddir)/src/Makefile.global

- .SECONDARY:
  .NOTPARALLEL:

  ifndef COLLATEINDEX
--- 10,15 ----
***************
*** 97,109 ****
      @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
--- 96,109 ----
      @cp $(srcdir)/stylesheet.css .
  endif
  ifndef DRAFT
+ # If not draft, re-run the this rule until HTML.index does not change
      @cmp -s HTML.index.start HTML.index || $(MAKE) $@
  endif


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

! # The draft rule calls gmake again and sets the DRAFT variable.
  # This seems to be the only way to set gmake variables in a rule.
  draft:
  ifndef DRAFT
***************
*** 148,156 ****


  # RTF to allow minor editing for hardcopy
!
! %.rtf: %.sgml $(ALLSGML) stylesheet.dsl
!     $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -t rtf -V rtf-backend -i output-print $<

  # TeX
  # Regular TeX and pdfTeX have slightly differing requirements, so we
--- 148,155 ----


  # RTF to allow minor editing for hardcopy
! %.rtf: %.sgml $(ALLSGML) html
!     $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -t rtf -V rtf-backend -i output-print
postgres.sgml

  # TeX
  # Regular TeX and pdfTeX have slightly differing requirements, so we
***************
*** 192,198 ****
  # This generates an XML version of the flow-object tree.  It's useful
  # for debugging DSSSL code, and possibly to interface to some other
  # tools that can make use of this.
! %.fot: %.sgml $(ALLSGML) stylesheet.dsl
      $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -t fot -i output-print -o $@ $<


--- 191,197 ----
  # This generates an XML version of the flow-object tree.  It's useful
  # for debugging DSSSL code, and possibly to interface to some other
  # tools that can make use of this.
! %.fot: %.sgml $(ALLSGML) html
      $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -t fot -i output-print -o $@ $<


Index: doc/src/sgml/docguide.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/docguide.sgml,v
retrieving revision 1.64
diff -c -c -r1.64 docguide.sgml
*** doc/src/sgml/docguide.sgml    9 Jan 2007 22:19:36 -0000    1.64
--- doc/src/sgml/docguide.sgml    11 Jan 2007 00:00:14 -0000
***************
*** 543,549 ****

     <para>
      To create a proper index, the build might process several identical
!     stages.  If you do not care about an index, and just want to
      proof-read the output, use <literal>draft</>:
  <screen>
  <prompt>doc/src/sgml$ </prompt><userinput>gmake draft html</userinput>
--- 543,549 ----

     <para>
      To create a proper index, the build might process several identical
!     stages.  If you do not care about the index, and just want to
      proof-read the output, use <literal>draft</>:
  <screen>
  <prompt>doc/src/sgml$ </prompt><userinput>gmake draft html</userinput>
***************
*** 552,558 ****

     <para>
      To allow for easier handling in the final distribution, the files
!     comprising the HTML documentation are stored in a tar archive that
      is unpacked at installation time.  To create the
      <acronym>HTML</acronym> documentation package, use the commands
  <programlisting>
--- 552,558 ----

     <para>
      To allow for easier handling in the final distribution, the files
!     comprising the HTML documentation can be stored in a tar archive that
      is unpacked at installation time.  To create the
      <acronym>HTML</acronym> documentation package, use the commands
  <programlisting>

Re: Remove of .SECONDARY from SGML Makefile

From
Peter Eisentraut
Date:
Bruce Momjian wrote:
> To get the new html dependency to work properly, I removed the
> .SECONDARY tag from the Makefile.  SECONDARY prevents missing files
> from being built.

That is not what it does.
--
Peter Eisentraut
http://developer.postgresql.org/~petere/

Re: Remove of .SECONDARY from SGML Makefile

From
Bruce Momjian
Date:
Peter Eisentraut wrote:
> Bruce Momjian wrote:
> > To get the new html dependency to work properly, I removed the
> > .SECONDARY tag from the Makefile.  SECONDARY prevents missing files
> > from being built.
>
> That is not what it does.

It does several things, but that is one of the things it does:

    `.SECONDARY'
         The targets which `.SECONDARY' depends on are treated as
         intermediate files, except that they are never automatically
         deleted.  *Note Chains of Implicit Rules: Chained Rules.

         `.SECONDARY' with no prerequisites marks all file targets mentioned
         in the makefile as secondary.

and intermediate files are defined as:

       Intermediate files are remade using their rules just like all other
    files.  But intermediate files are treated differently in two ways.

       The first difference is what happens if the intermediate file does
    not exist.  If an ordinary file B does not exist, and `make' considers
        ---------
    a target that depends on B, it invariably creates B and then updates
    the target from B.  But if B is an intermediate file, then `make' can
    leave well enough alone.  It won't bother updating B, or the ultimate
                                  --------------------------
    target, unless some prerequisite of B is newer than that target or
    there is some other reason to update that target.

       The second difference is that if `make' _does_ create B in order to
    update something else, it deletes B later on after it is no longer
    needed.  Therefore, an intermediate file which did not exist before
    `make' also does not exist after `make'.  `make' reports the deletion
    to you by printing a `rm -f' command showing which file it is deleting.

This is what caused the dependencies not to run.  SECONDARY was added by
you in 2000.  What I don't understand is what else we have lost by
removing it:

    revision 1.27
    date: 2000/12/14 22:30:56;  author: petere;  state: Exp;  lines: +2 -1
    Merge functions and operators chapters.  Lots of updates.

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

  + If your life is a hard drive, Christ can be your backup. +