# [SOLVED] different CFLAGS for different GCC?

## efsinua

hi all!!=)

i have Intel Atom N570 

gcc-4.5 with CFLAGS="-march=atom -O2 -pipe"

and need some gcc-4.4 (for nVidia CUDA tools) but it doesn't support atom

found safe CFLAGS="-march=core2 -O2 -mtune=generic -pipe" but don't want to set it on gcc-4.5

is there any way to set different CFLAGS for different GCC without setting to -march=native?

(don't want to mess up with distcc + crossdev)

maybe there is some special flags like CFLAGS_amd64 and CFLAGS_x86

something like this

CFLAGS_GCC_4.4="-march=core2 -O2 -mtune=generic -pipe"

CFLAGS_GCC_4.5="-march=atom -O2 -pipe"

thanks for any suggestions=)Last edited by efsinua on Sat Jul 23, 2011 11:35 am; edited 1 time in total

----------

## rh1

Not sure about setting different cflags for different version of gcc but if you can't do that, you could set different cflags for the packages you want to build using gcc-4.4 http://www.gentoo-wiki.info/CflagsExceptions

----------

## efsinua

 *rh1 wrote:*   

> Not sure about setting different cflags for different version of gcc but if you can't do that, you could set different cflags for the packages you want to build using gcc-4.4 http://www.gentoo-wiki.info/CflagsExceptions

 

thx=) going to try it=)

----------

## [n00b@localhost]

 *efsinua wrote:*   

> hi all!!=)
> 
> i have Intel Atom N570 
> 
> gcc-4.5 with CFLAGS="-march=atom -O2 -pipe"
> ...

 

You don't need <gcc-4.5 for nvidia-cuda-toolkit-4.0.  Even nvidia-cuda-sdk-4.0 will compile with >=gcc-4.5.  You just need to remove the warnings from the ebuild and /opt/cuda/include/host_config.h.  It's just not officially supported by nVidia so could blow up in your face at some point in the future.

nVidia forum post about nvcc 4.0 and gcc 4.6.

----------

## efsinua

both solutions working but removing warnings is a little creepy and unstable thing=)) 

as for me the only harmless way is creating files or symlinks with own CFLAGS CXXFLAGS LDFLAGS

/etc/portage/bashrc

/etc/portage/env/${CATEGORY}/${PN}

/etc/portage/env/${CATEGORY}/${PN}:${SLOT}

/etc/portage/env/${CATEGORY}/${P}

/etc/portage/env/${CATEGORY}/${PF}

thx for help=))

----------

