/etc/portage/make.conf

The (formerly ) file is used to customize the Portage environment on a global level. Settings here will apply to every package that is emerged; they control many elements of Portage functionality such as global USE flags, language (linguas) options, Portage mirrors, etc.

An example setup can be found at

Precedence
Portage configuration is not limited to, global settings defined in this file are refined on a per-package basis in the files, as well as the local environment.

may exist as or, however the latter is deprecated for the former. Therefore if settings exist in should be migrated to. Settings from precedence over those in.

Variables
There are many possible variables to customize in, but only the most commonly used are explained in detail within this article. For more information, and the full list of variables, consult the man page by running:

CHOST
This variable is passed through the configure step of ebuilds to set the build-host of the system. See the CHOST article. Note that the profile already should have defined the appropriate CHOST value.

CFLAGS and CXXFLAGS
For example:

For details see the CFLAGS article and Handbook:Parts/Installation/Stage.

GENTOO_MIRRORS
This variable defines a list of Gentoo mirrors to check before downloading from the source defined in the ebuild. Properly chosen mirrors will generally be able to offer faster download speeds. Try using the command to find the fastest mirror server.

See the Mirrors page on the main site for available URLs.

MAKEOPTS
This variable is used to specify arguments passed to make when packages are built from source. Make can be told to run multiple jobs in parallel (a potentially substantial speed increase, depending on processor). This is done via, which will allow make to spawn up to N threads per invocation (job). A widely used rule of thumb for  is to take the number of available cores (hyperthreaded cores count as 2) and add one. So a hyperthreaded dual-core would use a value of  for. This rule is optimized for a single job running at a time with a large number of threads.

This value may need to be changed if  job control is used. See below.

EMERGE_DEFAULT_OPTS
Entries here are appended to the emerge command line. Two particular options are of interest, specifically  and , which run parallel emerge jobs subject to the load-average limit.

(short form: ), runs   (number) jobs at a time (without an argument,   will flood the processor with as many jobs as possible, and is not recommended). For example, to run up to three jobs in parallel:

A typical value for N would be equal to the number of cores. (see below)

When used with  (short form  ), emerge will try to keep the load average of the system less than , a floating point number. If  is set as well, then it will run up to the limit indicated by that parameter.

The load average value is the same as displayed by  and for an N-core system, a load average of   would be a 100% load. Another rule of thumb here is to set  which will limit the load to 90%, thus maintaining responsiveness.

NOTE: When  is used with   the number of possible threads created would be up to   threads. Therefore, both variables need to be set with each other in mind as they create up to K jobs each with up to N threads.

These two settings are better suited for long emerges including multiple files to make the most of the  parameter. They can also cause emerge errors in some cases, so use with caution and be prepared to comment these out if problems arise.

PORTAGE_TMPDIR
The PORTAGE_TMPDIR variable defines the location of the temporary build directories. The value defaults to.

PORTAGE_TMPDIR should not be set to point anywhere under the location of a repository.

DISTDIR
See DISTDIR article.

PORTDIR
The PORTDIR variable has been deprecated in favor of settings in.

PORTDIR_OVERLAY
This variable has been deprecated in favor of settings in.

Versions < 2.3.0 of Layman still use the PORTDIR_OVERLAY variable.

SYNC
See SYNC.

USE
The USE variable allows the system wide setting or deactivation of USE flags in a space separated list.

For a fine grained per package control of USE flags, the file should be used instead.

USE_EXPAND
The USE_EXPAND list is set in profiles/base/make.defaults as of Portage 2.0.51.20.

CPU_FLAGS_X86
See this news item. and CPU_FLAGS_X86.

INPUT_DEVICES
For possible values of this USE_EXPAND variable see INPUT_DEVICES.

L10N
See L10N in the Localization guide and this Repository News Item. For possible values of this USE_EXPAND variable see L10N.

VIDEO_CARDS
For possible values of this USE_EXPAND variable see VIDEO_CARDS.

For the average user, if a graphical desktop environment is to be used this variable should be explicitly defined. For further information see Xorg/Guide.

External resources

 * https://devmanual.gentoo.org/general-concepts/features/