I have some generated GNUmakefiles from which I need to extract the value of a variable.
Is there an easy way to see the value of a variable without modifying the makefiles ?
FYI, the variables contain the path of some include files necessary for the emacs c-macro-expand function.
You could do:
$ make -n -p | grep VAR
to pick out the value
the flags are:
-n # don't really make
-p # print database
You could create a wrapper makefile, which includes necessary GNUmakefiles and prints the variable. For example, create wrapper.mk
with the content
include GNUmakefile
$(info $(value VAR_NAME))
and then invoke Make with -n
flag (see @jeberle's answer):
make -f wrapper.mk -n # will print the variable value to stdout
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With