Add make install/uninstall/.so/.a rules, and fix build with optimizations on