我的 make
命令有一个奇怪的行为。
它在执行之前不打印命令行。
我知道 -s
、--silent
和 --quiet
选项的存在或之前使用 @
命令行。我没有使用它们中的任何一个。
例如,一个非常基本的 Makefile:
all:
touch toto.txt
rm toto.txt
在我的计算机上执行:
mylogin@debian:~$ make
mylogin@debian:~$
在另一台计算机上执行:
mylogin@debian:~$ make
touch toto.txt
rm toto.txt
mylogin@debian:~$
这两台计算机上的 make 版本相同:
mylogin@debian:~$ make -version
GNU Make 3.81
...
打印命令行是默认行为 ( https://www.gnu.org/software/make/manual/html_node/Echoing.html ),我不使用任何特殊配置。
有人知道为什么我的 make
执行但不回显命令行吗?
PS:
- 我没有名为“all”的文件或目录
- 如果我删除
rm toto.txt
,该文件将在没有任何 make 回显的情况下创建。
PPS:
这些是我发出
make -d
时的最后几行输出:Considering target file `all'. File `all' does not exist. Finished prerequisites of target file `all'. Must remake target `all'. Need a job token; we don't have children Putting child 0x01144970 (all) PID 7478 on the chain. Commands of `all' are being run. Live child 0x01144970 (all) PID 7478 Reaping winning child 0x01144970 PID 7478 Removing child 0x01144970 PID 7478 from chain. Considering target file `all'. File `all' was considered already.
最佳答案
您的调试输出中有此字符串:
Need a job token; we don't have children
除非使用 -j
选项,否则我无法在调试输出中获取此字符串。但是,您声明您在命令行中使用了 make -d 。这也是您的 Pastebin 所显示的内容。
这对我来说表明您没有运行库存(即未经修改的)GNU make。可能性:
您实际上正在运行一个脚本,该脚本包含真正的 make 并传递
-j
和-s
来 make 另外 您给出的参数。添加-j
解释了上面的行。添加-s
解释了为什么您没有得到回显。您有一个 shell 别名或一个 shell 函数,其功能与上面的假定脚本相同。 (在 bash 中,您可以使用
type -a make
来检查make
是什么。感谢 MadScientist 关于type -a
的提醒。)您正在使用
MAKEFLAGS
环境变量来设置-j
和-s
。 (在 bash 中,您可以使用printenv MAKEFLAGS
检查它。)您正在运行自定义二进制文件。
关于makefile - 为什么 "make"没有回显任何内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28827521/