Linux.com

export?

Link to this post 06 Jun 09

I'm trying to give the option to run ccache all day instead of typing in each time to use ccache while I compile, "temp env"
if I do export gcc="ccache gcc" or would alias be better?

Link to this post 06 Jun 09

tw3ak wrote:

I'm trying to give the option to run ccache all day instead of typing in each time to use ccache while I compile, "temp env"
if I do export gcc="ccache gcc" or would alias be better?

In this case, I think you'd be best off setting your CC variable, like this:

 export set CC='ccache gcc' 

I've never used ccache before, though, so someone correct me if I'm wrong.

Link to this post 06 Jun 09

ok,
I'm a newb so , that's what is great about this forum. I get sweet answers and no nasties, like on IRC.
Thank YOU!!!

I'll have to lookup the man page on set, as I haven't gotten that far yet . I 've read to users' guides and I'm about the second half of my second one. Just the first couple of pages of shell programming.

Link to this post 10 Jun 09

Actually when you do the export gcc="ccache gcc" you just create the environment variable. To refer this variable from command prompt you need to place $ sign before it name. This is a little bit unusable, I think it is better to use alias gcc="ccache gcc" command instead of export.

Link to this post 10 Jun 09

kris_z wrote:

Actually when you do the export gcc="ccache gcc" you just create the environment variable. To refer this variable from command prompt you need to place $ sign before it name. This is a little bit unusable, I think it is better to use alias gcc="ccache gcc" command instead of export.

Yeah, that was the point - Makefiles inheriting the CC env var, instead of using shell aliases, which they often ignore. but you're definitely right, from the cmd line, the alias way makes more sense.

Link to this post 11 Jun 09

Actually,

In my case?, The new GCC won't support the two names in this version it changed so I can't use it that way I have to ln -s but in my distro there's already a link from cc to gcc........... I'm thinking that I could duplicate gcc and install it in the cc dir then have symbolic links from gcc to ccache and gxx and cc to ccache?
is there a better solution?
alias for all three?

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board