Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does tup need one Tupfile per directory?

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.

like image 842
nh2 Avatar asked Jan 13 '13 07:01

nh2


3 Answers

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

like image 155
Freddie Chopin Avatar answered Dec 10 '22 09:12

Freddie Chopin


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.

like image 23
zgerd Avatar answered Dec 10 '22 10:12

zgerd


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.

like image 22
mity Avatar answered Dec 10 '22 10:12

mity