Refine makefiles