move common parts of Makefiles to common.mk