Makefile 中支持的隐式变量
Supported implicit variables in Makefile
GNU Makefile 有 a documentation page 列出了各种编译上下文的标准隐式变量,例如 CC
、CFLAGS
等。它们定义明确,使用起来非常安全(我一直都在用)。
查看 GNU 网站之外的扩展文档,我经常看到 GNU 文档中 未 列出的其他变量,例如 COMPILER.c
、LINK.o
, 等等
当查看 Github 或互联网时,这些变量出现在多个食谱中,并且经常来自似乎对 make
的工作原理有很好理解的作者。
问题是:
使用这些变量的可靠性如何?
它们没有记录在 GNU make 文档网站上,但它们看起来足够稳定,以至于一些作者决定依赖它们。这是明智的做法吗?
我会说它们 are documented 并且与 GNU make 一起使用非常安全(它们不在 POSIX 制作).
However, the recipes in built-in implicit rules actually use variables such as COMPILE.c
, LINK.p
, and PREPROCESS.S
, whose values contain the recipes listed above.
make follows the convention that the rule to compile a .x
source file uses the variable COMPILE.x
. Similarly, the rule to produce an executable from a .x
file uses LINK.x
; and the rule to preprocess a .x
file uses PREPROCESS.x
.
GNU Makefile 有 a documentation page 列出了各种编译上下文的标准隐式变量,例如 CC
、CFLAGS
等。它们定义明确,使用起来非常安全(我一直都在用)。
查看 GNU 网站之外的扩展文档,我经常看到 GNU 文档中 未 列出的其他变量,例如 COMPILER.c
、LINK.o
, 等等
当查看 Github 或互联网时,这些变量出现在多个食谱中,并且经常来自似乎对 make
的工作原理有很好理解的作者。
问题是: 使用这些变量的可靠性如何? 它们没有记录在 GNU make 文档网站上,但它们看起来足够稳定,以至于一些作者决定依赖它们。这是明智的做法吗?
我会说它们 are documented 并且与 GNU make 一起使用非常安全(它们不在 POSIX 制作).
However, the recipes in built-in implicit rules actually use variables such as
COMPILE.c
,LINK.p
, andPREPROCESS.S
, whose values contain the recipes listed above.make follows the convention that the rule to compile a
.x
source file uses the variableCOMPILE.x
. Similarly, the rule to produce an executable from a.x
file usesLINK.x
; and the rule to preprocess a.x
file usesPREPROCESS.x
.