Exclude "%templates" dirs from extensions.

This uses the GNU make "filter-out" construction but I think we already depend on GNU make anyway, I'd say because of "foreach" at least.