Refactoring makefiles