Re: Makefiles don't seem to remember to rebuild everything anymore

From: Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com>
To: cedric(at)2ndquadrant(dot)com
Cc: pgsql-hackers(at)postgresql(dot)org, Andrew Dunstan <andrew(at)dunslane(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Makefiles don't seem to remember to rebuild everything anymore
Date: 2012-12-17 17:02:58
Message-ID: CABOikdO2P9-vwEm=bgQGLAzr5m94DnSBCHEOUyQ9Rb1OuqNwKw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Dec 17, 2012 at 10:19 PM, Cédric Villemain
<cedric(at)2ndquadrant(dot)com> wrote:

>
> That's not so obvious.
> The current behavior is expected by .SECONDARY.
> In other words, if I just 'touch rewriteDefine.c' then rewriteDefine.o will be
> rebuilt by make (as expected).
>
> $ touch rewriteDefine.c
> $ make
> gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-
> statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-
> strict-aliasing -fwrapv -fexcess-precision=standard -I../../../src/include -
> D_GNU_SOURCE -c -o rewriteDefine.o rewriteDefine.c

Isn't that something very basic make is supposed to do anyways ?

> touch objfiles.txt
>
> It is maybe better to do a special case when you want to force rebuild, but in
> a more intuitive way than specifying each file you want to rebuild.
>

I don't understand what are we trying to achieve by doing what you did
below. ISTM that the real problem is .SECONDARY without any
prerequisites. If at all there are any files that we want to treat as
secondary and not remove at the end, shouldn't we add them as
prerequisites to this special target ? At least, that what I get
reading man pages and samples.

Thanks,
Pavan

> Like that ?! :
>
> ====
> diff --git a/src/Makefile.global.in b/src/Makefile.global.in
> index 9cc14da..8597792 100644
> --- a/src/Makefile.global.in
> +++ b/src/Makefile.global.in
> @@ -31,8 +31,10 @@ all:
> # started to update the file.
> .DELETE_ON_ERROR:
>
> +ifndef NOTSECONDARY
> # Never delete any intermediate files automatically.
> .SECONDARY:
> +endif
> ====
>
> $ rm rewriteDefine.o
> $ make
> nothing to do ...
> $ NOTSECONDARY=1 make
> gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-
> statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-
> strict-aliasing -fwrapv -fexcess-precision=standard -I../../../src/include -
> D_GNU_SOURCE -c -o rewriteDefine.o rewriteDefine.c
> touch objfiles.txt
>
>
> --
> Cédric Villemain +33 (0)6 20 30 22 52
> http://2ndQuadrant.fr/
> PostgreSQL: Support 24x7 - Développement, Expertise et Formation

--
Pavan Deolasee
http://www.linkedin.com/in/pavandeolasee

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-12-17 17:15:19 Re: Makefiles don't seem to remember to rebuild everything anymore
Previous Message Cédric Villemain 2012-12-17 17:02:53 Re: Makefiles don't seem to remember to rebuild everything anymore