问题
How to check from the command line whether GNU Make is built with support of Guile?
Inside Makefile it can be determined via analyzing .FEATURES
variable (see documentation).
回答1:
As @ruvim points out, the manual says
You can determine whether GNU Guile support is available by checking the
.FEATURES
variable for the word guile.
$(if $(filter guile,${.FEATURES}) \
,$(info Guile suppoerted, yay!) \
,$(error Guile not supported - update your make))
回答2:
One possible way is a quasi makefile in stdin.
So, .FEATURES
variable can be printed in the following way:
echo '$(info $(.FEATURES))' | make -f -
The following command outputs guile
string if it is supported or nothing in otherwise:
echo '$(info $(filter guile,$(.FEATURES)))' | make -f - 2>/dev/null
A variation using grep
:
echo '$(info $(.FEATURES))' | make -f - 2>/dev/null | grep -wo guile
The solution
As @bobbogo mentioned, we can avoid the pipe at all, using --eval option:
make --eval '$(info $(filter guile,$(.FEATURES)))' 2>/dev/null
This command will print 'guile' or nothing.
来源:https://stackoverflow.com/questions/54670790/how-to-check-whether-gnu-make-supports-guile