makefile 之 subst

版权声明:本文为博主原创文章,可以随意引用或转载,但未经博主允许不得用于任何商业用途。 https://blog.csdn.net/ustccw/article/details/80590671

用法

$(subst FROM,TO,TEXT)

即将 TEXT 中的东西从 FROM 变为 TO

例一

$(subst a,the,There is a big tree)

返回结果即是 “There is the big tree”

例二

# macro to remove quotes from an argument, ie $(call dequote,$(CONFIG_BLAH))
define dequote
$(subst ",,$(1))
endef 

调用:

CC := $(call dequote,$(CONFIG_TOOLPREFIX))gcc

即去除参数 $1 中所有 “,则 “xtensa-lx106-elf-“gcc 变为 xtensa-lx106-elf-gcc

猜你喜欢

转载自blog.csdn.net/ustccw/article/details/80590671