Changes to makefile for OSX

I haven't tested this on Linux. Seems to work on OSX (with limited testing on 10.9). Cheers.