2010/09/17: GNU make and -V

The BSD make utility has an option -V that allows to inspect a variable, recursively expanded through a Makefile.


/usr/ports/www/uzbl>make -V PORTVERSION
0.0.0.2010.08.05
/usr/ports/www/uzbl>

The GNU make utility lacks such an option. A bit of web searching gives me the impression that this seems to be a common problem. However there seems to be no intention to change this. Fortunately, there is a work around.


print-%:
    @echo $($*)
download

With this definition you can get the desired effect.


~/Projects/ISILMAR/ports/cvs>gmake print-PORTVERSION
1.12.13
~/Projects/ISILMAR/ports/cvs>