port _srv.o makefile rules don't observe dependency tracking

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: port _srv.o makefile rules don't observe dependency tracking
Date: 2012-05-01 19:30:25
Message-ID: 1335900625.16054.6.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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?

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2012-05-01 19:35:04 Re: extending relations more efficiently
Previous Message Peter Eisentraut 2012-05-01 19:17:08 pgsql: Remove dead ports