Add makefile.

Also updated some code, it does error out in places, need to do some fixing.