I believe the configuration is misleading users to override profiles. I have installed gentoo a couple of times and every time I have consulted the above mentioned file. As a result my make.conf, contained CFLAGS like this: CFLAGS="-O2 -pipe -march=native" The first two options are by coincidence also set by /usr/portage/profiles/arch/amd64/make.defaults:CFLAGS="-O2 -pipe" So I never noticed it's a problem. But switching to another profile means my hard coded CFLAGS ignore those from the profile. Here is a demo: $ grep -r CFLAGS /etc/portage/make.conf #CFLAGS="${CFLAGS} -march=native" CFLAGS="-march=native" CXXFLAGS=${CFLAGS} oznt@yeni2 ~/Software/tiny-cms $ sudo emerge figlet Calculating dependencies... done! >>> Verifying ebuild manifests >>> Emerging (1 of 1) app-misc/figlet-2.2.5::gentoo * figlet-2.2.5.tar.gz BLAKE2B SHA512 size ;-) ... [ ok ] >>> Unpacking source... >>> Unpacking figlet-2.2.5.tar.gz to /var/tmp/portage/app-misc/figlet-2.2.5/work >>> Source unpacked in /var/tmp/portage/app-misc/figlet-2.2.5/work >>> Preparing source in /var/tmp/portage/app-misc/figlet-2.2.5/work/figlet-2.2.5 ... >>> Source prepared. >>> Configuring source in /var/tmp/portage/app-misc/figlet-2.2.5/work/figlet-2.2.5 ... >>> Source configured. >>> Compiling source in /var/tmp/portage/app-misc/figlet-2.2.5/work/figlet-2.2.5 ... make -j3 clean rm -f *.o *~ core figlet chkfont make -j3 CC=x86_64-pc-linux-gnu-gcc LD=x86_64-pc-linux-gnu-gcc CFLAGS=-march=native 'LDFLAGS=-Wl,-O1 -Wl,--as-needed' prefix=/usr all x86_64-pc-linux-gnu-gcc -c -march=native -DTLF_FONTS -DDEFAULTFONTDIR=\"/usr/share/figlet\" \ -DDEFAULTFONTFILE=\"standard\" -o figlet.o figlet.c x86_64-pc-linux-gnu-gcc -c -march=native -DTLF_FONTS -DDEFAULTFONTDIR=\"/usr/share/figlet\" \ -DDEFAULTFONTFILE=\"standard\" -o zipio.o zipio.c x86_64-pc-linux-gnu-gcc -c -march=native -DTLF_FONTS -DDEFAULTFONTDIR=\"/usr/share/figlet\" \ -DDEFAULTFONTFILE=\"standard\" -o crc.o crc.c x86_64-pc-linux-gnu-gcc -c -march=native -DTLF_FONTS -DDEFAULTFONTDIR=\"/usr/share/figlet\" \ -DDEFAULTFONTFILE=\"standard\" -o inflate.o inflate.c x86_64-pc-linux-gnu-gcc -c -march=native -DTLF_FONTS -DDEFAULTFONTDIR=\"/usr/share/figlet\" \ -DDEFAULTFONTFILE=\"standard\" -o utf8.o utf8.c x86_64-pc-linux-gnu-gcc -c -march=native -DTLF_FONTS -DDEFAULTFONTDIR=\"/usr/share/figlet\" \ -DDEFAULTFONTFILE=\"standard\" -o chkfont.o chkfont.c x86_64-pc-linux-gnu-gcc -Wl,-O1 -Wl,--as-needed -o figlet figlet.o zipio.o crc.o inflate.o utf8.o x86_64-pc-linux-gnu-gcc -Wl,-O1 -Wl,--as-needed -o chkfont chkfont.o >>> Source compiled. >>> Test phase [not enabled]: app-misc/figlet-2.2.5 >>> Install figlet-2.2.5 into /var/tmp/portage/app-misc/figlet-2.2.5/image/ category app-misc make -j3 DESTDIR=/var/tmp/portage/app-misc/figlet-2.2.5/image/ BINDIR=/usr/bin MANDIR=/usr/share/man prefix=/usr install mkdir -p /var/tmp/portage/app-misc/figlet-2.2.5/image//usr/bin mkdir -p /var/tmp/portage/app-misc/figlet-2.2.5/image//usr/share/man/man6 mkdir -p /var/tmp/portage/app-misc/figlet-2.2.5/image//usr/share/figlet cp figlet chkfont figlist showfigfonts /var/tmp/portage/app-misc/figlet-2.2.5/image//usr/bin cp figlet.6 chkfont.6 figlist.6 showfigfonts.6 /var/tmp/portage/app-misc/figlet-2.2.5/image//usr/share/man/man6 cp fonts/*.flf /var/tmp/portage/app-misc/figlet-2.2.5/image//usr/share/figlet cp fonts/*.flc /var/tmp/portage/app-misc/figlet-2.2.5/image//usr/share/figlet >>> Completed installing figlet-2.2.5 into /var/tmp/portage/app-misc/figlet-2.2.5/image/ Figlet is compiled just with "-march=native" no options from my profile. Changing CFLAGS: $ grep -r CFLAGS /etc/portage/make.conf CFLAGS="${CFLAGS} -march=native" #CFLAGS="-march=native" CXXFLAGS=${CFLAGS} $ sudo emerge figlet Calculating dependencies... done! >>> Verifying ebuild manifests >>> Emerging (1 of 1) app-misc/figlet-2.2.5::gentoo * figlet-2.2.5.tar.gz BLAKE2B SHA512 size ;-) ... [ ok ] >>> Unpacking source... >>> Unpacking figlet-2.2.5.tar.gz to /var/tmp/portage/app-misc/figlet-2.2.5/work >>> Source unpacked in /var/tmp/portage/app-misc/figlet-2.2.5/work >>> Preparing source in /var/tmp/portage/app-misc/figlet-2.2.5/work/figlet-2.2.5 ... >>> Source prepared. >>> Configuring source in /var/tmp/portage/app-misc/figlet-2.2.5/work/figlet-2.2.5 ... >>> Source configured. >>> Compiling source in /var/tmp/portage/app-misc/figlet-2.2.5/work/figlet-2.2.5 ... make -j3 clean rm -f *.o *~ core figlet chkfont make -j3 CC=x86_64-pc-linux-gnu-gcc LD=x86_64-pc-linux-gnu-gcc 'CFLAGS=-O2 -pipe -march=native' 'LDFLAGS=-Wl,-O1 -Wl,--as-needed' prefix=/usr all x86_64-pc-linux-gnu-gcc -c -O2 -pipe -march=native -DTLF_FONTS -DDEFAULTFONTDIR=\"/usr/share/figlet\" \ -DDEFAULTFONTFILE=\"standard\" -o figlet.o figlet.c x86_64-pc-linux-gnu-gcc -c -O2 -pipe -march=native -DTLF_FONTS -DDEFAULTFONTDIR=\"/usr/share/figlet\" \ -DDEFAULTFONTFILE=\"standard\" -o zipio.o zipio.c x86_64-pc-linux-gnu-gcc -c -O2 -pipe -march=native -DTLF_FONTS -DDEFAULTFONTDIR=\"/usr/share/figlet\" \ -DDEFAULTFONTFILE=\"standard\" -o crc.o crc.c x86_64-pc-linux-gnu-gcc -c -O2 -pipe -march=native -DTLF_FONTS -DDEFAULTFONTDIR=\"/usr/share/figlet\" \ -DDEFAULTFONTFILE=\"standard\" -o inflate.o inflate.c x86_64-pc-linux-gnu-gcc -c -O2 -pipe -march=native -DTLF_FONTS -DDEFAULTFONTDIR=\"/usr/share/figlet\" \ -DDEFAULTFONTFILE=\"standard\" -o utf8.o utf8.c x86_64-pc-linux-gnu-gcc -c -O2 -pipe -march=native -DTLF_FONTS -DDEFAULTFONTDIR=\"/usr/share/figlet\" \ -DDEFAULTFONTFILE=\"standard\" -o chkfont.o chkfont.c x86_64-pc-linux-gnu-gcc -Wl,-O1 -Wl,--as-needed -o chkfont chkfont.o x86_64-pc-linux-gnu-gcc -Wl,-O1 -Wl,--as-needed -o figlet figlet.o zipio.o crc.o inflate.o utf8.o >>> Source compiled. >>> Test phase [not enabled]: app-misc/figlet-2.2.5 >>> Install figlet-2.2.5 into /var/tmp/portage/app-misc/figlet-2.2.5/image/ category app-misc make -j3 DESTDIR=/var/tmp/portage/app-misc/figlet-2.2.5/image/ BINDIR=/usr/bin MANDIR=/usr/share/man prefix=/usr install mkdir -p /var/tmp/portage/app-misc/figlet-2.2.5/image//usr/bin mkdir -p /var/tmp/portage/app-misc/figlet-2.2.5/image//usr/share/man/man6 mkdir -p /var/tmp/portage/app-misc/figlet-2.2.5/image//usr/share/figlet cp figlet chkfont figlist showfigfonts /var/tmp/portage/app-misc/figlet-2.2.5/image//usr/bin cp figlet.6 chkfont.6 figlist.6 showfigfonts.6 /var/tmp/portage/app-misc/figlet-2.2.5/image//usr/share/man/man6 cp fonts/*.flf /var/tmp/portage/app-misc/figlet-2.2.5/image//usr/share/figlet cp fonts/*.flc /var/tmp/portage/app-misc/figlet-2.2.5/image//usr/share/figlet >>> Completed installing figlet-2.2.5 into /var/tmp/portage/app-misc/figlet-2.2.5/image/ Now figlet is compiled with CFLAGS from __both__ my /etc/portage/make.conf and from /usr/portage/profiles/arch/amd64/make.defaults. Hence, I believe the CFLAGS shown after "Decent Examples:" in the file /usr/share/portage/config/make.conf.example should be changed to: #CFLAGS="${CFLAGS} -mtune=k8 -O2 -pipe" #CFLAGS="${CFLAGS} -march=athlon64 -O2 -pipe or even better, explain that setting CFLAGS without a refernece to ${CFLAGS} would override everything set by the select gentoo profile.
It's misleading if you assume that CFLAGS is an "incremental" variable like FEATURES or USE. Most variables are not incremental variables. I'm not sure that it's a good idea to reference the profile CFLAGS setting in your CFLAGS setting. Having your CFLAGS be sensitive to profile changes could potentially have both positive and negative consequences.
Hi, Thanks for the reply. So, can you explain when are the profile flags used? My example shows that they are not used. Therefore, I don't understand if I don't set $CFLAGS before my own why do I need to set a profile if it is ignored?
Hang on a minute. Handbook says we should set CFLAGS (or more recently COMMON_FLAGS) and yet we shouldn't be overriding profile defaults in our make.conf? And is there reasonable consistency between the default make.conf created by catalyst here for the installation stages?! A bit of clarification would be good here, as the OP's example config further confuses the issue.