5

I've read a lot about the tup build system.

In many places, it is said that tup "does not support recursive rules" and that you need to have one Tupfile per directory. Yet I have not seen an official statement or explanation.

Is the above claim correct?

If yes, why, and for which kind of task is this problematic? An example would be nice.

icktoofay
  • 126,289
  • 21
  • 250
  • 231
nh2
  • 24,526
  • 11
  • 79
  • 128

3 Answers3

5

It is worth noting that currently a Tupfile can create files in a different directory. You could always read files from different directory, so currently you can have a single Tupfile for the whole project.

Some more info here: https://groups.google.com/d/msg/tup-users/h7B1YzdgCag/qsOpBs4DIQ8J (a little outdated) + https://groups.google.com/d/msg/tup-users/-w932WkPBkw/7ckmHJ9WUCEJ (new syntax to use the group as input)

If you use the new LUA parser you can also have a "default" Tupfile - see here http://gittup.org/tup/lua_parser.html and check info about Tupdefault.lua

Freddie Chopin
  • 8,440
  • 2
  • 28
  • 58
  • I am not sure if I understand it right: Is this a currently supported freature, or something experimental in the current git HEAD? – nh2 Nov 14 '13 at 15:15
  • Both of these features are in the stable & tagged version, I'm not sure now whether it's 0.6.5 or 0.7 - you can find topics about release on the mailing list and check which feature was added when. – Freddie Chopin Nov 14 '13 at 16:40
4

Some of the answers have mentioned already that the limitation really is one Tupfile per directory where you want output files, instead of one Tupfile per directory. In a recent commit, this limitation has been relaxed and tup allows you to place output files also in subdirectories of the Tupfile.

In addition, with variants, it is possible to generate output files anywhere in the build tree.

zgerd
  • 1,080
  • 8
  • 17
1

The official statement can be found in tup manual: http://gittup.org/tup/manual.html

You must create a file called "Tupfile" anywhere in the tup hierarchy that you want to create an output file based on the input files. The input files can be anywhere else in the tup hierarchy, but the output file(s) must be written in the same directory as the Tupfile.

(Quotation is the 1st paragraph from the section TUPFILES in the manual)

AFAIK, it is a limitation which has something to do with the way how tup stores dependencies in the .tup subdir but I don't know details.

mity
  • 2,299
  • 17
  • 20
  • *"but the output file(s) must be written in the same directory as the Tupfile"* - does that mean the output file can also be written to a directory *under* a directory with a Tupfile? E.g. `/project/Tupfile` and output to `/project/build/[...so]` and `/project/build/bin/...` without each of those having its own Tupfile? – nh2 Apr 11 '13 at 00:15
  • You need a tupfile in every project subdir where output files are to be written. Actually `tup` fails if the output file of a rule contains path delimiter (`/`). – mity Apr 11 '13 at 12:30