pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Change draft gmake control
9+ messages / 4 participants
[nested] [flat]

* Change draft gmake control
@ 2007-01-26 22:30  Bruce Momjian <bruce@momjian.us>
  0 siblings, 1 reply; 9+ messages in thread

From: Bruce Momjian @ 2007-01-26 22:30 UTC (permalink / raw)
  To: PostgreSQL-patches <pgsql-patches@postgresql.org>; pgsql-docs

I had to change the draft flag for SGML from 'gmake draft html' to
'gmake DRAFT=Y html'.  Internally the code used to recurse with DRAFT=Y,
but I found there is no way to exit the makefile after the recursion
returned, so I had to use this new syntax.  Though more cumbersome, it
is more logical because DRAFT is really a modifier, not a rule itself. 
For example, 'gmake html draft' would never have worked.  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. +

Attachments:

/rtmp/diff (text/x-diff, 2.5K) download Index: Makefile =================================================================== RCS file: /cvsroot/pgsql/doc/src/sgml/Makefile,v retrieving revision 1.91 diff -c -r1.91 Makefile *** Makefile 11 Jan 2007 00:02:39 -0000 1.91 --- Makefile 26 Jan 2007 22:19:58 -0000 *************** *** 64,70 **** ## Man pages ## ! .PHONY: man draft DEFAULTSECTION := $(sqlmansect_dummy) --- 64,70 ---- ## Man pages ## ! .PHONY: html man draft clean DEFAULTSECTION := $(sqlmansect_dummy) *************** *** 86,93 **** 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 --- 86,91 ---- *************** *** 95,101 **** ifeq ($(vpath_build), yes) @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 --- 93,99 ---- ifeq ($(vpath_build), yes) @cp $(srcdir)/stylesheet.css . endif ! ifneq ($(DRAFT), Y) # If not draft, re-run the this rule until HTML.index does not change @cmp -s HTML.index.start HTML.index || $(MAKE) $@ endif *************** *** 103,120 **** 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 - 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 --- 101,106 ---- Index: docguide.sgml =================================================================== RCS file: /cvsroot/pgsql/doc/src/sgml/docguide.sgml,v retrieving revision 1.65 diff -c -r1.65 docguide.sgml *** docguide.sgml 11 Jan 2007 00:02:39 -0000 1.65 --- docguide.sgml 26 Jan 2007 22:19:59 -0000 *************** *** 546,552 **** 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> </screen> </para> --- 546,552 ---- 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=Y html</userinput> </screen> </para>
^ permalink raw reply [nested|flat] 9+ messages in thread

* Re: Change draft gmake control
@ 2007-01-27 09:46  Peter Eisentraut <peter_e@gmx.net>
  parent: Bruce Momjian <bruce@momjian.us>
  0 siblings, 1 reply; 9+ messages in thread

From: Peter Eisentraut @ 2007-01-27 09:46 UTC (permalink / raw)
  To: pgsql-docs; +Cc: Bruce Momjian <bruce@momjian.us>; PostgreSQL-patches <pgsql-patches@postgresql.org>

Bruce Momjian wrote:
> I had to change the draft flag for SGML from 'gmake draft html' to
> 'gmake DRAFT=Y html'.  Internally the code used to recurse with
> DRAFT=Y, but I found there is no way to exit the makefile after the
> recursion returned,

exit 0 ?

> so I had to use this new syntax.  Though more 
> cumbersome, it is more logical because DRAFT is really a modifier,
> not a rule itself. For example, 'gmake html draft' would never have
> worked.

What would have been the meaning of that command?

Anyway, certainly you could write this to preserve the target:

draft:
	$(MAKE) html DRAFT=Y

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Change draft gmake control
@ 2007-01-27 15:14  Bruce Momjian <bruce@momjian.us>
  parent: Peter Eisentraut <peter_e@gmx.net>
  0 siblings, 2 replies; 9+ messages in thread

From: Bruce Momjian @ 2007-01-27 15:14 UTC (permalink / raw)
  To: Peter Eisentraut <peter_e@gmx.net>; +Cc: pgsql-docs@postgresql.org, PostgreSQL-patches <pgsql-patches@postgresql.org>

Peter Eisentraut wrote:
> Bruce Momjian wrote:
> > I had to change the draft flag for SGML from 'gmake draft html' to
> > 'gmake DRAFT=Y html'.  Internally the code used to recurse with
> > DRAFT=Y, but I found there is no way to exit the makefile after the
> > recursion returned,
> 
> exit 0 ?

I tried that, but it did nothing.  Of course exit 1 works, but throws an
error, and exec exit 0 doesn't work either, throws an error.

> > so I had to use this new syntax.  Though more 
> > cumbersome, it is more logical because DRAFT is really a modifier,
> > not a rule itself. For example, 'gmake html draft' would never have
> > worked.
> 
> What would have been the meaning of that command?

Nothing, but the point is that draft is a modifier and it isn't clear
from that syntax that draft is a modifier and not a target.

> Anyway, certainly you could write this to preserve the target:
> 
> draft:
> 	$(MAKE) html DRAFT=Y

The problem is that the 'gmake' recursion is done, but then returns and
runs the hhml again, so 'gmake draft html' calls "$(MAKE) html DRAFT=Y"
and on return from that, the html is called again and rebuilds, so it
isn't really draft.

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

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



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Change draft gmake control
@ 2007-01-27 16:28  Peter Eisentraut <peter_e@gmx.net>
  parent: Bruce Momjian <bruce@momjian.us>
  1 sibling, 1 reply; 9+ messages in thread

From: Peter Eisentraut @ 2007-01-27 16:28 UTC (permalink / raw)
  To: Bruce Momjian <bruce@momjian.us>; +Cc: pgsql-docs@postgresql.org, PostgreSQL-patches <pgsql-patches@postgresql.org>

Bruce Momjian wrote:
> Nothing, but the point is that draft is a modifier and it isn't clear
>
> >from that syntax that draft is a modifier and not a target.
> >
> > Anyway, certainly you could write this to preserve the target:
> >
> > draft:
> > 	$(MAKE) html DRAFT=Y
>
> The problem is that the 'gmake' recursion is done, but then returns
> and runs the hhml again, so 'gmake draft html' calls "$(MAKE) html
> DRAFT=Y" and on return from that, the html is called again and
> rebuilds, so it isn't really draft.

Well, "gmake draft html" doesn't make any sense anyway, but "gmake 
draft" by itself does and the new way of writing it is significantly 
more cumbersome, so I request that this be fixed.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: [pgsql-patches] Change draft gmake control
@ 2007-01-27 16:38  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Bruce Momjian <bruce@momjian.us>
  1 sibling, 0 replies; 9+ messages in thread

From: Tom Lane @ 2007-01-27 16:38 UTC (permalink / raw)
  To: Bruce Momjian <bruce@momjian.us>; +Cc: Peter Eisentraut <peter_e@gmx.net>; pgsql-docs@postgresql.org, PostgreSQL-patches <pgsql-patches@postgresql.org>

Bruce Momjian <bruce@momjian.us> writes:
> Peter Eisentraut wrote:
>> Anyway, certainly you could write this to preserve the target:
>> 
>> draft:
>> $(MAKE) html DRAFT=Y

> The problem is that the 'gmake' recursion is done, but then returns and
> runs the hhml again, so 'gmake draft html' calls "$(MAKE) html DRAFT=Y"
> and on return from that, the html is called again and rebuilds, so it
> isn't really draft.

No, the point is that "gmake draft" ought to work.  I'm not sure where
you came up with the idea that "gmake draft html" was a sane command,
but it certainly wasn't what was proposed initially.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Change draft gmake control
@ 2007-01-27 20:33  Bruce Momjian <bruce@momjian.us>
  parent: Peter Eisentraut <peter_e@gmx.net>
  0 siblings, 2 replies; 9+ messages in thread

From: Bruce Momjian @ 2007-01-27 20:33 UTC (permalink / raw)
  To: Peter Eisentraut <peter_e@gmx.net>; +Cc: pgsql-docs@postgresql.org, PostgreSQL-patches <pgsql-patches@postgresql.org>

Peter Eisentraut wrote:
> Bruce Momjian wrote:
> > Nothing, but the point is that draft is a modifier and it isn't clear
> >
> > >from that syntax that draft is a modifier and not a target.
> > >
> > > Anyway, certainly you could write this to preserve the target:
> > >
> > > draft:
> > > 	$(MAKE) html DRAFT=Y
> >
> > The problem is that the 'gmake' recursion is done, but then returns
> > and runs the hhml again, so 'gmake draft html' calls "$(MAKE) html
> > DRAFT=Y" and on return from that, the html is called again and
> > rebuilds, so it isn't really draft.
> 
> Well, "gmake draft html" doesn't make any sense anyway, but "gmake 
> draft" by itself does and the new way of writing it is significantly 
> more cumbersome, so I request that this be fixed.

Well, if 'draft' was only for html, I could see suggesting just 'gmake
draft', but 'draft' can be used for Postscript and PDF too.
 
-- 
  Bruce Momjian   bruce@momjian.us
  EnterpriseDB    http://www.enterprisedb.com

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



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: [pgsql-patches] Change draft gmake control
@ 2007-01-27 20:47  Andrew Dunstan <andrew@dunslane.net>
  parent: Bruce Momjian <bruce@momjian.us>
  1 sibling, 0 replies; 9+ messages in thread

From: Andrew Dunstan @ 2007-01-27 20:47 UTC (permalink / raw)
  To: Bruce Momjian <bruce@momjian.us>; +Cc: Peter Eisentraut <peter_e@gmx.net>; pgsql-docs@postgresql.org, PostgreSQL-patches <pgsql-patches@postgresql.org>



Bruce Momjian wrote:
>
>
> Well, if 'draft' was only for html, I could see suggesting just 'gmake
> draft', but 'draft' can be used for Postscript and PDF too.
>   


The maybe have targets draft-html, draft-postscript and draft-pdf ?

cheers

andrew



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Change draft gmake control
@ 2007-01-27 21:19  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Bruce Momjian <bruce@momjian.us>
  1 sibling, 1 reply; 9+ messages in thread

From: Tom Lane @ 2007-01-27 21:19 UTC (permalink / raw)
  To: Bruce Momjian <bruce@momjian.us>; +Cc: Peter Eisentraut <peter_e@gmx.net>; pgsql-docs@postgresql.org, PostgreSQL-patches <pgsql-patches@postgresql.org>

Bruce Momjian <bruce@momjian.us> writes:
> Well, if 'draft' was only for html, I could see suggesting just 'gmake
> draft', but 'draft' can be used for Postscript and PDF too.

But those aren't cases where saving some typing is useful (in fact,
I'd bet money that no one will ever use them).  Draft runs with html
output are highly useful, and like Peter I think "make draft" ought
to work for that.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Change draft gmake control
@ 2007-01-27 22:47  Bruce Momjian <bruce@momjian.us>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 9+ messages in thread

From: Bruce Momjian @ 2007-01-27 22:47 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Peter Eisentraut <peter_e@gmx.net>; pgsql-docs@postgresql.org, PostgreSQL-patches <pgsql-patches@postgresql.org>

Tom Lane wrote:
> Bruce Momjian <bruce@momjian.us> writes:
> > Well, if 'draft' was only for html, I could see suggesting just 'gmake
> > draft', but 'draft' can be used for Postscript and PDF too.
> 
> But those aren't cases where saving some typing is useful (in fact,
> I'd bet money that no one will ever use them).  Draft runs with html
> output are highly useful, and like Peter I think "make draft" ought
> to work for that.

OK, if that's what people want.  Patch attached and applied, docs
updated.

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

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

Attachments:

/rtmp/diff (text/x-diff, 1.4K) download Index: sgml/Makefile =================================================================== RCS file: /cvsroot/pgsql/doc/src/sgml/Makefile,v retrieving revision 1.93 diff -c -r1.93 Makefile *** sgml/Makefile 26 Jan 2007 23:51:39 -0000 1.93 --- sgml/Makefile 27 Jan 2007 22:33:17 -0000 *************** *** 99,104 **** --- 99,110 ---- endif + # 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: + @$(MAKE) DRAFT="Y" html + + COLLATEINDEX := LC_ALL=C $(PERL) $(COLLATEINDEX) -f -g # bookindex.sgml is required so there is a proper index for all output formats Index: sgml/docguide.sgml =================================================================== RCS file: /cvsroot/pgsql/doc/src/sgml/docguide.sgml,v retrieving revision 1.66 diff -c -r1.66 docguide.sgml *** sgml/docguide.sgml 26 Jan 2007 22:23:50 -0000 1.66 --- sgml/docguide.sgml 27 Jan 2007 22:33:17 -0000 *************** *** 546,552 **** 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=Y html</userinput> </screen> </para> --- 546,552 ---- 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</userinput> </screen> </para>
^ permalink raw reply [nested|flat] 9+ messages in thread


end of thread, other threads:[~2007-01-27 22:47 UTC | newest]

Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-01-26 22:30 Change draft gmake control Bruce Momjian <bruce@momjian.us>
2007-01-27 09:46 ` Peter Eisentraut <peter_e@gmx.net>
2007-01-27 15:14   ` Bruce Momjian <bruce@momjian.us>
2007-01-27 16:28     ` Peter Eisentraut <peter_e@gmx.net>
2007-01-27 20:33       ` Bruce Momjian <bruce@momjian.us>
2007-01-27 20:47         ` Andrew Dunstan <andrew@dunslane.net>
2007-01-27 21:19         ` Tom Lane <tgl@sss.pgh.pa.us>
2007-01-27 22:47           ` Bruce Momjian <bruce@momjian.us>
2007-01-27 16:38     ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox