Backport makefile enhancements