Ensure r is clearly always initialised [minor]
Use $(LDFLAGS) & $(LDLIBS) when linking shared objects

Previously we weren't doing this on the basis that perhaps shared
libraries would want different flags from static test executables,
but we'll cross that bridge if we come to it.  Fixes #36.