Fix code cleanup for OSX

Under OSX there are different suffixes for shared libraries and modules,
we used the library flavour which is ".dylib" but what we want is the
".so" as used for modules.