Added makefile and minor code change to allow compile on Haiku.