REDO(1)

NAME
redo -- rebuild utility

SYNOPSIS
redo filenames...

DESCRIPTION
redo unconditionally attempts to rebuild the list of targets given as filenames. It does this by executing a "do" program, that is expected both to build each target, and at the same time record what dependencies should cause the target to be rebuilt if given as a target to redo-ifchange.

"do" programs can invoke redo-ifchange, which may recursively cause dependencies to have their "do" programs invoked.

  FINDING "do" PROGRAMS
redo has a two factor search for "do" programs.

Firstly, it searches for "do" programs in a succession of directories, starting with the directory of the target and (if it does not have an absolute pathname) then checking each successively shorter path prefix until it ends with the current working directory. So if the target is a/b/c/d/e, it will check a/b/c/d/, then a/b/c/, then a/b/, then a/, and then finally . the current directory. For a target /a/b/c/d/e, on the other hand, it will only check /a/b/c/d/.

Secondly, within each directory it searches for the "do" program by looking for successively shorter extension suffixes taken from the target. To these it prepends the word default and the suffix .do. It also, before doing that, checks for the full target filename with .do appended.

So if the target is dir/base.a.b, it will look for dir/base.a.b.do, dir/default.a.b.do, dir/default.b.do, dir/default.do, base.a.b.do, default.a.b.do, default.b.do, and default.do.

  RUNNING "do" PROGRAMS
A "do" program can be any kind of executable, although conventionally it is a script. (redo does not force a choice of shell, and the script must therefore begin with a "#!" line that names the shell that the script is written for.)

redo invokes the program with a "REDOFLAGS" environment variable, which it uses to pass option and target information to recursively executed instances of redo (possibly invoked indirectly via redo-ifchange). "do" programs should not alter, or inspect, the value of this variable.

It also invokes the program with three arguments:

•   the directory prefix and base name of the target (e.g. dir/base.a)

•   the extension part of the target that matched the default file (e.g. .b)

•   the name of a temporary file where the target is to be built

redo performs atomic builds of individual targets. A target is built to a temporary filename (in the same directory), and if and only if the "do" program exits with a success status is that temporary filename atomically renamed to the actual target.

AUTHOR
Jonathan de Boyne Pollard