port _srv.o makefile rules don't observe dependency tracking - Mailing list pgsql-hackers

From Peter Eisentraut
Subject port _srv.o makefile rules don't observe dependency tracking
Date
Msg-id 1335900625.16054.6.camel@vanquo.pezone.net
Whole thread Raw
Responses Re: port _srv.o makefile rules don't observe dependency tracking
List pgsql-hackers
There is this rule in src/port/Makefile:

%_srv.o: %.c       $(CC) $(CFLAGS) $(subst -DFRONTEND,, $(CPPFLAGS)) -c $< -o $@

But this rule doesn't observe dependency tracking, so if you change a
header file, these files won't get build as necessary.  This is the only
case in the source tree where this happens, because (after a few more
trivial fixups I have made recently) everything else uses the default
%.c -> %.o rule.

I have thought for a long time about how to refactor the dependency
tracking logic from Makefile.global so that it can support this outlier,
but all solutions ended up more complex than I would have liked.
(Something like bundling up the entire logic into make functions and
calling it from various places.)

Instead, I thought this could easily be fixed by writing this:

%_srv.o: %.c %.o       $(CC) $(CFLAGS) $(subst -DFRONTEND,, $(CPPFLAGS)) -c $< -o $@

A bit hacky, but should get quite robust results.

Comments, other ideas?




pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: extending relations more efficiently
Next
From: Robert Haas
Date:
Subject: Re: extending relations more efficiently