moved -lm reference to end of lines

I had to move the -lm flag behind the -o to get it to build on Ubuntu 14.04 LTS.