more Makefile bug fixes and improvements