【发布时间】:2013-01-11 07:09:36
【问题描述】:
假设我有一个包含在许多源文件中的头文件,可能具有非常深的层次结构。在每个源对象的先决条件中列出这个通用头文件很无聊,不确定是否有优雅的解决方案。谢谢!
【问题讨论】:
标签: makefile
假设我有一个包含在许多源文件中的头文件,可能具有非常深的层次结构。在每个源对象的先决条件中列出这个通用头文件很无聊,不确定是否有优雅的解决方案。谢谢!
【问题讨论】:
标签: makefile
您可以使用gcc -M 生成此类依赖项。来自TFM:
-M Instead of outputting the result of preprocessing, output a rule suitable for make describing the dependencies of the main source file. The preprocessor outputs one make rule containing the object file name for that source file, a colon, and the names of all the included files, including those coming from -include or -imacros command line options.
【讨论】: