Fix makefile.shared as proposed in gentoo bug report #376643

c.f. https://bugs.gentoo.org/show_bug.cgi?id=376643