build system: --all-shared: ensure linking against the newly built library.
This patch guards against the case where -lfoo would result in the linking
in of either an external import library libfoo.lib.a, or a static libfoo.a,
be it internal or external to the build system.