zoukankan      html  css  js  c++  java
  • uboot学习之二----主Makefile学习之三----静默编译

    第45-54行:

    45 # Deal with colliding definitions from tcsh etc.
    46 VENDOR=
    47
    48 #########################################################################
    49 # Allow for silent builds
    50 ifeq (,$(findstring s,$(MAKEFLAGS))) //判断findstring函数是否为空

    51 XECHO = echo //如果有就echo
    52 else
    53 XECHO = : //如果没有就为空,即不打印
    54 endif
    55


    这一段 主要是关于静默编译的内容


    uboot允许静默编译,开启静默编译主要是通过判断ifeq (,$(findstring s,$(MAKEFLAGS))) 。

    使用方法:在编译时,使用make -s -会作为MAKEFLAGS传给Makefile.

    关于makefile知识点:

    条件判断:主makefile50行 :ifeq (,$(findstring s,$(MAKEFLAGS)))

    《跟我一起学Makefile》第42页:

    条件表达式的语法为:

    <conditional-directive>

    <text-if-true>

    endif

    以及

    <conditional-directiv>

    <text-if-ture>

    else

    <text-if-false>

    endif

    其中<conditional-directiv>表示条件关键字,如“ifeq”。

    第一个关键字ifeq:

    ifeq(<arg1>, <arg2>)

    ifeq 'arg1' 'arg2'
    ifeq “arg1” 'arg2'

    ifeq 'arg1' ”arg2”

    ifeq ”arg1” “arg2”

    比较参数“arg1” 和“arg2”的值是否相同。相同为真。

    第二个关键字ifneq:

    ifneq (<arg1>, <arg2>)

    ifneq 'arg1' 'arg2'

    ifneq “arg1” 'arg2'

    ifneq 'arg1' ”arg2”

    ifneq ”arg1” “arg2”

    比较参数“arg1” 和“arg2”的值是否相同。不同为真。

    第三个关键字ifdef:

    ifdef <variable-name>

    如果变量的值非空,那么表达式为真,否则为假。

    findstring函数

    函数调用语法:

    $(<funciton> <arguments>)

    或者

    ${<function> <arguments>}

    $(findstring <find>, <in>)

    功能:在字串<in>中查找<find>字串。

    返回:如果找到,那么返回<find>,否则返回空字符串。

    所以这里ifeq (,$(findstring s,$(MAKEFLAGS)))

    这里的意思就是如果findstring函数的返回值为空。如果为空,那么ifeq函数的两个参数相等,条件判断为真。执行<text-if-true>.

  • 相关阅读:
    Android将TAB选项卡放在屏幕底部(转)
    unix进程间通信
    C优先级顺序(转)
    C/C++ 内存补齐机制
    Android Sqlite ORM 工具
    类型安全性测试
    反射手册笔记 2.程序集,对象和类型
    CLR笔记:15.委托
    反射手册笔记 4.创建对象
    反射手册笔记 1.灵活的编程方法
  • 原文地址:https://www.cnblogs.com/yr-linux/p/5361885.html
Copyright © 2011-2022 走看看