通常当我正在与别人的一个项目,库路径量,包括获得由编译器在Makefile来源的路径获得更多的无数随着时间的推移。也路径可以得到非常长为好。

下面是一个例子:

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

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

有没有自动完成这一工具?

有帮助吗?

解决方案

如何使用环境变量?

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

对于更复杂的情况下,人们可以使用包装器来调用编译器,以使得实际命令及其参数仅显示在错误或警告。 使用例如cmake的,许多传统的输出的已被重downstripped。

类似地,有使用用gcc 规格文件的可能性

其他提示

您不仅可以让你的编译器输出较短,您可以的ColorCode它,并添加一个详细标志。输出会是这个样子:

替代文字http://img526.imageshack.us/img526/9572/sconsf.png

下面是如何(彩色主题从利用Scons维基被盗):

import os,sys
colors = {}
colors['cyan']   = '\033[96m'
colors['purple'] = '\033[95m'
colors['blue']   = '\033[94m'
colors['green']  = '\033[92m'
colors['yellow'] = '\033[93m'
colors['red']    = '\033[91m'
colors['end']    = '\033[0m'

#If the output is not a terminal, remove the colors
if not sys.stdout.isatty():
   for key, value in colors.iteritems():
      colors[key] = ''

compile_source_message = '%s\nCompiling %s==> %s$SOURCE%s' % \
   (colors['blue'], colors['purple'], colors['yellow'], colors['end'])

compile_shared_source_message = '%s\nCompiling shared %s==> %s$SOURCE%s' % \
   (colors['blue'], colors['purple'], colors['yellow'], colors['end'])

link_program_message = '%s\nLinking Program %s==> %s$TARGET%s' % \
   (colors['red'], colors['purple'], colors['yellow'], colors['end'])

link_library_message = '%s\nLinking Static Library %s==> %s$TARGET%s' % \
   (colors['red'], colors['purple'], colors['yellow'], colors['end'])

ranlib_library_message = '%s\nRanlib Library %s==> %s$TARGET%s' % \
   (colors['red'], colors['purple'], colors['yellow'], colors['end'])

link_shared_library_message = '%s\nLinking Shared Library %s==> %s$TARGET%s' % \
   (colors['red'], colors['purple'], colors['yellow'], colors['end'])

java_compile_source_message = '%s\nCompiling %s==> %s$SOURCE%s' % \
   (colors['blue'], colors['purple'], colors['yellow'], colors['end'])

java_library_message = '%s\nCreating Java Archive %s==> %s$TARGET%s' % \
   (colors['red'], colors['purple'], colors['yellow'], colors['end'])

env = Environment()
AddOption("--verbose",action="store_true", dest="verbose_flag",default=False,help="verbose output")
if not GetOption("verbose_flag"):
  env["CXXCOMSTR"] = compile_source_message,
  env["CCCOMSTR"] = compile_source_message,
  env["SHCCCOMSTR"] = compile_shared_source_message,
  env["SHCXXCOMSTR"] = compile_shared_source_message,
  env["ARCOMSTR"] = link_library_message,
  env["RANLIBCOMSTR"] = ranlib_library_message,
  env["SHLINKCOMSTR"] = link_shared_library_message,
  env["LINKCOMSTR"] = link_program_message,
  env["JARCOMSTR"] = java_library_message,
  env["JAVACCOMSTR"] = java_compile_source_message,

用 “scons的--verbose” 编译看到正常笨重的gcc输出。

如果它主要是在“做”,导致烦恼,你也可以改变你的Makefile不呼应编译线,但是,而不是有类似的巨大线条喷涌:

     .cpp.o:
          @echo $(CC) $<
          @$(CC) $(FLAGS) -c -o $@ $<

在“@”抑制命令行的回波

在scons的,我插入新行到我的命令发生器,以使长命令的详细可读:

e.g。

tool \
    -opt1 bar1 \
    -opt2 bar2 \
    -opt3 bar3 \
    -opt4 bar4

然后我构造的命令串时,以减少杂波创建本地方法。

cmds = []
def l(line,indent=1):
    cmds.append(indent*'    '+line)
l('tool',0)
l('-opt1 bar1')
l('-opt2 bar2')
l('-opt3 bar3')
l('-opt4 bar4')

return '\\\n'.join(cmds)
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top