Top-level redo targets

As explained in the fundamentals, redo begins by running the redo command against one or more top‐level files which are always presumed to be target files.

These targets are always genuine files in the filesystem, and if the system is building everything towards a final output file, then as long as it does not matter that the output file is always re‐built, that can actually be the top‐level target file.

More usually, it does matter and it is inefficient to continually re‐build the final output file. So the top‐level target file is a dummy file named all, or top or some such arbitrary name. (The name is not special in any way.) That target depends from the actual final output file, or files, which are named by redo-ifchange invocations in all.do (or top.do or whatever) and which are only conditionally re‐built.

Sometimes it is convenient to introduce further levels of dummy files. Complex build systems with output files in multiple categories can collect the files by categories, with (say) all depending from all-commands and all-libraries, and those two in their turn depending from (respectively) the actual command programs and libraries to be built.

One thing to note is that the output of all.do is the actual all file, and it can be made to contain useful things, such as a manifest or report of all of its dependencies, or version number information, or a report on compiler flags, rather than being just an empty zero‐length file.

Indeed, for lower‐level dummy files, this is good practice. all-commands always being the same zero‐length dummy file means that redo does not detect that file itself as ever changing, and so never knows just from that file alone whether higher levels of the dependncy graph need to be re‐built. Instead, redo-ifchange has to look deeper into the dependency graph to dependencies of dependencies. But all-commands actually having variable contents of some sort gives redo-ifchange a more immediate indication of a change requiring a re‐build, avoiding the overhead of hashing dependencies of dependencies.