On Wed, Sep 15, 2021 at 2:58 AM Christopher Corsi <[email protected]> wrote:

> This obviously breaks with the new explicit variants as-is, but I can't
> figure out how to make it work. Changing the DIR_LIBS definition to
> $(TUP_VARIANTDIR)/libs doesn't work, since $(TUP_VARIANTDIR) seems to be
> expanding based on the path it's included from (i.e. it expands to
> ../build/targets/ inside the targets folder). So far the only option I've
> found is to explicitly mess with the path by changing the target build line
> to something like this:
>

Can you try out this branch and see if it helps?
https://github.com/gittup/tup/tree/variantdir-output

That should work with your example when setting DIR_LIBS to
$(TUP_VARIANTDIR)/libs, but you might hit other issues after that.

I tried a couple of different fixes, but the only one I got to work is to
see if a filename given as an input/output enters into the variant
directory, and if so, to skip auto-adding the variant path. One potential
caveat with this is if you have a Tupfile like this:

: |> touch %o |> foo.txt
: |> touch %o |> build/bar.txt

If you run this without a variant, you get foo.txt and build/bar.txt as
files. If you run it with a variant called 'objdir', you get objdir/foo.txt
and objdir/build/bar.txt. But if you run it with a variant called 'build',
then you get objdir/foo.txt and objdir/bar.txt since it thinks the second
rule is trying to point into the variant rather than creating a subdir. I
haven't found a way to distinguish between when you're intentionally trying
to put a file into a variant (like your example when using $(LIBS_DIR)),
and when the output dir happens to have the same name as the variant dir.
So I'm not sure how to address this other than to say "don't name a variant
the same as a top-level generated directory" in the manual somewhere. Your
thoughts? Or can you think of a better approach?


>
> Could TUP_VARIANTDIR also be added to the official documentation? All of
> the above was discovered by manual experimentation and a git bisect on tup.
>

I added this to the manual; let me know if it is insufficient.

Thanks again,
-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%2B6x0LUy%2BJUT%3DsqXHRaTbLyMtZBn921YWnsVNKv9ODeYGwkyjw%40mail.gmail.com.

Reply via email to