Fix compilation of WQ bindings.

If we link against systemd (for the recent debug journal changes), linking the binding shared objects would fail.

This PR changes the Makefiles to properly set various LDFLAGS. It also includes some various dependency fixes.