Oh sorry, I wasn't clear about that. I run it first where every possible module is built 'M', and then once the system boots up, run lsmod to see which modules are loaded.
Then, I take that list of modules and set them to "Y", and disable everything else. That way, needed libraries are statically linked and unneeded libraries aren't built at all.