如何在Makefile中过滤出具有多个条件的文件? [英] How to filter out files with multiple criteria in a Makefile?

查看:678
本文介绍了如何在Makefile中过滤出具有多个条件的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设您像这样过滤cpp个文件

Lets say you filter for cpp files like so

$(wildcard **/*.cpp)

但是,您不希望包含单词foo的文件,也不需要具有确切名称bar.cpp

But you don't want files that contain the word foo and you don't want the file with the exact name bar.cpp

一个人如何将filter-out用于多个条件?

How does one use filter-out with multiple criteria?

推荐答案

这似乎有效.也是递归的.

This seems to work. Also recursively.

$(filter-out $(wildcard **/bar.cpp) $(wildcard **/*foo*), $(wildcard **/*.cpp))

还请注意以下Etan的简单建议.只为完整性而离开我.

Please also note Etan's simpler suggestion below. Leaving mine only for completeness.

这篇关于如何在Makefile中过滤出具有多个条件的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆