Fix the build

LDFLAGS needs to be added last to the build command because of
the more aggressive optimization in some versions of gcc.