some upgrades to handle a weird makefile.pl scenario