add Phil's code for Makefile to fix problems with OSX