Minor fixes and improvements in makefiles