modify makefile to allow more customisations

allow compiler/flags to be defined outside the makefile (for submake)

compile shared library from .c files not objects (I need the shared lib
to be compiled by a different CC from the static lib and this seems like
a nice way apart from the a small increase in compile time).