MacOSX makefile added, fixed various errors to make the library and testcases compile on MacOS