I should mention, you can access global variables set by lua in regular
tup-syntax files, and vice versa. So if you don't want to rewrite your
"lots of stuff based on $(MODE) and $(VARIANT)" in lua, you can do
something like this:

# Tupfile.lua:
modes = {
        "common", "debug", "profile", "release"
}
variants = {
        "common", "shared", "static"
}
for i, mode in ipairs(modes) do
        MODE = mode
        for j, variant in ipairs(variants) do
                VARIANT = variant
                tup.include("rules.tup")
        end
end

# rules.tup:
: |> echo Using mode $(MODE) with variant $(VARIANT) |>

(The local variables i, mode, j, and variant aren't accessible in
rules.tup, but the global variables modes, variants, MODE, and VARIANT are).

You may also want to "tup refactor" to help verify that refactoring your
Tupfiles into lua doesn't produce any unwanted changes if you are expecting
it to generate the exact same command-lines.

-Mike

-- 
-- 
tup-users mailing list
email: [email protected]
unsubscribe: [email protected]
options: http://groups.google.com/group/tup-users?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"tup-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tup-users/CA%2B6x0LV3sj%2BPY1o6hnFmDEo313fOf6g3R2hsWnu%2BQMVzQKL87A%40mail.gmail.com.

Reply via email to