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

From: Cédric Villemain <cedric(at)2ndquadrant(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Cc: 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 16:49:19
Message-ID: 201212171749.23219.cedric@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Le lundi 17 décembre 2012 15:29:09, Andrew Dunstan a écrit :
> On 12/17/2012 08:46 AM, Peter Eisentraut wrote:
> > On 12/15/12 11:23 AM, Tom Lane wrote:
> >> =?iso-8859-15?q?C=E9dric_Villemain?= <cedric(at)2ndquadrant(dot)com> writes:
> >>> Le vendredi 14 décembre 2012 23:02:11, Tom Lane a écrit :
> >>>> $ rm gram.o
> >>>> rm: remove regular file `gram.o'? y
> >>>> $ make
> >>>> make: Nothing to be done for `all'.
> >>>>
> >>>> WTF?
> >>>
> >>> A previous patch changed the ".SECONDARY" from an if() section to the
> >>> main section of src/Makefile.global.in,
> >
> > Although it's a bit odd, it's not really a problem, I think. If you
> > want to rebuild analyze.o, you should write "make analyze.o". If you
> > want to rebuild postgres, run make in src/backend, and analyze.o (or
> > whatever) will be rebuilt.
>
> That's a pretty nasty violation of the POLA. If our leading developer
> thinks something about our build process is a problem, it's a problem.

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
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.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2012-12-17 16:58:11 Re: pg_basebackup from cascading standby after timeline switch
Previous Message Tom Lane 2012-12-17 16:42:04 Re: Makefiles don't seem to remember to rebuild everything anymore