How to check whether GNU Make supports Guile

2019-08-20 12:02发布

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).

2条回答
何必那么认真
2楼-- · 2019-08-20 12:25

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.

查看更多
淡お忘
3楼-- · 2019-08-20 12:35

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))
查看更多
登录 后发表回答