build system cleanup

*   Make makefile portable (OSX/Linux)
*  install GUI shared lib
*  add DESTDIR and PREFIX (simplify life of packages)
*  allow to override CXXFLAGS
*  add some default compiler optimizations