[Omake] environments & export
Janne Hellsten
jjhellst at gmail.com
Tue Sep 19 14:42:56 PDT 2006
> Yes. By default, every time you enter any kind of indented section, you
> are creating a private variable scope. If you want the values to escape,
> you need to export them explicitly.
>
> Consider:
>
> if $(FOO_REQUIRES_EXTRA_CFLAGS)
> CFLAGS+=...
> CProgram(foo)
>
> Here, it is intentional that the CFLAGS changes stay private. In
> general, OMake is fairly conservative - there were cases where OMake
> used to export automatically, but in each of those would always ended up
> realizing that this created problems, so we always ended up changing
> things so that an explicit export is required.
OK, I can see that this makes a lot of sense in other contexts. Has
anyone asked for something like:
if $(foo)
export TESTS+=my_test
This could be used to selectively "promote" things to the enclosing scope.
> P.S. Unrelated - for things like lists of files (like your TESTS
> variable above), it may be a good idea to use an array instead of a
> space-separated string:
>
> TESTS[] =
> test_cache_speed
> test_samples
> test_arm_asm
Thanks for the suggestion, I'll use that instead!
> P.P.S. You do not need to compare things to "true" - the following
> should also work:
>
> if $(ARM_ELF_TOOLCHAIN)
> TESTS += ...
I was being overly careful :) -- I wasn't sure how "true" and "false"
were treated inside ifs. I have to still deal a lot with Makefiles in
my day job and I tend to borrow some idioms from GNU makefiles into
OMakefiles.
Thanks for the helpful suggestions!
Janne
More information about the Omake
mailing list