Factor out redudent code in Makefile