gcc -g -idirafter ../include -DTEXT_BASE=0x80010000 -DUSE_HOSTCC -c environment.c
编译u-boot遇到一个不常见的编译选项idirafter,查了官方gcc手册,得到以下解释:
-idirafter dir
Add the directory dir to the second include path. The directories on the second include path are searched when a header file is not found in any of the directories in the main include path (the one that `-I' adds to).
翻译过来就是gcc在选项-I后面的路径找不到的头文件,再在选项-idirafter后面的路径继续找。这样也就解释了选项本身的字面意思,i dir after------在I指向路径之后的补充查找路径。
在这个uboot的编译中,完整命令解释为:增加调试信息,增加了../include头文件查找路径,增加宏定义TEXT_BASE为0x80010000、USE_HOSTCC,只编译不链接源文件environment.c,生成environment.o。
本文解释了编译器选项-idirafter在GCC中的作用,即在-I指定的主搜索路径之外追加查找头文件的路径。针对U-Boot编译,该选项用于设置调试信息、增加特定头文件搜索路径及宏定义,仅编译environment.c源文件。

1420

被折叠的 条评论
为什么被折叠?



