Uboot Makefile 中 $(origin variable)详解

在阅读Uboot中的Makefile时,发现下面的代码:

    ifdef O
                ifeq ("$(origin O)", "command line")
                BUILD_DIR := $(O)
                endif
                endif

$(origin O)中的origin函数不直接操作变量的值,而告诉你这个变量是从哪里来的,其语法是: $(origin   variable)。

其中,variable是变量的名字而不是引用,所以不需要使用“$”字符。origin函数会以返回值告诉你这个变量的“出生情况”,返回值详情如下:

    1. 返回值为 "undefine"时,表示variable变量未定义。

    2. 返回值为"command line"时,表示variable变量由命令行定义,即由make variable= 传入。

    3. 返回值为“environment”时,表示variable变量是在环境变量中定义。

    4. 返回值为“file”时,表示variable变量是在Makefile中定义。

    5. 返回值为“default”时,表示variable变量是默认定义的。

    6. 返回值为“override”时,表示variable变量由override指示符重新定义。

    7. 返回值为“automatic”时,是一个命令运行中自动化变量。

         

 

 

 

 

猜你喜欢

转载自blog.csdn.net/sean_8180/article/details/81435286