makefile 之 subst

用法

$(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

你可能感兴趣的:(C)