假设我有一个头文件,它包含在许多源文件中,可能具有非常深的层次结构。在每个源对象的先决条件中列出这个公共头文件是非常无聊的,并且不确定是否有一个优雅的解决方案。谢谢!
答案 0 :(得分:1)
您可以使用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.