Fixed a few compiler warnings.
Improved build system.

It should now be more configurable, to suit a wider variety of setups.