首页 > 其他分享 >u-boot中,if_changed函数的作用

u-boot中,if_changed函数的作用

时间:2024-05-28 22:23:22浏览次数:9  
标签:changed 函数 cmd boot any strip check target

if_changed是定义在 scripts/Kbuild.include 文件中的,

该函数,接受一个参数,作用是判断目标依赖是否有改变,如果有就执行一条shell命令

例如: $(call if_changed,u-boot-spl) 

展开后得到

$(echo-cmd) $(cmd_u-boot-spl); 

cmd_u-boot-spl这个变量需要提前定义

 

###
# if_changed - execute command if any prerequisite is newer than
# target, or command line has changed
# if_changed_dep - as if_changed, but uses fixdep to reveal dependencies
# including used config symbols
# if_changed_rule - as if_changed but execute rule instead
# See Documentation/kbuild/makefiles.txt for more info

ifneq ($(KBUILD_NOCMDDEP),1)
# Check if both arguments are the same including their order. Result is empty
# string if equal. User may override this check using make KBUILD_NOCMDDEP=1
arg-check = $(filter-out $(subst $(space),$(space_escape),$(strip $(cmd_$@))), \
$(subst $(space),$(space_escape),$(strip $(cmd_$1))))
else
arg-check = $(if $(strip $(cmd_$@)),,1)
endif

# Replace >$< with >$$< to preserve $ when reloading the .cmd file
# (needed for make)
# Replace >#< with >$(pound)< to avoid starting a comment in the .cmd file
# (needed for make)
# Replace >'< with >'\''< to be able to enclose the whole string in '...'
# (needed for the shell)
make-cmd = $(call escsq,$(subst $(pound),$$(pound),$(subst $$,$$$$,$(cmd_$(1)))))

# Find any prerequisites that is newer than target or that does not exist.
# PHONY targets skipped in both cases.
any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^)

# Execute command if command has changed or prerequisite(s) are updated.
#
if_changed = $(if $(strip $(any-prereq) $(arg-check)), \
@set -e; \
$(echo-cmd) $(cmd_$(1)); \
printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:)

# Execute the command and also postprocess generated .d dependencies file.
if_changed_dep = $(if $(strip $(any-prereq) $(arg-check) ), \
@set -e; \
$(echo-cmd) $(cmd_$(1)); \
scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(dot-target).tmp;\
rm -f $(depfile); \
mv -f $(dot-target).tmp $(dot-target).cmd, @:)

# Usage: $(call if_changed_rule,foo)
# Will check if $(cmd_foo) or any of the prerequisites changed,
# and if so will execute $(rule_foo).
if_changed_rule = $(if $(strip $(any-prereq) $(arg-check) ), \
@set -e; \
$(rule_$(1)), @:)

标签:changed,函数,cmd,boot,any,strip,check,target
From: https://www.cnblogs.com/zxdplay/p/18219068

相关文章

  • Makefile中,call `$(call)` 函数
    在Makefile中,`$(call...)`是一个函数调用语法,它允许你定义一个名为函数的宏,并在Makefile的其他地方调用它。这种功能提供了一种重用Makefile中复杂或经常重复的代码的方法。`$(call...)`语法的基本形式如下:```make$(callfunction_name,arg1,arg2,...)```这里,`function_nam......
  • SAP:REUSE_ALV_LIST_DISPLAY 函数实现此类型ALV
    *&Report-1类型程序的主要功能是通过WRITE语句为用户提供方便的报表数据.*&与此功能类似的就是利用FUNCTIONALV创建的报表。利用*&REUSE_ALV_LIST_DISPLAY函数实现此类型ALV。*&---------------------------------------------------------------------**&Report......
  • SpringBoot3.2更新声明!
    1从SpringBoot3.1升级1.1参数名称发现SpringBoot3.2使用的SpringFramework版本不再尝试通过解析字节码来推断参数名称。如果您在依赖注入或属性绑定时遇到问题,请务必检查您是否在编译时使用了-parameters选项。有关更多详细信息,请参阅"升级到SpringFramework......
  • SAP: REUSE_ALV_GRID_DISPLAY 函数实现此类型ALV
     *&Report-1类型程序的主要功能是通过WRITE语句为用户提供方便的报表数据.*&与此功能类似的就是利用FUNCTIONALV创建的报表。利用*&REUSE_ALV_GRID_DISPLAY函数实现此类型ALV。*----------------------------------------------------------------------**&-----......
  • C语言中strncpy、strncat、memcpy、memmove函数的详解与比较
    目录目录C语言中strncpy、strncat、memcpy、memmove函数的详解与比较一、strncpy函数二、strncat函数三、memcpy函数四、memmove函数C语言中strncpy、strncat、memcpy、memmove函数的详解与比较一、strncpy函数strncpy是C语言标准库中的一个函数,用于将字符串src复制到字符串d......
  • python 第四章 函数 (pycharm) (2)
    一:变量作用域变量的作用域就是指在代码中变量能使用的位置变量的引用deffunc(a):print(a)data=10func(data)#a=data参数a引用了data的数据data2=20func2(data2)变量的分类全局变量在函数外定义,可以在代码中任意位置使用的变量局部变量在函数......
  • [3B1B]从三角函数到 GF
    三角函数高中数学必一第五章。弧度制通过数学知识可以证明,对于一个圆的圆心角\(α\),其所对的弧\(l\)与半径的比值\(\frac{l}{r}\)是确定的。相应的,\(\frac{l}{r}\)的确定也能确定\(\alpha\),因此我们建立弧度制:\[|\alpha|=\frac{l}{r}\]一个角是正角,当且仅当它的终边......
  • JS-03深入了解构造函数
    目录1引入构造函数2通过构造函数创建对象-内置3 自定义一个构造函数来创建对象3.1 构造函数的概念3.2关于newObject() 3.3构造函数的执行过程3.3.1构造函数的返回值   3.3.2如何判断一个数据是否是复杂数据类型?3.3.3为什么要理解构造函数的返回值?3.3.4......
  • 前端历程(包括html,JavaScript,jQuery,bootstrap)
    前端学习历程jQuery"""jQuery内部封装了原生的js代码(还额外添加了很多功能)能够让你通过书写更少的代码完成js操作类似于python里面的模块在前端模块不叫模块叫"类库"兼容多个浏览器的你在使用jQuery的时候就不需要考虑浏览器兼容问题jQuery的宗旨 writelessdom......
  • springboot在tomcat中启动两次
    文章目录代码配置类问题1.重复的ContextListener/多余的web.xml1.1原因1.2解决方案2.SpringBoot的内置Tomcat没有去掉2.1原因2.2解决方案3.代码中有两个类继承了SpringApplication3.1原因3.2解决方案4.Tomcat的server.xml中的配置问题4.1原因4.2解决方案......