[Omake] help not exporting the loop variable?
Aleksey Nogin
nogin at metaprl.org
Sun Jan 7 14:12:45 PST 2007
On 07.01.2007 13:49, Erick Tryzelaar wrote:
>> Will every package file always add a single package? If so, then I'd
>> suggest moving the register-package call into the foreach loop:
>
> I like that, but I'm not sure that at this stage in the build, this
> foreach is aware of what are the package properties, as these would
> depend on another set of build plugins. Is there something like ocaml or
> python where you can import a file as a module, so I could do something
> like:
>
> package = $(import $x)
> register-package($(package))
>
First, you can have each package file define the package variable and
then the foreach loop would simply call the register-package function.
Alternatively, you can do the following:
OMakefile:
...
foreach(x, a b)
echo loading $x
package. =
include $x
register-package($(package))
echo
export packages
a.om:
this.name = a
b.om:
this.name = b
Note: the explicit "this." is needed because the a.om/b.om files are
parsed without any knowledge of the fact that they are being included
from an object context.
Aleksey
More information about the Omake
mailing list