Re:Redo: A recursive, general-purpose build system
by seanstrom on Wednesday December 29, 2021 @02:21PM
(#29728831)
Not sure how to exactly to build a "generator" either, but it seems that it would be a build rule that generates multiple outputs from multiple inputs right? If that's the case there's a `foreach` function for convenience, but it doesn't seem to have something for multiple commands. Though there's this Lua example on their website that leaves me wondering if what you want is possible, here's the code (since the documentation seems offline atm):
```
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/...