11.2.6 代码检查
uboot 支持代码检查,使用命令“make C=1”使能代码检查,检查那些需要重新编译的文
件。“make C=2”用于检查所有的源码文件。
顶层 Makefile 中的代码如下:
183 # Call a source code checker (by default, "sparse") as part of the
184 # C compilation.
185 #
186 # Use 'make C=1' to enable checking of only re-compiled files.
187 # Use 'make C=2' to enable checking of *all* source files,
188 # regardless of whether they are re-compiled or not.
189 #
190 # See the file "doc/sparse.txt" for more details, including
191 # where to get the "sparse" utility.
192
193 ifeq ("$(origin C)", "command line")
194 KBUILD_CHECKSRC = $(C)
195 endif
196 ifndef KBUILD_CHECKSRC
197 KBUILD_CHECKSRC = 0
198 endif
第 193 行判断 C 是否来源于命令行。
如果 C 来源于命令行,那就将 C 赋值给变量KBUILD_CHECKSRC,
如果命令行没有 C 的话 KBUILD_CHECKSRC 就为 0。