Fix Makefile and warnings for osx and linux