Auto detect OS in makefile, and fix movement bug.