It is not really clear, but I think you should indeed read it as 

The name of the lowest level of the directory [of the Tupfile this flag appears 
in.]

It is not related to the inputs of the rule, but the Tupfile where the rule is 
instantiated. See the manual again.

More generally, Tup does not accommodate well performing actions in other 
directories than the current Tupfile. I you want to create a/b/c.out, then the 
rule should reside in a/b/Tupfile. Not in the top-level Tupfile.

Written in a/b/Tupfile, your rule would produce b.txt as expected.

Overall I think you expect Tupfiles to be more generic than they are. If you 
want to generate rules programmatically, you may have to consider lua and other 
scripting capabilities of Tup.


Le 9 novembre 2024 12:19:39 GMT+01:00, Sean Russell <[email protected]> a 
écrit :
>Hi,
>
>%d is giving me the top-level directory containing the Tupfile, not the 
>parent of the basename file, when used in the output.
>
>Per the manual in the %-flags <https://gittup.org/tup/manual.html> section,
>
>   The name of the lowest level of the directory. For example, in 
>foo/bar/Tupfile, this would be the string "bar". 
>
>However, I'm getting the parent directory that contains the Tupfile.
>
>   cd ~
>   mkdir -p tmp/tup/a/b
>   cd tmp/tup
>   tup init
>   touch a/b/c.xyz
>   echo ': a/b/c.xyz |> touch %o |> %d.txt' > Tupfile
>   tup
>
>for me produces:
>
>   $ tup
>   ...
>   $ ls -1
>   a
>   Tupfile
>   tup.txt
>
>I was expecting b.txt.
>
>What's my misunderstanding the %d flag?
>
>-- 
>-- 
>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 visit 
>https://groups.google.com/d/msgid/tup-users/6c22f817-dc54-40a4-85eb-111118150605n%40googlegroups.com.

-- 
-- 
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 visit 
https://groups.google.com/d/msgid/tup-users/13A7FD65-F00B-4F88-A70B-17BCCAC5E88E%40gmail.com.

Reply via email to