无需 运行 任何食谱即可制作
make without running any recipes
考虑以下非常愚蠢的 makefile:
# makefile
foo :
@$(MAKE) -C other
# other/makefile
bar :
@echo HELLO
没什么复杂的。当我 运行 $make
时,我得到了预期的:
$ make
make[1]: Entering directory `[...]/other'
HELLO
make[1]: Leaving directory `[...]/other'
但是,当我 运行 make -pn
时,我的输出结果是:
# GNU Make 3.82
# Built for x86_64-redhat-linux-gnu
# Copyright (C) 2010 Free Software Foundation, Inc.
# License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
# This is free software: you are free to change and redistribute it.
# There is NO WARRANTY, to the extent permitted by law.
make -C other
# GNU Make 3.82
# Built for x86_64-redhat-linux-gnu
# Copyright (C) 2010 Free Software Foundation, Inc.
# License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
# This is free software: you are free to change and redistribute it.
# There is NO WARRANTY, to the extent permitted by law.
# make[1]: Entering directory `[...]/other'
echo HELLO
为什么在-pn
中递归调用make
?我认为不应该调用这些食谱。我如何让 make
转储完整的规则数据库,而不 运行ning anything?
几乎 link 唯一的简短答案是 MAKE
变量及其在配方行中的出现是 treated specially GNU Make 的:
"Recipe lines containing MAKE are executed normally despite the presence of a flag that causes most recipes not to be run."
正在执行该配方行,因为它包含 $(MAKE)
。尝试添加其他种类的食谱行;你会看到它们没有被执行。
如您所见,这是有充分理由的。由于您使用递归调用的多个不相交的 makefile 来组织您的项目,而不是一个大的规则库,为了查看 "complete rule database",您实际上必须递归地处理所有 makefile。来自顶级 Makefile
的规则不是完整的规则数据库。
考虑以下非常愚蠢的 makefile:
# makefile
foo :
@$(MAKE) -C other
# other/makefile
bar :
@echo HELLO
没什么复杂的。当我 运行 $make
时,我得到了预期的:
$ make
make[1]: Entering directory `[...]/other'
HELLO
make[1]: Leaving directory `[...]/other'
但是,当我 运行 make -pn
时,我的输出结果是:
# GNU Make 3.82
# Built for x86_64-redhat-linux-gnu
# Copyright (C) 2010 Free Software Foundation, Inc.
# License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
# This is free software: you are free to change and redistribute it.
# There is NO WARRANTY, to the extent permitted by law.
make -C other
# GNU Make 3.82
# Built for x86_64-redhat-linux-gnu
# Copyright (C) 2010 Free Software Foundation, Inc.
# License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
# This is free software: you are free to change and redistribute it.
# There is NO WARRANTY, to the extent permitted by law.
# make[1]: Entering directory `[...]/other'
echo HELLO
为什么在-pn
中递归调用make
?我认为不应该调用这些食谱。我如何让 make
转储完整的规则数据库,而不 运行ning anything?
几乎 link 唯一的简短答案是 MAKE
变量及其在配方行中的出现是 treated specially GNU Make 的:
"Recipe lines containing MAKE are executed normally despite the presence of a flag that causes most recipes not to be run."
正在执行该配方行,因为它包含 $(MAKE)
。尝试添加其他种类的食谱行;你会看到它们没有被执行。
如您所见,这是有充分理由的。由于您使用递归调用的多个不相交的 makefile 来组织您的项目,而不是一个大的规则库,为了查看 "complete rule database",您实际上必须递归地处理所有 makefile。来自顶级 Makefile
的规则不是完整的规则数据库。