Make sed -i work on OSX

Because sed -i works differently on OSX and Linux, we have to do some cross-platform switching in the Makefile.