Complete rewrite of the makefile