Pass compiler flags down into leveldb make

Fixes issue#2288. Includes cleanups from Luke's pull 2243.