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

AgileConnection is a TechWell community.

Through conferences, training, consulting, and online resources, TechWell helps you develop and deliver great software every day.