Subject: Re: [PATCHv2 1/8] Makefile: apply dependencies consistently to sparse/asm targets

From: Jonathan Nieder <[email-masked]>
Date: Tue, 19 Jun 2012 22:50:15 -0500

Hi,

Jeff King wrote:

> When a C file includes a header file or depends on a
> command-line "-D" macro, we note it in the Makefile like:
>
>   git.o: common-cmds.h
>
> However, other targets built from the C file should also
> know about this dependency (in particular, .sp and .s files
> that are not part of the usual build process). We sometimes
> noted these and sometimes not; let's make sure they are
> always included.

First reactions:

This improves consistency.  Yay!

Making .sp and .s targets depend on generated .h files like
common-cmds.h is very important.  Otherwise, I would not be able to
generate my git.s assembler listing or sparse-check git.c unless
common-cmds.h has already been generated as a side-effect of some
earlier build process.

On the other hand, making .sp and .s targets depend on preexisting .h
files and files like GIT-CFLAGS would not have any effect at all,
because:

 - .sp targets are phony --- there is no stamp file that certifies
   a given file has been checked by a "make sparse" run.  Maybe that
   will change some day.

 - .s targets are rebuilt every time.  Maybe I am just weird, but I
   find myself upgrading my compiler pretty often, so when I manually
   ask for an assembler listing I am happy to see it regenerated
   unconditionally using the new code generation rules.

It turns out that this patch is only about common-cmds.h, which was
the straightforward case.  Why not say so and save the reader from
having to think so hard? ;)

Hope that helps,
Jonathan