Live data from Hacker News

Tup – A file-based build system for Linux, OS X, and Windows

gittup.org

81–90 of 110 posts

Re: Tup – A file-based build system for Linux, OS X, and Windows

#81
post #57

Is tup capable of building out of tree? By this I mean having: project_1/src/main.c project_1/src/something/a.c project_1/src/something/a.h Is there some way for tup to manage discovering the files to build and everything else needed or will I need to add every file path in manually like make?

regarding "out of tree": I'm not quite sure about your explanation here (just looks like a list of source files), but presuming you mean "creates output files in a seperate directory from source", it doesn't really have complete support for that. You can use "variants" to place output files in a subdirectory of the source tree, though. > "some way for tup to manage discovering the files to build" Well, no. It's not a…

By out of tree I mean discover all the source files from the file tree.

Re: Tup – A file-based build system for Linux, OS X, and Windows

#82

Earlier quoted context omitted.

I heard about tup a while back and finally attempted to look into it today and try replacing some of my Makefile's with Tupfile's. Unfortunately my googling and researching all seem to indicate that tup simply doesn't support any type of .PHONY targets. To that end, `tup` also doesn't seem to support even "basic" stuff (from my POV) like a `clean` and `install` target - which is fine, except that without .PHONY targe…

Not providing a .PHONY equivalent makes sense to me: why not just turn those into separate shell scripts? Clean and install seem like special cases though, the build system already knows what to clean up (or, at least, Tup seems to), and install should be handled by a proper package instead.

Generally speaking a lot of .PHONY targets require information that the build system, and build system alone has. You would have to replicate that information in the scripts if you wanted them to work, which is at the very least a messy situation, and somewhat defeats part of the purpose of using tup in the first place. This is obvious for targets like `clean` - hence why you suggest it should be supported in the build system - but most phony's require a certain amount of information from the build system.

I also disagree on `install`. `install` is useful for creating packages in the first place. The build system already knows (or is told) which files are suppose to go in which general locations (configured via environment variables for the paths) and then install the correct files for your configuration. It is easy enough to use this to create a package by installing into a separate directory then /. The key is that the build system knows all the information to make `install` work as wanted (Along with being provided some paths). Separate scripts would not.

Providing nothing at all to do for an `install` like the tup project does is simply not user-friendly. I install packages directly to `/usr/local/` all the time, and even ignoring that use-case there's no reason to leave the user wondering "Where do I put what files?". The developer know this information, the person attempting to use it or make a package generally doesn't (Or doesn't know all of them). Allowing you to define such a 'command' in the build system makes it a lot easier to write, and providing such a command makes the entire project tons easier to use and make into a package.

Re: Tup – A file-based build system for Linux, OS X, and Windows

#83

I didn't see any examples of .phony type rules. Can tup do this? I've recently found myself returning to make for multi-build system orchestration, e.g. Rust and C and PHP libraries. Does anyone have examples of using tup for this type of thing? Also, I've found myself really enjoying declarative build systems more, e.g. Cargo or Maven. It seems like for C there could be a simple set of standard tup files that are ru…

I heard about tup a while back and finally attempted to look into it today and try replacing some of my Makefile's with Tupfile's. Unfortunately my googling and researching all seem to indicate that tup simply doesn't support any type of .PHONY targets. To that end, `tup` also doesn't seem to support even "basic" stuff (from my POV) like a `clean` and `install` target - which is fine, except that without .PHONY targe…

> ...phony targets, and `clean` and `install` are unnecessary.

For clean, there is a solution if you are using git; tup can generate a .gitignore for all the output files, and there is a git command to remove all ignored files. I'm with you on "clean" being something that is both easy to implement and useful in tup.

The author's stance on phony and install isn't that they are unnecessary, but rather that they are orthogonal to the problem Tup is trying to solve. install and phony targets are handled by an external script. I will have either a Makefile or a shell script that perform the tup invocation as part of the process.

The thing that tup does well is prevent you from making certain mistakes in your build system. If you have a missing dependency, it will error out; I have actually found bugs in makefiles that I converted to tup.

Re: Tup – A file-based build system for Linux, OS X, and Windows

#85
My $0.02 on Tup:

First of all, I cannot express how much more I like it than make. If Tup is an option, I will use it.

What it does well:

1) It prevents you from making dependency mistakes: it hooks into the FS layer using fuse and tracks all input and output files that are inside your build directory. If you make any mistakes that could cause a future incremental build to be improper, it errors out rather than continuing.

2) It is opinionated about how your project should be structured. This has some negatives if you are trying to duplicate a particular structure from Make, but all in all does guide you in the right direction.

3) There isn't a lot of syntax to learn. This is good because the syntax is very different from anything else I've used.

#1 is really the killer feature for me; the amount of time I want to spend debugging makefiles is just slightly less than zero.

What it doesn't do, but I'm not bothered by:

Tup literally only manages commands that have 1 or more inputs and one or more outputs, and which must be run IFF the inputs have changed or the outputs do not exist; the outputs must be within the hierarchy of the project.

1) Configuration must be done before Tup is launched

2) Anything you might use a .PHONY for in make needs to be done outside of tup

3) Install commands must be done outside of tup. This means that configuring, installing &c. must be done outside of tup.

I find that having a make file that handles the above 3 steps works fine; others using tup tend to use a shell script.

What it doesn't do that I wish it did:

1) No clean command; I currently work around this by having it generate .gitignore file and git clean -X; still it's annoying that this isn't possible.

2) It does not handle paths with spaces. This is actually safe as it enforces relative paths, so if it works on your system it should work everywhere even if the project is unpacked to a path with spaces.

Re: Tup – A file-based build system for Linux, OS X, and Windows

#88
post #83

Earlier quoted context omitted.

I heard about tup a while back and finally attempted to look into it today and try replacing some of my Makefile's with Tupfile's. Unfortunately my googling and researching all seem to indicate that tup simply doesn't support any type of .PHONY targets. To that end, `tup` also doesn't seem to support even "basic" stuff (from my POV) like a `clean` and `install` target - which is fine, except that without .PHONY targe…

> ...phony targets, and `clean` and `install` are unnecessary. For clean, there is a solution if you are using git; tup can generate a .gitignore for all the output files, and there is a git command to remove all ignored files. I'm with you on "clean" being something that is both easy to implement and useful in tup. The author's stance on phony and install isn't that they are unnecessary, but rather that they are ort…

I read about the solution using `git`, but it definitely seems like side-stepping the problem. If you're going to provide a way to get a list of all the generated files so you can remove them by other means, why not just allow you to do it directly? But I don't think we're in disagreement here.

Perhaps I just don't completely understand what problem tup is trying to solve then. When I read about tup, I picture it being a complete replacement for something like make (And indeed, it says as much right on the website). Packaging a Tupfile along with a Makefile seems like an annoying solution to something that I really don't think should be a problem in the first place. It seems like taking a stance to a bit of an absurd degree for a feature I really don't think is that big of a deal. The author is free to do what they want, but I think they're sacrificing usability for purity.

Tup is appealing to me, but a tup/make combo isn't nearly as appealing.

Re: Tup – A file-based build system for Linux, OS X, and Windows

#89
post #22

This reminds me of DJB's ideas for a build system, redo [1]. However, it never seemed to gain any traction. (or did it? [2]) [1] http://cr.yp.to/redo.html [2] http://apenwarr.ca/log/?m=201012#14

I can recommend apenwarr's redo implementation [0]. There's occasional activity on the mailing list [1], which leads me to believe people are using it, but not promoting it much.

The apenwarr implementation includes a full Python implementation as well as a minimal version in I used the full redo implementation for some data processing tasks once, with mixed results. It was a situation where I couldn't declare the dependency graph up front. With redo, each target declares its dependencies locally when it builds, and redo assembles and tracks the dynamic dependency graph. It's pretty neat, but become difficult to reason about and debug. Could be that I never got comfortable with the new paradigm, or could be that essential tooling was missing, not sure. I still think redo is promising.

Anyway after a decade of messing with shiny new build tools, I finally learned to stop worrying and love the bomb (make). It's weird and warty but surprisingly capable. Worth the learning investment. Oh and jgrahamc's "GNU Make Book" is great. [2]

[0] https://github.com/apenwarr/redo

[1] https://groups.google.com/forum/#!forum/redo-list

[2] https://www.nostarch.com/gnumake

Re: Tup – A file-based build system for Linux, OS X, and Windows

#90

Earlier quoted context omitted.

I can understand why tup would be faster than make for certain projects - when you have many targets and intermediates, it's more efficient to probe only the source files. But with ninja, it's not clear why would it be faster than make. I can see how a simpler file format makes processing the build faster, but ultimately ninja seems to be generating the same amount of IO as make.

It does seem like it should be the same as make, but Ninja really is faster -- it just has close to zero cruft, whereas make is absolutely full of cruft. I use Ninja to build a medium-sized C/C++/ObjC project, around 1000 source files, and the dependency scan only takes a second or two. After that, it runs as fast as the compiler and linker are able. Edit to clarify: there might not be much speed difference for a ful…

Yeah dependencies. Incremental builds are much faster. Try a make clean vs ninja clean. Ninja is a whole lot faster. I just rewrote the build scripts for a qnx makefile based system in CMake. The ninja build files brought down the build time from approximately 18 mins. to 5 mins!

Incremental build time came down from 7 mins to about 30 seconds!

Admittedly this was probably an extreme case where consultants got comfortable charging by the minute. Send me an email if you are interested in moving to CMake. I'll be willing to consult.

Post reply on HN