Compile common objects into a shared library.

Signed-off-by: Olli Vanhoja <olli.vanhoja@cs.helsinki.fi>