Fixed Makefile to build all targets without conflicts.

Fixed tests where they assumed presence of /dev/tty.

Added building shared library.

Added intall targets for all libraries, headers and executables.