If you use make, run
/proc/cpuinfo | grep processor | wc -l
to see how many processors your box has. Then build with
where x is the number of processors.
edit: Apparently you can just run
make -j and have make pick how many jobs to run. I’m not sure how it decides, though, the man page just says “If the -j option is given without an argument, make will not limit the number of jobs that can run simultaneously.” This comment says that x should be the number of cores plus one, but I’m not sure why that is, either.