Age | Commit message (Collapse) | Author | Files | Lines |
|
Target/prerequisite-specific variable blocks can now be present even if
there are prerequisites. For example, now instead of:
exe{foo}: cxx{foo}
exe{foo}: cc.loptions += ...
Or:
exe{foo}: cxx{foo}
exe{foo}:
{
cc.loptions += ...
cc.libs += ...
}
We can write:
exe{foo}: cxx{foo}
{
cc.loptions += ...
cc.libs += ...
}
This also works with dependency chains in which case the block applies
to the set of prerequisites (note: not targets) before the last ':'. For
example:
./: exe{foo}: libue{foo}: cxx{foo}
{
bin.whole = false # Applies to the libue{foo} prerequisite.
}
|
|
|
|
|
|
For example, now instead of:
lib{foo}: cxx.loptions += -static
lib{foo}: cxx.libs += -lpthread
We can write:
lib{foo}:
{
cxx.loptions += -static
cxx.libs += -lpthread
}
The same works for prerequisites as well as target type/patterns. For
example:
exe{*.test}:
{
test = true
install = false
}
|
|
Now instead of:
./: exe{foo}
exe{foo}: cxx{*}
We can write:
./: exe{foo}: cxx{*}
Or even:
./: exe{foo}: libue{foo}: cxx{*}
This can be combined with prerequisite-specific variables (which naturally
only apply to the last set of prerequisites in the chain):
./: exe{foo}: libue{foo}: bin.whole = false
|
|
In particular, this allows the "if-exists" specification of prerequisites,
for example:
for t: $tests
exe{$t}: cxx{$t} test{+$t}
|
|
|
|
|
|
|
|
Now we can do:
run echo 'foo = bar'
print $foo
|
|
It can be used to print (to stderr) a human-readable representation of the
current scope or a list of targets. For example:
dump # Dump current scope.
dump lib{foo} details/exe{bar} # Dump two targets.
This is primarily useful for debugging as well as to write build system
tests.
|
|
The semantics is similar to the C++11 range-based for:
list = 1 2 3
for i: $list
print $i
Note that there is no scoping of any kind for the loop variable ('i' in
the above example).
See tests/loop/for.test for some examples/ideas.
In the future the plan is to also support more general while-loop as well
as break and continue.
|
|
|
|
|
|
|
|
|