On Sun, Jun 7, 2020 at 9:32 PM pmenso57 <[email protected]> wrote:

> A file does not have to be locked when opened on Windows, but what I am
> actually doing something like:
>
> ifeq ($(MODE),)
>     MODE = common
>     include Tupfile
>     MODE = debug
>     include Tupfile
>     MODE = profile
>     include Tupfile
>     MODE = release
>     include Tupfile
> else
>     ifeq ($(VARIANT),)
>         VARIANT = common
>         include Tupfile
>         VARIANT = shared
>         include Tupfile
>         VARIANT = static
>         include Tupfile
>         VARIANT =
>     else
>         # lots of stuff based on $(MODE) and $(VARIANT)
>     endif
> endif
>
> The real thing has more layers than this--including building with multiple
> compilers, cross-compiling, etc..  The "variants" mechanism does not work
> as (AFAICT) there is no way for them to share build artifacts (e.g. object
> files used in both static and shared linking variants).
>
> Sure, the above can be refactored into a separate Tupfile for each layer,
> but I would rather not spread out the Cartesian product generation over
> four or five files.
>
>
Can you try http://gittup.org/tup/win32/tup-v0.7.8-88-gaba879aa.zip and see
if it works now? As Andrew suspected, the Tupfile was kept open, and trying
to re-open it failed on Windows. It's pretty straightforward to close it
after reading it though, so this should be fixed.

You may want to look into using a Tupfile.lua for more complicated things
like this, though. You could use nested for-loops to iterate through all
combinations of mode & variant, which would be more straight-forward to
understand.

Eg:
modes = {
        "common", "debug", "profile", "release"
}
variants = {
        "common", "shared", "static"
}
for i, mode in ipairs(modes) do
        for j, variant in ipairs(variants) do
                tup.rule("echo Using mode " .. mode .. " with variant " ..
variant)
        end
end

-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%2B6x0LXnxdrJ%2BjQgu11GWbeBPyxZJap9TJD-59uG5zxZUYO-pA%40mail.gmail.com.

Reply via email to