Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display the value of all the variables in Makefile

Tags:

makefile

I am learning how to write Makefile. I found the .VARIABLES variable which holds all the variables valid in Makefile.

I can check the variables' name with command like this:

test:
    @echo "${.VARIABLES}" | tr ' ' '\n'

But I don't know how to should the values of them. Can anyone teach me to to do that?

like image 362
enchanter Avatar asked Apr 08 '14 00:04

enchanter


1 Answers

If you are using GNU Make, then you can use a crafty combination of foreach and .VARIABLES like this:

test:
    $(foreach var,$(.VARIABLES),$(info $(var) = $($(var))))
like image 110
harmic Avatar answered Sep 27 '22 20:09

harmic