Makefile:管理多个包含路径

Makefile: Manage multiple include path

我有一个这样的树的项目:

/arch/arm/include/    
/include/

我想包含 /arch/arm/include/#include <arch/header.h> 的文件和 /include#include <header.h>
文件。

如何在 Makefile 中执行此操作?

谢谢

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

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

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

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

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

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

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