|
|
|
|
|
by w4rh4wk5
1631 days ago
|
|
I have encountered Tup in the past and could not figure out how to define a "generator". As in: a function that defines how some output can be generated from a certain input running multiple commands. I don't want to copy those commands for every input I need to process. Edit: Generator is a term typically used in CMake and Meson for this, in Make I'd use a pattern rule mostly. |
|
```
inputs = { 'file1.c', 'file2.c' }
outputs = { '%B.o' }
commandA = 'gcc %f -c -o %o'
commandB = 'gcc %f -o %o'
objects = tup.foreach_rule(inputs, commandA, outputs) tup.rule(objects, commandB, {'app'})
```
Which apparently is a shortcut for saying:
```
tup.definerule{
}tup.definerule{
}tup.definerule{
}```
Reference: http://web.archive.org/web/20201026140926/http://gittup.org/...