Rewrite large parts of the Makefile based on the changes from the