Difference between revisions of "Gentoo compile flags"
(→Example files) |
(→Which flags to use) |
||
Line 16: | Line 16: | ||
=== Which flags to use === | === Which flags to use === | ||
− | In order to adjust USE correctly, you have to find out, which instruction set extensions your processor supports. You can use google for this, or look at /proc/cpuinfo. | + | In order to adjust USE correctly, you have to find out, which instruction set extensions your processor supports. You can use google for this, or look at /proc/cpuinfo. If you are using an older version of GCC (below 3.4) you should use: |
− | |||
CFLAGS="-O2 -march=pentium4 -pipe -fomit-frame-pointer" | CFLAGS="-O2 -march=pentium4 -pipe -fomit-frame-pointer" | ||
− | + | As of >=3.4 release of GCC Pentium-M CFLAGs are supported and the following should be used: | |
+ | |||
+ | CFLAGS="-O2 -march=pentium-m -pipe -fomit-frame-pointer" | ||
You might also use -O3, but it may cause crashes in your programs if you optimize too much. | You might also use -O3, but it may cause crashes in your programs if you optimize too much. | ||
Independently of the CPU it's also a good idea to tell portage which libraries to use. If you leave away all the libraries you don't need, you can save compile time, get a smaller binary size and faster programs. | Independently of the CPU it's also a good idea to tell portage which libraries to use. If you leave away all the libraries you don't need, you can save compile time, get a smaller binary size and faster programs. | ||
− | + | With either GCC version you should be using the following USE flags: | |
− | USE="mmx mmx2 sse sse2 | + | |
− | + | USE="mmx mmx2 sse sse2" | |
=== Example files === | === Example files === |
Revision as of 00:11, 20 April 2006
Gentoo compile flagsThis page gives an introduction to Gentoo compile flags. |
About compile flags in GentooOne strength of Gentoo is the ability to use global flags for code optimizing. This is done through the file /etc/make.conf (man page). Since the Pentium Mobile (Centrino) used in some Thinkpads supports the mmx and sse extensions of the insturuction set, using compile flags can speedup programs quite a bit. To use optimized code, you have to adjust the USE (Gentoo Handbook) variable, which contains the libraries and extensions you want to use and the CFLAGS variable, which contains compiler flags, that portage passes along to gcc. If you want to set specific flags for only one package, you can also use the file /etc/portage/package.use instead of the USE variable in make.conf. Which flags to useIn order to adjust USE correctly, you have to find out, which instruction set extensions your processor supports. You can use google for this, or look at /proc/cpuinfo. If you are using an older version of GCC (below 3.4) you should use: CFLAGS="-O2 -march=pentium4 -pipe -fomit-frame-pointer" As of >=3.4 release of GCC Pentium-M CFLAGs are supported and the following should be used: CFLAGS="-O2 -march=pentium-m -pipe -fomit-frame-pointer" You might also use -O3, but it may cause crashes in your programs if you optimize too much. Independently of the CPU it's also a good idea to tell portage which libraries to use. If you leave away all the libraries you don't need, you can save compile time, get a smaller binary size and faster programs. With either GCC version you should be using the following USE flags: USE="mmx mmx2 sse sse2" Example filesThese are the make.conf and package.use files I use for my T40P:
USE="X mmx mmx2 sse sse2 qt kde -gpm -gtk -gtk2 -gnome -arts -alsa -cups -java -esd -v4l -v4l1 -samba -ipv6 -directfb -lirc -svga" CFLAGS="-O2 -march=pentium4 -pipe -fomit-frame-pointer" CHOST="i686-pc-linux-gnu" CXXFLAGS="${CFLAGS}" MAKEOPTS="-j2"
sys-libs/glibc userlocales app-laptop/tpb xosd media-video/mplayer dvd xanim divx4linux network xvid live media-libs/xine-lib dvd Other portage featuresThere are lots of other great features in portage (the Gentoo package managing system). If you want to use Gentoo, you should read the docs on gentoo.org and the man pages of portage and make.conf. |