Dumping Every Makefile Variable


and thinks of false as 'empty string' and true as 'not an empty string'. The predicate $(filter-out environment% default automatic,$(origin $V)) figures out where the variable referenced by $V was defined by calling $(origin $V). That returns a string describing where the variable was defined (e.g. it returns environment for environment variables, file for variables defined in a Makefile and default for things the GNU Make defines by itself).

The $(filter-out environment% default automatic,$(origin $V)) says if the result of $(origin) matches any of the patterns environment% (), default or automatic then return an empty string, otherwise leave it alone. Combined with the $(if) this results on only variables defined in the Makefile being printed.

About the author

John Graham-Cumming's picture John Graham-Cumming

John Graham-Cumming is Co-Founder at Electric Cloud, Inc . Prior to joining Electric Cloud, John was a Venture Consultant with Accel Partners, VP of Internet Technology at Interwoven, Inc. (IWOV), VP of Engineering at Scriptics Corporation (acquired by Interwoven), and Chief Architect at Optimal Networks, Inc. John holds BA and MA degrees in Mathematics and Computation and a Doctorate in Computer Security from Oxford University. John is the creator of the highly acclaimed open source POPFile project. He also holds two patents in network analysis and has others pending.

AgileConnection is one of the growing communities of the TechWell network.

Featuring fresh, insightful stories, TechWell.com is the place to go for what is happening in software development and delivery.  Join the conversation now!