add Makefile; fix compile errors under Mac OS X(10.10.1)