Imported tests and switched to Makefile-based build and install.
Build fixes