osx makefile backporting of commit be34510a9a17b3be83e817d6e58c9023a48e75bc
Merge pull request #49 from toyg/osx_makefile_backport

osx makefile backport of be34510