Modifications to build system.

* Use 'snazzier' Makefile originally from template.
* Add optimization -O2 to build.
* Fix uninitialized bRes in 'check_table_exists' function.
* Do not need the database to be checked in, created from scratch if it doesn't exist.