确定源文件的列表(*。[CH])为复杂的构建与scons的 [英] Determine list of source files (*.[ch]) for a complex build with scons

查看:155
本文介绍了确定源文件的列表(*。[CH])为复杂的构建与scons的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设你有一个复杂的源代码树一个C项目,很多大量的文件目录。利用Scons构建支持多个目标(I386,SPARC,PowerPC的)和多个变种(调试,发布)。这里有一个 sconstruct 在根(引用各种 sconscripts ),做正确的事所有这些,与被称为参数指定的目标和变异,如 scons的目标= i386的变种=发布

Suppose you have a complex source tree for a C project, lots of directories with lots of files. The scons build supports multiple targets (i386, sparc, powerpc) and multiple variants (debug, release). There's an sconstruct at the root (referencing various sconscripts) that does the right thing for all of these, when called with arguments specifying target and variant, e.g. scons target=i386 variant=release.

有一种简单的方法来确定哪些源文件(* .c和* .h)中每一种构建将使用(他们都是略有不同)?我的理论是,scons的需要计算该文件中设置反正知道哪些文件进行编译,以及何时重新编译。它可以提供这些信息?

Is there an easy way to determine which source files (*.c and *.h) each of these builds will use (they are all slightly different)? My theory is that scons needs to compute this file set anyway to know which files to compile and when to recompile. Can it provide this information?

我做什么的的想做的事:

What I do not want to do:


  • 请一个详细的构建和后处理它(反正大概也不会告诉* .h文件)

  • 找到。 -name'*。[CH] 也打印不需要的文件进行单元测试和其他的cruft,而不是针对特定

  • Log a verbose build and postprocess it (probably wouldn't tell *.h files anyway)
  • find . -name '*.[ch]' also prints unwanted files for unit testing and other cruft and is not target specific

我非常希望做 scons的目标= i386的变种=释放printfileset ,看到的* [CH]文件正确的列表。然后这个列表可以作为进一步的源文件改写(munging)工具,如doxygen的输入。

Ideally I would like to do scons target=i386 variant=release printfileset and see the proper list of *.[ch] files. This list could then serve as input for further source file munging tools like doxygen.

推荐答案

有所有挤在这里汇集了几个问题:

There are a few questions all squashed together here:


  • 您可以使用--dry-运行标志运行编译器prevent SCons的

  • 您可以通过使用--debug =树或--tree =所有的标志,这取决于你所运行得到SCons的依赖关系树

  • 指定的文件,每行一个,你可以使用grep过滤出那些你感兴趣的事情的清单。

当你把所有的一起你最终是这样的:

When you put all of that together you end up with something like:

scons target=i386 variant=release printfileset -n --tree=all | egrep -i '^ .*\.(c|h|cpp|cxx|hpp|inl)$'

这篇关于确定源文件的列表(*。[CH])为复杂的构建与scons的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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