是否可以使gnu make正在执行的进程输出目标名称?这将极大地帮助调试构建过程。
> make a
building b
building c
building a
Run Code Online (Sandbox Code Playgroud)
最好不要echo $@在每个目标中添加语句。
您可以通过命令行设置所需的调试级别。在您的情况下,看起来basic就足够了:
$ make --debug=b
GNU Make 4.0
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2013 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.
Reading makefiles...
Updating goal targets....
File 'all' does not exist.
File 'foo' does not exist.
Must remake target 'foo'.
Successfully remade target file 'foo'.
File 'bar' does not exist.
Must remake target 'bar'.
Successfully remade target file 'bar'.
File 'baz' does not exist.
Must remake target 'baz'.
Successfully remade target file 'baz'.
Must remake target 'all'.
Successfully remade target file 'all'.
Run Code Online (Sandbox Code Playgroud)
请参阅GNU Make选项。