Andy Polyakov points out there are default rules in make in gmake for this.