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。