> gen/%_png.h: %.png > $(UTILS_SRC)/bin2c "$<" "$@" > Something like .for f in *.png gen/${f}.h: ${f} $(UTILS_SRC)/bin2c "${f}" "${f}.h" .endfor (or maybe ${f:Q} in the rule) depends on how many subdirs this rule is used in.