At this point it gets difficult to help without seeing the code, but let me try

On 13/11/24 23:42, Sean Russell wrote:
Thanks! I'd looked at macros earlier, but ran into a different issue I don't understand.  Per the manual, both inputs and outputs should be able to be specified in a macro:

*!macro = [inputs] | [order-only inputs] |> command |> [outputs]*
*
*
So, I'm thinking, at the top level in my Tuprules.tup:

!mmac = input.suf | ../../ooinp.suf |> compilecommand --style %d %i |> ../../tmp/%d-%B

I think your inputs in a rule should be relative to where the rule is used. Is that what this rule does ?

I am sure however that you are not supposed to output in another folder than the one where your Tupfile is. A core assumption of Tup is that the rule producing a/b/c/foo.bar will be in a/b/c/Tupfile.

So ... |> ../../tmp/%d-%B will always be wrong.

From this, all the examples below are doomed to fail.

and in my project/styles/style1/Tupfile:

include_rules
: |> !mmac |>

(because without the pipes bracketing the rule, tup complains about missing pipes) at which point tup tells me that "/!-macros can't have normal inputs, only order-only inputs./"

I also tried putting the input in the rule, and the order-only input in the macro, but even with various combinations of pipe placement in both the macro and the rule I never got anything other than the error message about normal inputs.

Then I tried putting /all/ of the inputs in the rule, and only the outfile in the Tuprules.tup, which is explicitly allowed in the manual:

*You will only want to specify the output parameter in either the !-macro or the :-rule that uses it*

!mmac = |> compilecommand --style %d %i |> ../../tmp/%d-%B

and in the deep Tupfile:

include_rules
: input.suf | ../../ooinp.suf |> !mmac |>

which gives me a "Missing second '|>' marker" error; adding one to the end of the macro, so that everything (except the start of the rule) is now bracketed, still generates the missing second marker error. However, if I put both *all* inputs and outputs in the rule, it runs -- sort of. But now in complains that the top-level Tupfile rule that uses the output of the deep Tupfile is "/Unable to use inputs from a generated directory that isn't written by this Tupfile./"  Here's where I got stuck (I've trimmed it down to a bare minimum needed to generate the error):

./Tupfile:

: foreach tmp/* |> cmd1 %f %o |> out/%B-%t.pdf

./Tuprules.tup:

!mmac = |> cmd2 %f %o |>

./styles/style/Tupfile:

include_rules
: input.ext | ../../ooinput.ext |> !mmac |> ../../tmp/%d-%B

I get the impression that macros can /only/ be used in the commands. If that's not correct, could you provide a minimal example of providing order-only inputs or outputs in a macro that demonstrates my error? And is there a way of getting around this directory error? Another rule in the top-level Tupfile to explicitly create temporary directories?

Thank you.
--
--
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/ba8db968-f957-40b0-bf38-c79f464e3a3fn%40googlegroups.com <https://groups.google.com/d/msgid/tup-users/ba8db968-f957-40b0-bf38-c79f464e3a3fn%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
--
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/a222e219-9632-41b6-8615-3af9c45fc964%40gmail.com.

Reply via email to