From Gentoo Wiki
< /etc/portage(Redirected from Make.conf)
Jump to:navigation Jump to:search
This page contains changes which are not marked for translation.
Other languages:
Deutsch • ‎English • ‎italiano • ‎polski • ‎русский • ‎中文(中国大陆)‎ • ‎日本語

The /etc/portage/make.conf file (previously /etc/make.conf) 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 (L10N) options, Portage mirrors, etc.

A very basic version gets installed while extracting the stage tarball and an example setup can be found at /usr/share/portage/config/make.conf.example.


The final Portage configuration is not only based on make.conf. Global settings defined in this file can be refined (or redefined) on a per-package basis in the /etc/portage/package.use/ files as well as through environment variables. Default settings managed by the distribution are available as well (partially through the Portage package defaults, partially through the Gentoo profile that is in use).

Although Portage still supports the old /etc/make.conf file location, its use is discouraged in favor of /etc/portage/make.conf. When both files are available, the settings in /etc/portage/make.conf take precedence over those in /etc/make.conf.


There are many possible variables to customize in make.conf. Only the most commonly used ones are explained further within this article, with an example and a link to a more detailed article (if applicable). For more information, and the full list of variables, consult the make.conf man page by running:

user $man make.conf
Different configurations will require different variables to be set up. Do not treat the following examples as a definitive list, or a minimum set of requirements.


The CHOST variable is passed through the configure step of ebuilds to set the build-host of the system. Note that the Gentoo profile already sets the appropriate CHOST value, and updating it requires insight and experience in build chains.

See the CHOST article for more information.


The CFLAGS and CXXFLAGS variables define the build and compile flags that will be used for all package deployments (some exceptions notwithstanding who filter out flags known to cause problems with the package). The CFLAGS variable is for C based applications, while CXXFLAGS is meant for C++ based applications. Most users will keep the content of both variables the same.

FILE /etc/portage/make.confCommonly used sane setting for CFLAGS and CXXFLAGS
CFLAGS="-march=native -O2 -pipe"

For more information see the GCC optimization article and CFLAGS and CXXFLAGS in the Gentoo Handbook.


The CONFIG_PROTECT variable contains a space-delimited list of directories where Portage will not blindly copy over new versions of files, but instead treat the files as configuration files where the user should manually check if the changes are needed and valid or not. Sub-directories of the listed directories can be excluded through the CONFIG_PROTECT_MASK variable.

The variable has a sane default setting handled by the Portage installation and the users' Gentoo profile. It can be extended through the system environment (which is often used by applications that update the variable through their /etc/env.d file) and the users' /etc/portage/make.conf setting.

FILE /etc/portage/make.confExample CONFIG_PROTECT definitions

See also the Environment variables chapter in the Gentoo Handbook.


The FEATURES variable contains a list of Portage features that the user wants enabled on the system, effectively influencing Portage's behavior. It is set by default via the Gentoo profile, but can be easily updated through /etc/portage/make.conf. Since this is an incremental variable, FEATURES values can be added without directly overriding the ones implemented through the Gentoo profile.

FILE /etc/portage/make.confAdding keepwork to FEATURES in Portage

For more information, please see Portage features in the Gentoo Handbook and the FEATURES article. For a complete list of available features, see man 5 make.conf.


See the GENTOO_MIRRORS article.


The MAKEOPTS variable is used to specify arguments passed to make when packages are built from source. A commonly used setting is the -jN which specifies the number of parallel make jobs that can be used for a single package build. A widely used rule of thumb for N is to take the smaller number of the available logical CPU cores and the amount of RAM divided by 2GB. A physical CPU core employing a X-way SMT technique (eg. Hyper-Threading or SMT2) counts as X logical cores.

FILE /etc/portage/make.confRecommended setting for a dual-core processor with Hyper-Threading enabled with 8GB of RAM

See the MAKEOPTS article for more information.

Read up on EMERGE_DEFAULT_OPTS as this variable influences build behavior as well.


The EMERGE_DEFAULT_OPTS variable entries are appended to the emerge command line. It is often used to allow for concurrent emerge operations through the --jobs N and --load-average X.Y options, which tell Portage how many parallel package builds can be used and up to what system load (load average) the parallelism can be used.

For example, to run up to three jobs in parallel:

FILE /etc/portage/make.confEnabling 3 parallel package builds

For more information, see the EMERGE_DEFAULT_OPTS article.


The PORTAGE_TMPDIR variable defines the location of the temporary files for Portage. The value defaults to /var/tmp, resulting in /var/tmp/portage for the build location, /var/tmp/ccache for Portage's ccache support and so forth.

FILE /etc/portage/make.confDefault PORTAGE_TMPDIR setting

If enough memory is available, building packages can be accelerated by mounting PORTAGE_TMPDIR in RAM. See the article on Portage TMPDIR on tmpfs for more details.


The DISTDIR variable defines the location where Portage will store the downloaded source code archives. Its value defaults to /var/cache/distfiles.

Users can set the DISTDIR variable in /etc/portage/make.conf:

FILE /etc/portage/make.confUsing a different DISTDIR location

For more information, please refer to the DISTDIR article.


The PORTDIR variable was[1] used to point to the main package repository hosted on the system. It has since been deprecated in favor of the location attribute (whose default value is /usr/portage) of the Gentoo repository configuration inside /etc/portage/repos.conf.


The PORTDIR_OVERLAY variable has been deprecated in favor of the repos.conf file.

Layman versions less than 2.3.0 still use the PORTDIR_OVERLAY variable.


See the SYNC article.


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

USE="-kde -qt5 ldap"

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


The ACCEPT_LICENSE variable tells Portage which software licenses are allowed. Packages who have a license that is not accepted cannot be installed on the system.

FILE /etc/portage/make.confTo accept all licenses on all packages (not a good idea)
FILE /etc/portage/make.confTo accept free software only


See LINGUAS in the Localization guide.

FILE /etc/portage/make.conf
LINGUAS="de pt_BR en en_US en_GB"


The USE_EXPAND variable is a list set in profiles/base/make.defaults as of Portage[2]


The CPU_FLAGS_X86 variable informs Portage about the CPU flags (features) permitted by the CPU. This information is used to optimize package builds specifically for the targeted features.

The cpuid2cpuflags utility (found in the app-portage/cpuid2cpuflags package) can be used to query a complete listing of CPU flags supported by the system's processor. After emerging the package, issue:

user $cpuid2cpuflags
CPU_FLAGS_X86: aes avx f16c mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3

This flags can then be added to /etc/portage/make.conf or /etc/portage/package.use/. Note that this is only effective on x86 and amd64 architectures.

See the CPU_FLAGS_X86 article for more information.


See the make.conf section of the Xorg/Guide article and the possible values.


See L10N in the localization guide and this repository news item.

FILE /etc/portage/make.conf
# Defining localization values
L10N="de pt-BR en en-US en-GB"
While common two letter language codes (like de or fr) are identical in LINGUAS and L10N, more complex entries have a different syntax because L10N uses IETF language tags (aka BCP 47). For example, pt_BR and sr@latin in LINGUAS become pt-BR and sr-Latn in L10N, respectively.


For possible values of this USE_EXPAND variable see VIDEO_CARDS.

Portage uses the USE_EXPAND variable called VIDEO_CARDS to enable support for various graphics cards in packages. Setting VIDEO_CARDS to appropriate value(s) will pull in the correct driver(s):

FILE /etc/portage/make.confSet VIDEO_CARDS to intel nvidia radeon vesa
VIDEO_CARDS="intel nvidia radeon vesa"

Substitute the name of the driver(s) to be used. Common choices include nouveau, nvidia, radeon, and intel. After setting or altering VIDEO_CARDS values remember to update the system using the following command so the changes take effect:

root #emerge --ask --changed-use --deep @world

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#make.conf.

For more details see the AMDGPU or the NVIDIA articles.

See also

External resources