即使参数不在白名单中,Makefile findstring也会生成非空字符串

时间:2016-10-15 23:23:28

标签: makefile

我希望我的Makefile要求指定一个环境,例如

make ENV=beta all

我的Makefile就像这样开始

ifeq ($(findstring ${ENV}, dev beta prod),)
  $(error ENV must be dev, beta, or prod (e.g. make ENV=dev))
endif

nop:
    echo "Nothing done."$(findstring ${ENV}, dev beta prod)"#"

如果我跑

make ENV=devx nop

我得到了这个输出

Makefile:7: *** ENV must be dev, beta, or prod (e.g. make ENV=dev). Stop.

另一方面

make ENV=d nop

给出了这个输出

echo "Nothing done."d"#"
Nothing done.d#

这表明$(findstring...正在返回非空字符串contrary to the documentation

捕获的是什么?

1 个答案:

答案 0 :(得分:0)

findstring函数正在查找" d&#34 ;;文档含糊不清,不正确。请改用filter

相关问题