Subject: Automatic dependency tracking in the Git build system (was: Re: [PATCHv2 1/8] Makefile: apply dependencies consistently to sparse/asm targets)

From: Stefano Lattarini <[email-masked]>
Date: Thu, 21 Jun 2012 10:52:55 +0200

[Adding the Automake list in CC:]

On 06/20/2012 09:57 PM, Jeff King wrote:
> On Wed, Jun 20, 2012 at 02:45:31PM -0500, Jonathan Nieder wrote:
> 
>> Jeff King wrote:
>>
>>> Did you read the argument in patch 2? They are almost certainly not
>>> helping anyone, anyway.
>>
>> Yes, I read patch 2. I hacked on git from time to time in the days
>> before COMPUTE_HEADER_DEPENDENCIES, and it sometimes involved changing
>> header files. When they were not in LIB_H, the experience was much
>> nicer.
>>
>> Is that called "not helping"? I'm afraid I don't follow this line of
>> argument at all.
> 
> I just assumed that people who are actively hacking on individual header
> files in git actually have a compiler that can do COMPUTE_HEADER_DEPENDENCIES.
> Maybe that is not the case. If it were such a big deal, then why is
> everything in LIB_H? Why don't people use these manual rules, or convert
> existing LIB_H entries to use them?
> 
> For people who are not actively hacking on header files in git, the
> arguments from that patch apply (namely that LIB_H is so gigantic that
> you are unlikely to hit a specific change where one of the few manual
> rules is triggered, but LIB_H is not).
> 
>> On the other hand, if someone were proposing adding a simple awk
>> script to implement a "make dep" fallback, I would understand that.
> 
> I'd be OK with that. Do you have one in mind, or do we need to write it
> from scratch? Surely somebody else has solved this problem before.
>

[begin shameless plug]

Have you taken a look at the 'depcomp' script that comes with Automake?
 <http://git.savannah.gnu.org/cgit/automake.git/tree/lib/depcomp>
Once you get past some of its idiosyncrasies and few historical warts,
it has a lot of built-in knowledge about automatic dependency tracking
for a lot of different compilers.

[end shameless plug]

HTH,
  Stefano