On Mon, Dec 17, 2012 at 1:34 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I wrote:
>> Now perhaps this is not make's fault so much as a lack of adequate
>> dependency specifications. It may be that we can still use .SECONDARY
>> if we add the $(OBJS) lists as explicit targets of "make all" in backend
>> directories, but I'm not sure how invasive that would be.
>
> I experimented a bit with this:
>
> diff --git a/src/backend/common.mk b/src/backend/common.mk
> index 2e56151..822b1e9 100644
> *** a/src/backend/common.mk
> --- b/src/backend/common.mk
> *************** SUBDIROBJS = $(SUBDIRS:%=%/$(subsysfilen
> *** 20,26 ****
>
> # top-level backend directory obviously has its own "all" target
> ifneq ($(subdir), src/backend)
> ! all: $(subsysfilename)
> endif
>
> SUBSYS.o: $(SUBDIROBJS) $(OBJS)
> --- 20,26 ----
>
> # top-level backend directory obviously has its own "all" target
> ifneq ($(subdir), src/backend)
> ! all: $(subsysfilename) $(OBJS)
> endif
>
> SUBSYS.o: $(SUBDIROBJS) $(OBJS)
>
> which seems to fix the main issue, but it's still a bit wonky as far
> as making objfiles.txt goes:
>
> $ cd pgsql/src/backend/parser/
> $ rm analyze.o
> rm: remove regular file `analyze.o'? y
> $ 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 -g -I. -I.
-I../../../src/include-D_GNU_SOURCE -c -o analyze.o analyze.c
> $ make
> touch objfiles.txt
> $ make
> make: Nothing to be done for `all'.
>
> This is definitely not per make's contract, either. I think maybe the
> "Don't rebuild the list if only the OBJS have changed" hack in common.mk
> is a brick or two shy of a load, but I don't know how to fix that.
I feel like it's been this way for a while - at least I feel like I've
noticed this before. I think there is some inevitable kludginess
around having one makefile per subdirectory that leads to these kinds
of issues. Maybe we should get rid of all the makefiles under
src/backend except for the top-level one and just do everything there.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company