Makefile:管理多个包含路径

时间:2015-01-06 13:01:39

标签: c makefile

我有一个这种树的项目:

/arch/arm/include/    
/include/

我希望将/arch/arm/include/的文件包含#include <arch/header.h>,将/include的文件包含#include <header.h>

如何在Makefile中执行此操作?

由于

3 个答案:

答案 0 :(得分:2)

这可以通过创建指向arch / arm / include的符号链接include / arch来解决 ln -s arch / arm / include include / arch

然后在makefile中: CFLAGS + = -I / include

答案 1 :(得分:0)

使用-I< include directory >选项。
例如:

$(CC) -o $(TGT) test.c -I/include

答案 2 :(得分:0)

您可以在makefile中添加此方法。假设您的文件系统看起来像这样

   --------------------------------                                                    
   |                 |           |
include            arch         src  
                    |             |
                   arm          makefile
                    |
                  include

LIBS_INC = -I ../ include LIBS_INC + = -I ../ arch / arm / include