从 make 文件中禁用 make 内置规则和变量 [英] Disable make builtin rules and variables from inside the make file
问题描述
我想根据传递的 禁用内置规则和变量-r
和 -R
选项 到 GNU make,从 make 文件中.也欢迎其他允许我隐式和透明地执行此操作的解决方案.
I want to disable builtin rules and variables as per passing the -r
and -R
options to GNU make, from inside the make file. Other solutions that allow me to do this implicitly and transparently are also welcome.
我发现 几个参考使用MAKEFLAGS代码>
,并有类似的问题.
I've found several references to using MAKEFLAGS
, and had similar problems.
推荐答案
你可以用 #!
开始 Makefile
并称它为不同的东西,这样人们就不会尝试直接使用make
:
You could start the Makefile
with a #!
and call it something different so people don't try to use make
directly:
#!/usr/bin/make -rRf
# ...
如果 GNU make 不是系统 make
,这将导致可怕的问题.也许是一个包装脚本?
This will cause horrific problems if GNU make is not the system make
. Maybe a wrapper script?
您还可以阅读 $(MAKEFLAGS)
并确保存在所需的标志.
You can also read $(MAKEFLAGS)
and make sure the required flags are present.
这篇关于从 make 文件中禁用 make 内置规则和变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!