refactor out common makefile