MAKEOPTS

MAKEOPTS is Article description::a variable that defines how many parallel make jobs can be launched from Portage. It can be set in the configuration file.

The parallel jobs entry ensures that, when is invoked, it knows how many parallel sessions it is allowed to trigger (when parallel sessions are possible of course). This is completely within the scope of that make command and has no influence on parallel installations (which is triggered through with  option). The recommended value is the number of logical processors in the CPU.

On a system with one Intel Core i7 CPU the following command shows the numbering of the available logical CPUs.

In this example 8 logical CPUs are available, 4 physical cores each with 2 threads, hence one can set the MAKEOPTS variable to:

Another item to consider is RAM usage. Recent gcc versions have been known to take 1 GB to 1.5 GB of RAM per job. If the system has the 8 logical CPUs from the previous example, but only 4 GB RAM, the MAKEOPTS value should be lowered to. This is so that the system has RAM to run the basics as well as compile without hitting swap very often slowing things down.

For example, to measure the time needed to compile the package with 4 threads one can run:

MAKEOPTS on a per-package basis
You can emerge packages with different MAKEOPTS settings on a per-package basis. See /etc/portage/package.env for details.

External resources

 * MAKEOPTS=”-j${core} +1″ is NOT the best optimization
 * Parallel Builds With Gentoo’s Emerge