[lug] alias or another trick

Will Sterling will.sterling at gmail.com
Sat Dec 24 14:00:00 MST 2011


Crate a function xic that strips out cc_r the passes the rest onto the real xic

On Dec 24, 2011, at 12:46 PM, Davide Del Vento
<davide.del.vento at gmail.com> wrote:

> Hi all,
> I have a script (more on it later) that is compiling a program. It
> needs to use two different compilers, namely cc_r and xlC. The problem
> is that it has a problem in the way it invokes xlC. It does:
>
> xlC cc_r <rest-of-the-compiler-arguments>
>
> I was hoping to fix it with something like
>
> alias "xlC cc_r"=xlC
>
> But of course aliases cannot contain spaces (at least in bash on AIX -
> sorry this isn't a pure-Linux question). Now, the right answer is "fix
> the script", but this is not feasible - the script is python's
> distutils and is untouchable and unfixable (today is your lucky day:
> I'll spare the long rant on this subject :-)
>
> An easier trick could be do alias cc_r to nothing, but I can't do
> that, since there are other (previous) calls which invoke cc_r alone -
> and that part works (after I fixed several other issues, don't think
> that it works out of the box :-)
>
> And by the way, distutils isn't like make (which doesn't recompile
> stuff that's already compiled): it recompiles everything, any time is
> re-run. So running once, then alias cc_r to nothing and run again will
> not work.
>
> Does anybody have a suggestion on how to fool it? What I would do at
> this time is write a script, call it xlC, put it somewhere in the path
> earlier than the actual xlC, and use it as "middleman" to the actual
> xlC removing the broken cc_r argument (if any). This would work, but
> since I'm writing a script to pass to other people for doing this
> installation, it's a little too dirty and requires an additional file
> (I know I can do it with an herefile, and I would, but still it's
> dirtier than the one-liner alias would be).
>
> Thanks and Merry Christmas!
> Davide
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: irc.hackingsociety.org port=6667 channel=#hackingsociety



More information about the LUG mailing list