Complete rewrite of the Makefile

Much better support for file upodates and less work to be done only when needed. All rules are optimized and dependent on actual files. Updating library dependencies are also supported from the main project.