1

有没有办法在不使用目标的情况下强制 BSD makefile 中的错误?我正在寻找类似的东西

.if ...some condition...
    error bad configuration
.endif

这个问题类似于“如何在 gnumake 文件中强制出错”,但适用于 BSD makefile。

4

1 回答 1

4

是:使用.error(以及变量赋值语法VARIABLE != some command将 shell 命令的输出分配给变量)。

SOMEVAR != foo --bar
.if (${SOMEVAR} != "some string")
.error bad configuration
.endif

(如果手头没有,可以在此处在线阅读手册页,其中包含语法的完整详细信息。)

于 2011-09-15T19:24:43.140 回答