[jamming] locals not local
Craig Allsop
cjamallsop at gmail.com
Wed Aug 8 22:28:01 PDT 2007
Hi Alen,
On 8/9/07, Alen Ladavac <alenl-ml at croteam.com> wrote:
> Hi Craig,
>
> The syntax for "on" is: "<var> on <target> = <expression> ;". Notice
> that the var's value is set on a _target_ not on another var. Perhaps
> you ment to do something like this?:
>
> rule A
> {
> local here = sometarget;
> x on $(here) = in-a ;
> }
>
> Which effectively sets the value of "x" on a pseudo-target named
> "sometarget".
I really did want to set a variable on a pseudo-target and thus there
is no reason I cannot do:
x on sometarget = in-a ;
> Btw, for pseudo-targets targets, I find it simpler to use a variable
> that includes a target's name than to set a variable on the target.
> E.g. instead of
>
> FAKED on $(project) = 1 ;
>
> I'd do
>
> $(project)-FAKED = 1 ;
>
> Which is then easily read by $($(project)-FAKED) . The "on" syntax is
> more suitable when used in actions. But it's a matter of taste.
Ok, but consider the following in response to Diane's message. (I
forgot to include jamming)...
Hi Diane,
Ok, maybe you're right, but have you never set a var on a pseudo
target? And then called a rule under the influence of that pseudo
target? This is a very useful feature!
A simple example... lets say we have pseudo targets debug & release. I
can set DEFINES on these pseudo targets and then in a loop call the
stock Main under the influence of my pseudo targets and the
appropriate defines are used. This lets me put the configuration of
DEFINES (among other things) for debug & release in a global file /
jamrules.
SubDir TOP ;
DEFINES on debug = /D_DEBUG ;
DEFINES on release = /DNDEBUG ;
for build in debug release
{
on $(build) Main example : example.c ;
}
In this way, I don't need to modify the stock jambase and use
"$(project)-DEFINES" or similar.
Craig.
More information about the jamming
mailing list