Filtering using multiple wildcards
filtering, glob, gnu-make, makefile, wildcard
Solution
Try
relevant = $(foreach a,$^,$(if $(findstring irrelevant,$a),,$a))
Problem
I've git a project where, at some point in its Makefile, I'm filtering out stuff from a certain directory: ``` relevant = $(filter-out irrelevant/%,$^) ``` Now I want to use this in a `VPATH`-enabled environment. So the paths of my dependencies in `$^` might not start with `irrelevant` any more, but instead something like `../src/irrelevant` or similar. Is there a way to filter-out anything that contains `irrelevant`, in any position? I.e. something like the following? ``` relevant = $(filter-out %irrelevant/%,$^) ``` This doesn't work, since apparently patterns for `filter-out` can contain only a single `%` wildcard. I know I could possibly achieve this via a shell invocation, grep or whatever, but I was hoping for some combinations of functions inside the Makefile.