Brilliant make rule

Posted on July 20, 2009 by Tommy McGuire
Labels: software development
A 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:

%.show:
@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.]
active directory applied formal logic ashurbanipal authentication books c c++ comics conference continuations coq data structure digital humanities Dijkstra eclipse virgo electronics emacs goodreads haskell http java job Knuth ldap link linux lisp math naming nimrod notation OpenAM osgi parsing pony programming language protocols python quote R random REST ruby rust SAML scala scheme shell software development system administration theory tip toy problems unix vmware yeti
Member of The Internet Defense League
Site proudly generated by Hakyll.