[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: makefile not taking aliases into account



On 5/8/05, Kamaraju Kusumanchi <kk288@cornell.edu> wrote:
> Hi
>     Using Debian sid. I have an alias in my .bashrc say something like
> 
> alias x="y"
> 
> This command is executing fine on a bash shell (ie I can use x). But
> when I use x in a makefile, it is not getting expanded to y. Is this a
> future? How can I overcome this limitation?

Unless you've told it otherwise, make isn't using bash, it's using sh.
 While sh is probably a symlink to bash, when invoked as "sh" it
doesn't read your .bashrc (nor the system default).  You can change
this behavior with the SHELL variable in your makefile:

SHELL := /bin/bash

In general, though, it's better to set everything that you need in the
makefile, since relying on your aliases makes your makefile highly
non-portable.  I usually do something like (using your example):

X := y

and then using $(X) instead of the alias x in commands.

-- 
Michael A. Marsh
http://www.umiacs.umd.edu/~mmarsh
http://mamarsh.blogspot.com



Reply to: