pphaneuf: (Default)
[personal profile] pphaneuf
Argh, gcc is so braindead at times... According to the man page:

-MD    Like `-M' but the dependency information is written
       to files with names made  by  replacing  `.o'  with
       `.d'  at the end of the output file names.  This is
       in   addition   to   compiling    the    file    as
       specified--`-MD' does not inhibit ordinary compila­
       tion the way `-M' does.


Except one detail: it doesn't do that. I use "-o foo/bar.o", so my output file is foo/bar.o. Replacing '.o' with '.d' should yield foo/bar.d, but no, bar.d comes out, putting all of the dependency files in the top level directory.

Nice.

The DEPENDENCIES_OUTPUT environment variable seems promising, but it can only take a single file as the target of the rule (I would like to make the dependency file itself a dependent, so that it is automatically updated).

Other than that, the nearly perfect dependency checking and amazing speed of non-recursive makefiles is incredible. If more people would try that, they'd ditch automake pretty quickly (or automake would be updated to create non-recursive makefiles, which would be even better!).

I say "nearly", because I still use a single dependency file, which I obviously don't rebuild every time, so it could get wrong. But it is very easy to get a perfect dependency build by simply removing the file to force the recomputation of dependencies.

February 2016

S M T W T F S
 123456
7891011 1213
14151617181920
21222324252627
2829     

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Mar. 20th, 2026 06:24 am
Powered by Dreamwidth Studios