如何格式化/更改 qmake 构建输出
如何格式化 make 输出(!!仅通过更改 qmake 项目文件!!)。 我的编译行继续增长,并且单行警告/错误几乎在它们之间消失。
我正在考虑诸如
$(CC) in.ext -o out.ext
感谢之类的事情
how can I format the make output (!!by only changing the qmake project file!!).
My compilation lines continue growing, and the one-line-warnings/errors almost disappear between them.
I am thinking of something like
$(CC) in.ext -o out.ext
thanks in regard
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在 qmake 中,您可以添加一个静默配置选项:(
注意:我认为这就是命令。它与此类似。)
它应该抑制大部分输出,并且仅打印诸如“compiling ao”之类的行”,以及您的警告和错误。我相信这类似于
make
的.SILENT.
指令(我认为这就是那个......)但是,您可能需要小心这一点,因为它抑制错误解析器喜欢使用的大量信息。例如,如果您使用
SUBDIRS
配置进行编译,则当它更改为不同的目录时,它不会打印出来。In
qmake
, you can add a silent configuration option:(note: I think that's the command. It's something similar to this.)
Which should suppress most of the output, and only print lines like "compiling a.o", along with your warnings and errors. I believe this is similar to
make
's.SILENT.
directive (I think that's the one...)You may want to be careful with this, however, because it suppresses a lot of information that error parsers like to use. For example, if you are compiling with a
SUBDIRS
configuration, it won't print out when it changes to the different directories.有不同的方法。并且您可以使它们可配置。
@
符号,则命令本身不会被打印,但其输出会被打印。-Werror
添加到您的CFLAGS
变量中(您确实有一个,不是吗?这是一种常见的做法!),您肯定会不会错过任何警告——构建将在第一个警告之后停止。/dev/null
,只留下错误流(这不适用于您的特定情况,因为gcc通常不会产生输出,但是可能对其他命令有帮助)。不幸的是,对于
qmake
仅适用第二种方法。添加到您的项目文件:生成的 makefile 在调用编译器时将使用这些标志,因此构建将在每次警告时停止。
(一旦出现问题,本节将移至另一个问题)。
对于通常的制作,你可以使用它们——你可以将它们全部配置!示例如下:
因此,如果您像这样调用
make
:它将打印所有内容。如果您调用,则
默认情况下将使用
short
值(请注意?=
运算符而不是通常的=
!),并且规则将扩展为这样的版本将满足您的需求。
这种带有配置的方法被用于生产代码中。例如,我在 Ubuntu 的 IcedTea makefile 中看到了它。
There are different approaches. And you can make them configurable.
@
sign in front of the line within rule, the command itself won't be printed, but its output will.-Werror
to yourCFLAGS
variable (you do have one, don't you? It's a common practice!), you definitely won't miss any warning--the build will stop after the first one./dev/null
, leaving only error stream (this is not for your particular case, because gcc usually doesn't yield output but may be helpful for other commands).Unfortunately, for
qmake
only the second approach applies. Add to your project file:And the makefiles generated will use these flags when they invoke compiler, so the build will stop at every warning.
(this section will be moved to another question as soon an one appears).
For usual make you can use it all--you can make it all configurable! Here's the example:
So, if you invoke
make
like this:it will print everything. If you invoke
the
short
value will be used by default (note the?=
operator instead of usual=
!) and the rules will expand to such versionwhat will give much as you need.
Such approach, with configuration, is used in production code. For example, I saw it in Ubuntu's IcedTea makefiles.
您可以使用“@”抑制打印输出并回显您想要看到的内容:
简单示例:
You can suppress the printout with '@' and echo what you want to see:
Simple Example: