编译时有什么文件实际上包含

编译时有什么文件实际上包含

问题描述:

我有一个非常大的code,其中很多是传统的code。
我想知道,所有这些文件都在编译参加。
在code写的GNU编译器和大多在C / C ++,但一些在其他程序中了。
任何意见将是非常美联社preciated。

I have a very large code, a lot of which is legacy code. I want to know which of all these files are taking part in the compilation. The code is written in GNU compilers and mostly in C/C++, but some in other programs too. Any advice will be highly appreciated.

谢谢,

卡察夫。

我在linux下编译使用脚本/ Makefile文件的混合。我想以某种方式包装这个构建了一个工具,这将给在构建,$ P $使用pferably使用绝对路径名的所有源文件的输出。

I am compiling under linux with a mix of scripts/makefiles. I want to somehow 'wrap' this build with a tool which will give an output of all the source files used in the build, preferably with absolute path names.

你说什么?

两个选项浮现在脑海中。

Two options come to mind.


  1. 解析编译日志

  1. Parse the compilation log

运行构建,保存日志,然后在日志中搜索。

Run a build, save the log, and then search in the log.

查找那些在编译时打开的文件。

Find the files that are opened during the compilation time.

要做到这一点可能是使用一个系统跟踪工具如 strace的或库跟踪的一种方式如 ltrace 工具,然后看出来的文件打开调用。

A way to do that might be to use a system tracing tool like strace or library tracing tool like ltrace and then look out for file open calls.

又见http://stackoverflow.com/questions/880263/how-can-i-detect-file-accesses-in-linux