Refactor makefiles.