Depending on the all target will force building of the shared library even if I only intend to install the shared one.

In order to not install outdated stuff there is the "clean" target. Letting the install target depend on "all" is abusive. Another way would be to create separate install rules such as "install", "install-all", "install-shared" etc