Sunday, April 26, 2015 [Tweets] [Favorites]

The One Line You Should Add to Every Makefile

John Graham-Cumming, who’s just written the GNU Make Book (Amazon):

It’s:

print-%: ; @echo $*=$($*)

It allows you to quickly get the value of any makefile variable. For example, suppose you want to know the value of a variable called SOURCE_FILES. You’d just type:

make print-SOURCE_FILES

This works with the 2006 version of GNU Make that comes with Xcode.

1 Comment

not to every makefile: only to GNU makefile. bmake has this builtin make -VSORUCE_FILES

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment