Welcome to the new Linux Foundation Forum!

export?

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?

Comments

  • atreyuatreyu Posts: 216
    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.
  • tw3aktw3ak Posts: 37
    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.
  • kris_zkris_z Posts: 1
    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.
  • atreyuatreyu Posts: 216
    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.
  • tw3aktw3ak Posts: 37
    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?
  • abrenarabrenar Posts: 117
    put your export script in your profile. simple as that.

    B)
Sign In or Register to comment.