I have a pattern which I use with wildcard in order to find files. The pattern is specified in a variable as it is intended to be configurable (it’s in an included makefile). I then need to use the same pattern with patsubst. Is there an easy way switch the * for a %? Obviously there could only be one * in the wildcard pattern.
So, for example, if my wildcard pattern is *.c then I would like to obtain the pattern %.c
This would also need to work for the the following wildcard patterns:
WILD := *.c *.s *.S
WILD := prefix_*.suffix
I had a solution for the first case, where I am just working with extensions, which is to use patsubst itself:
PATSUBST_PATTERN := $(patsubst *.%,\%.%,$(WILD))
Can anyone suggest a way to do this where the * is not at the start of the wildcard pattern?
What about
Output: