Apr 5, 2008

Setting CFLAGS

It turns out the gento-wiki has a great page indicating which GCC -march flag should be set for which CPUs. To determine which CPU you have, run the following at a command prompt:

#> cat /proc/cpuinfo

It will yield a page of output. The first few lines of output from my laptop are below:
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Core(TM)2 Duo CPU T7500 @ 2.20GHz
stepping : 10

The part you're interested in is the 'cpu family' and 'model'. Once you know those find the corresponding entries on http://gentoo-wiki.com/Safe_Cflags. Then create an entry in $HOME/.bashrc file that looks something like this:
CFLAGS="-march=prescott -O3"
CXXFLAGS="${CFLAGS}"
export CFLAGS CXXFLAGS

Of course substitute the -march value for the one you found on the wiki.

No comments: