Add makefile and clean up Linux portability issues.