Completely revised the makefile to be tidier and allow profiling of the code.