fix MacOS/BSD, misc

*  fix compilation on MacOS, FreeBSD, and OpenBSD
*  gitignore .o and .a files
*  use local paths in makefile

The header fix is pulled from Mongrel2.