你做什么使编译器行更短? [英] What do you do to make compiler lines shorter?

查看:180
本文介绍了你做什么使编译器行更短?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常当我与其他人合作项目时,编译器在Makefile中获得的库路径和包含路径的数量随着时间的推移而变得越来越多。

Often when I'm working on a project with others, the amount of library paths and include paths that get sourced by the compiler in the Makefile get more numerous as time goes by. Also the paths can get very long as well.

这里有一个例子:

g++ -c -pipe -O2 -Wall -W -DQT_BOOTSTRAPPED -DQT_MOC -DQT_NO_CODECS
-DQT_LITE_UNICODE -DQT_NO_LIBRARY -DQT_NO_STL -DQT_NO_COMPRESS
-DQT_NO_DATASTREAM -DQT_NO_TEXTSTREAM -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES
-DQT_NO_THREAD -DQT_NO_REGEXP -DQT_NO_QOBJECT -DQT_NO_SYSTEMLOCALE
-DQT_NO_GEOM_VARIANT -DQT_NO_USING_NAMESPACE -D_LARGEFILE64_SOURCE
-D_LARGEFILE_SOURCE -I../../../mkspecs/qws/linux-generic-g++ -I.
-I../../corelib/arch/generic -I../../../include -I. -I../../../include/QtCore
-I. -I.uic/release-shared -o release-shared/moc.o moc.cpp

I M想知道你用什么样的食谱,使编译器线短得多,但仍使用户能够显示原始行,如果他们真的需要这些信息以后的选项。

I'm wondering what kind of recipes you use to make compiler lines much shorter, while still giving the user the option to display the raw lines if they really need that information later.

有没有自动执行此操作的工具?

Are there tools that do this automatically?

推荐答案

如何使用环境变量?

export LONGPATH=/usr/local/projects/include/foo/system/v1
gcc foo.c -o foo -I$LONGPATH

有关更复杂的情况,可以使用包装调用编译器,从而使实际的命令及其参数只显示了错误或警告。
例如,使用cmake例子,很多传统的输出已经大幅下降。

For more complex scenarios, one can use wrappers to invoke the compiler, so that the actual commands and their parameters only show up on errors or warnings. Using cmake for example, much of the conventional output is already downstripped heavily.

同样,可以使用具有gcc的spec文件

这篇关于你做什么使编译器行更短?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆