Support building under Ubuntu.

Thanks to sanni for pointing out that -lm needs to be added to
$(LIBS) in order to link successfully with Ubuntu 12.xx.