[jamming] Checking variable on a target

Alen Ladavac alenl-ml at croteam.com
Mon Nov 22 03:58:41 PST 2004


> For the first point, inside an action I'm limited to external commands
only.

Hm... I was looking at this piece in the original Jamfile:

<snip>
if $(NT) && $(MSVCNT)
{
 actions updated together piecemeal Archive
 {
 if exist $(<) set _$(<:B)_=$(<)
 $(AR) /out:$(<) %_$(<:B)_% $(>)
 }

</snip>

Judging that "if" is ok to use.

Btw, with CMD.exe, del and mkdir are internal commands as well, aren't they?
Perhaps you are looking at the wrong problem.

> 'If', in the context in your example, can't work as you describe.
$(NEEDLIBS) has already been expanded, causing the call to DOS 'if' to fail.

Sorry, my bad. It should have been this:

if not "$(LINKLIBS)"=="" echo $(LINKLIBS) >> $(<:S=.rsp)

Notice the quotes around the left side of comparison operator. This is the
standard trick for testing for empty string in an envvar.

> Also, having to have the 'if' and the command on a single line tends to
screw up the redirect to my linker response file.

Strange:

if not "foo bar"=="" echo something >>test.txt

works ok for me.

Cheers,
Alen



----- Original Message -----
From: "Dean Ashton" <dean.ashton at ntlworld.com>
To: "Alen Ladavac" <alenl-ml at croteam.com>; <jamming at perforce.com>
Sent: Monday, November 22, 2004 10:23
Subject: Re: Re: [jamming] Checking variable on a target


> Thanks for the response. Unfortunately your suggestion doesn't work for
me.
>
> For the first point, inside an action I'm limited to external commands
only. 'If', in the context in your example, can't work as you describe.
$(NEEDLIBS) has already been expanded, causing the call to DOS 'if' to fail.
Also, having to have the 'if' and the command on a single line tends to
screw up the redirect to my linker response file..
>
> For your second point, I can't put all the linking flags into one action
as we have large link command lines (both NEEDLIBS and LINKLIBS can get
quite large). The 'piecemeal' command only splits $(>) up, so it doesn't
help us when dealing with NEEDLIBS and LINKLIBS in a single action. Indeed,
this is why I have a split set of actions as in my original post..
>
> Cheers,
> Dean
>
> >
> > From: "Alen Ladavac" <alenl-ml at croteam.com>
> > Date: 2004/11/22 Mon AM 11:04:14 GMT
> > To: <jamming at perforce.com>
> > Subject: Re: [jamming] Checking variable on a target
> >
> > Erm, how about, this?
> >
> > if not $(LINKLIBS)=="" echo $(LINKLIBS) >> $(<:S=.rsp)
> >
> > It's not a jam-side solution, but it should fix the problem.
> >
> > On the other hand, why not put all linking flags into one action? Then
the
> > problem would not exist, as long as there is at least one flag (which is
> > usually true).
> >
> > HTH,
> > Alen
>
> -----------------------------------------
> Email provided by http://www.ntlhome.com/
>
>
>




More information about the jamming mailing list