makefile $(filter PATTERN...,TEXT)

来源:互联网 发布:图像kmeans算法 编辑:程序博客网 时间:2024/04/26 22:59

函数功能:过滤掉字串“TEXT”中不符合模式“PATTERN...”的单词,保留所有符合模式的单词,可以使用多个模式,模式中一般需要包含模式字符“%”,存在多个模式时,模式表达式之间使用空格分开。

返回值:空格分割符合模式的字串


sources := foo.c bar.c baz.s ugh.h

foo: $(sources)

    cc $(filter %.c %.s, $(sources) ) -o foo


$(filter %.c %.s, $(sources) ) 返回值:foo.c bar.c baz.s


0 0
原创粉丝点击