Makefile variable?
Just invoke:makespy Makefile MAKEVAR
makespy script below:
#!/bin/sh
original_makefile=`readlink -f $1`
name=$2
shift
shift
get_name_target=_makespy_get_${name}
(
cat << EOF
include ${original_makefile}
${get_name_target}:
echo \$($name)
EOF
) | make -C$(dirname $original_makefile) -s -f- ${get_name_target} "$@"
(remember about TAB character at the beginning of echo \$($name))
Usage: makespy MAKEFILENAME VARIABLENAME [makefile options...]
Prints actual value of variable in some makefile.
(works with GNU Make).
Update1 (2012-06-22): fixed a little, note about TAB


1 comment:
Thanks for the script!
I would add as a comment: do not forget to reinsert a real 'tab' character before "echo \$($name)" after copy/pasting the script from the web page.
Post a Comment