major reorg of makefile, fix crash when there are no sources

The file has been significantly reorganized and the cases are now documented and easier to follow.  This plugin will now stay out of the way when there are no sources present.