首页 > 其他 > 详细

makefile中的条件分支

时间:2020-09-03 19:20:27      阅读:64      评论:0      收藏:0      [点我收藏+]

ifeq-else-endif

if-else形式:

ifeq(<arg1>,<arg2>)
语句1
else
语句2
endif

 如果带多个条件判断,使用下面的形式:

ifeq(<arg1>,<arg2>)
语句1
else ifeq(<arg3>,<arg4>)
语句2
else
语句3 
endif

其中,arg1 arg3可以是makefile中的变量,例如$(HARBOR),示例:根据港口的不同在工程中包含不同的文件:

ifeq ($(HARBOR), SHANG_HAI_TOPIC)
    include ./shanghaitopic.mk
else ifeq ($(HARBOR),SHANG_HAI)
    include ./shanghai.mk
else ifeq ($(HARBOR),SHUI_SHANG_GONG_AN)
    include ./shanghaigongan.mk
endif

ifneq-else-endif

ifneq(<arg1>,<arg2>)
语句1
else
语句2
endif

ifdef-endif

在ifdef语句中,变量名称不能加$(),例如:ifdef RELEASE

ifdef <variable-name>
语句1
endif

ifndef-endif

ifndef <variable-name>
语句1
endif

 

make文件学习:https://blog.csdn.net/haoel/article/details/2887

 

makefile中的条件分支

原文:https://www.cnblogs.com/zyk1113/p/13609135.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!