I want a pattern rule with dependencies constructed both from the stem and using wildcards, i.e. something like
$(FILES): %.o: %.c $(wildcard %*.c)
This doesn't seem to work: the stem % is not expanded within the wildcard function (see http://www.gnu.org/software/make/manual/html_node/Pattern-Rules.html), while the automatic variable $* seems not to be recognized when listing dependencies.
Is there a (not too kludgy) way of doing something like this?