GNU制作递归干式运行命令
我有一个makefile,<代码>包括 s其他几个makefiles,并在许多地方使用递归制造。
我正在尝试将其目标打印到目标数据库(-p
) 不运行它们的情况下。这应该可以通过make -pn
来实现,但是它不起作用。尽管传递了-n
,这些配方仍在运行。
我已经检查了很多次,每个文件中的每个文件的调用都是通过
$(make)
进行的,所以我希望这能起作用。删除
-p
没有区别,make-dry-run
仍执行命令。该问题似乎会影响所有
Make
S,而不仅仅是子捕捞。
有什么我缺少的吗?我在Alpine上使用GNU 4.3。
我正在使用这些可能影响结果的特殊变量/目标:
.ONESHELL:
.SILENT:
SHELL = /bin/bash
.SHELLFLAGS = -o pipefail -exc
export MAKELEVEL
I have a makefile that include
s several other makefiles and uses recursive make in numerous places.
I'm trying to have make print its database of targets (-p
) without running them. This should simply be achievable with make -pn
, however it isn't working. The recipes are being run despite -n
being passed.
I've checked many times and every invocation of
make
inside every file is via$(MAKE)
, so I would expect this to work.Removing
-p
makes no difference,make --dry-run
still executes commands.The issue appears to affect all
make
s, not just sub-makes.
Is there anything I'm missing? I'm on GNU Make 4.3 on Alpine.
I'm using these special variables/targets which may affect the outcome:
.ONESHELL:
.SILENT:
SHELL = /bin/bash
.SHELLFLAGS = -o pipefail -exc
export MAKELEVEL
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个快速的示例,可以证明它可以按预期工作:
现在没有
-n
:我们可以看到配方已运行,并且Shell Echos Echos
HI
。现在,使用-n
运行:在这里它打印出运行的命令,但实际上没有运行。
无需将
- $(makeflags)
添加到子麦片调用中。Here's a quick example to prove that it works as expected:
Now run without
-n
:We can see the recipe was run and the shell echos
hi
. Now run with-n
:Here it prints the command to run, but doesn't actually run it.
No need to add
-$(MAKEFLAGS)
to the sub-make invocation.