Resolve most compile errors.
Add compilation support by Makefile