Add support for versionned shared libs and general cleanup of makefiles