Found it. Just for someone stumbles upon this, here is what I did. It has something to do with the automatic variable scope. I don't fully understand it, but this is the solution to the problem
.SECONDEXPANSION: $(OBJS): %.html: %.in $$(wildcard *.$$*) do_it $< For target sample.html, it depends on sample.in and on all files *.sample in the directory. Ruud