2 @unnumbered Usage rules
6 @item Target is the single file.
7 Target's result probably won't create file at all.
9 @item Build rules for the target @file{target} are placed in
10 @file{target.do} file.
12 @item By default @file{.do} file is run as @code{/bin/sh -e} script.
13 If @command{redo} is run with an @option{-x} argument, then
14 @code{/bin/sh -ex} is used instead.
16 @item Executable @file{.do} file is run as is, by direct execution.
18 @item Targets can be placed in other directories, probably with
21 @item Following @file{.do} files are searched for @file{dir/base.a.b} target:
33 and for @file{../a/b/xtarget.y} target:
45 @item @file{.do} file search goes up to @file{/} by default, but can be
46 limited with either @env{$REDO_TOP_DIR} environment variable, or by
47 having @file{.redo/top} file in it.
49 @item @file{.do} runs in the same directory where it is placed.
51 @item @file{.do} runs with the three arguments:
53 @item @code{$1} -- name of the target.
54 @item @code{$2} -- base name of the target. Equals to @code{$1} if
55 it is not @file{default.*} file. Otherwise it lacks the extension.
58 default.do -> $2=a.b.c
59 default.c.do -> $2=a.b
60 default.b.c.do -> $2=a
62 @item @code{$3} -- path to the temporary file, that will be renamed
63 to the target itself. It is relative to the file in the target
67 @item @file{.do}'s @code{stdout} is captured and written to the
68 @code{$3} file. You have to produce either @code{stdout} output, or
69 use @code{$3} directly, but not both.
71 @item If there was no @code{stdout} output and no @code{$3} file is
72 explicitly created, then no output file is created at all. Target
73 does not produce anything, it is "empty".
75 @item @code{stderr} is not captured at all and can be seen by default.
77 @item Empty targets are considered always out-of-date.
79 @item Dependency information is recorded by @command{redo-ifchange}
80 command invocation. It takes list of dependencies (targets), on
81 whose the currently build target is dependant. Current @file{.do}
82 file is implicitly added as a dependency.
84 @item If no @command{redo-ifchange}'s dependency target exists, then it
85 is build (according to build rules in corresponding @file{.do}). If
86 dependency has not been changed, then it is not rebuilt.
88 @item Non-existent files dependencies are created with
89 @command{redo-ifcreate} command. If specified dependency target file
90 appears, then current target will be rebuilt. Intermediate higher
91 priority @file{.do} files dependency is implicitly recorded. For
92 example, if you @file{foo} target currently uses @file{default.do}
93 script, then @file{foo.do} is automatically recorded as a
94 non-existent dependency, forcing @file{foo} to be rebuilt if
95 @file{foo.do} appears.