Brilliant make rule
Posted on July 20, 2009 by Tommy McGuireA cow-orker forwarded a link to a short Design Methodologies bit of cynicism, and while poking around, I found possibly the most useful make suggestion I have seen in a long time:
@echo "$* = $($*)"
So whenever you're not sure what a variable in the makefile is getting set to, you can do "make FOO.show" and it will show you the value of $(FOO).
It also has a brief advertisement for Recursive Make Considered Harmful as well. (Another useful link there is Implementing non-recursive make.)
While looking for the xs4all.nl link, I saw Painless non-recursive Make, which describes a method for allowing make invocations in the lower-level directories to do the right thing. I have not tried it, but it looks nice, at the expense of making the Makefiles even more complex.
[Edit: added Painless non-recursive Make.]