makefile使用条件判断
来源:互联网 发布:毛新宇是不是装的知乎 编辑:程序博客网 时间:2024/05/17 04:54
1、条件关键字四个
ifdef <variable-name>
a、ifeq
ifeq (<arg1>,<arg2>)ifeq '<arg1>' '<arg2>'
ifeq "<arg1>" "<arg2>"
ifeq "arg1" 'arg2'
ifeq 'arg1' "arg2"
endif
关键字比较参数arg1和arg2的值是否相同,如果相同则表达式为真,否则为假。
例:
a=1b=2all:ifeq ($a,$b)echo "a=b"elseecho "a!=b"endififeq '$a' '$b'echo "a=b"elseecho "a!=b"endififeq "$a" "$b"echo "a=b"elseecho "a!=b"endififeq '$a' "$b"echo "a=b"elseecho "a!=b"endififeq "$a" '$b'echo "a=b"elseecho "a!=b"endif
make -s -all
a!=b
a!=b
a!=b
a!=b
a!=b
b、ifneq
ifneq (<arg1>,<arg2>)
ifneq '<arg1>' '<arg2>'
ifneq "<arg1>" "<arg2>"
ifneq "arg1" 'arg2'
ifneq 'arg1' "arg2"
endif
关键字比较参数arg1和arg2的值是否相同,如果不相同则表达式为真,否则为假。
例:
a=1b=2all:ifneq ($a,$b)echo "a=b"elseecho "a!=b"endififneq '$a' '$b'echo "a=b"elseecho "a!=b"endififneq "$a" "$b"echo "a=b"elseecho "a!=b"endififneq '$a' "$b"echo "a=b"elseecho "a!=b"endififneq "$a" '$b'echo "a=b"elseecho "a!=b"endifmake -s -all
a=b
a=b
a=b
a=b
a=b
c、ifdef
ifdef关键字表示如果值非空则执行,其格式如下ifdef <variable-name>
ifdef关键字判断变量<variable-name>的值,如果非空,则表达式为真否则为假。
例:
a=ab=ball:ifdef aecho $aelseecho nullendififdef becho $belseecho nullendififdef cecho $celseecho nullendif
make -s -all
a
b
null
ifndef <variable-name>
ifndef关键字判断变量<variable-name>的值。如果为空则表示为真,否则为假。例:
a=ab=bc=all:ifndef aecho $aelseecho nullendififndef becho $belseecho nullendififndef cecho celseecho nullendif
make -s -all
null
null
c
循环编译每个子目录的Makefile
SUBDIRS=src\secall: @if test "$(SUBDIRS)" != ""; then \ it="$(SUBDIRS)" ; \ for i in $$it ; do \ echo "making all in `pwd`/$$i"; \ ( cd $$i ; $(MAKE) ) ; \ if test $$? != 0 ; then \ exit 1 ; \ fi \ done \fi
阅读全文
0 0
- makefile使用条件判断
- Makefile --使用条件判断
- Makefile (七) 使用条件判断
- makefile变量使用及其条件判断
- MakeFile精华【五】--使用条件判断
- Makefile学习之使用条件判断
- makefile详解 (七) 使用条件判断
- make(六)makefile中使用条件判断
- 学习Makefile第五课------使用判断条件
- Makefile 条件判断
- Makefile 条件判断
- makefile--条件判断
- makefile中的条件判断
- makefile条件判断
- Makefile详解-条件判断
- Makefile 条件判断语句
- 跟我一起写makefile-6(使用条件判断)
- Makefile中的变量及条件判断的使用
- AndroidManifest中activity属性参数设置大全
- 数据库中事件的理解总结
- 《腾讯之道》读书笔记
- 面试总结之泛型基础知识
- 半精度浮点数取5bit指数位
- makefile使用条件判断
- 如何破解密码的哈希值,破解双MD5密码值
- 51nod 1455 宝石猎人(记忆化搜索)
- 19. Yii 2.0 数据分页
- 五个常见Java排序算法
- c++二维数组以指针数组形式作为形参传进函数
- 开源Android容器化框架Atlas开发者指南
- 四、扩展的参数处理
- static_cast、dynamic_cast、const_cast和reinterpret_cast总结