[Top][All Lists]

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

Re: Using environmnet variables in make

From: Paul Smith
Subject: Re: Using environmnet variables in make
Date: Sat, 28 Feb 2009 16:51:31 -0500

On Sat, 2009-02-28 at 20:29 +0100, Sam Ravnborg wrote:
> On Sun, Mar 01, 2009 at 12:06:54AM +0530, kalyan wrote:
> > Hi John,
> > I actually tried out these examples:
> > 
> > case 1:
> > test:
> >         @export QA_STEP=start;touch ${QA_STEP}
> > This case actually gave the error of "touch: file arguments missing". Note
> > that using curly or normal braces gave the same error.
> The intention here is to do it in the shell.
> So the obvious fix is to escape the dollar sign like this:
> test:
>         @export QA_STEP=start;touch $${QA_STEP}

This is correct, but I just wanted to make one last point: a pet peeve
of mine.

Note that this format, "export var=value" is not that portable.
Remember make runs /bin/sh, and there are a number of /bin/sh instances
out there which do not support this syntax.

In this example you actually don't even need to export QA_STEP, since
only the shell is expanding it.  But, if you do really need to export it
then please do it portably:

                @QA_STEP=start; export QA_STEP; <do-something>

 Paul D. Smith <address@hidden>          Find some GNU make tips at:            
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

reply via email to

[Prev in Thread] Current Thread [Next in Thread]