]> Cypherpunks.ru repositories - goredo.git/blob - doc/rules.texi
Fixed URL
[goredo.git] / doc / rules.texi
1 @node Usage rules
2 @unnumbered Usage rules
3
4 @itemize
5
6 @item Target is the single file.
7 Target's result probably won't create file at all.
8
9 @item Build rules for the target @file{target} are placed in
10 @file{target.do} file.
11
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.
15
16 @item Executable @file{.do} file is run as is, by direct execution.
17
18 @item Targets can be placed in other directories, probably with
19 relatives paths.
20
21 @item Following @file{.do} files are searched for @file{dir/base.a.b} target:
22
23 @example
24 dir/base.a.b.do
25 dir/default.a.b.do
26 dir/default.b.do
27 dir/default.do
28 default.a.b.do
29 default.b.do
30 default.do
31 @end example
32
33 and for @file{../a/b/xtarget.y} target:
34
35 @example
36 ./../a/b/xtarget.y.do
37 ./../a/b/default.y.do
38 ./../a/b/default.do
39 ./../a/default.y.do
40 ./../a/default.do
41 ./../default.y.do
42 ./../default.do
43 @end example
44
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.
48
49 @item @file{.do} runs in the same directory where it is placed.
50
51 @item @file{.do} runs with the three arguments:
52     @itemize
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.
56 @example
57 a.b.c.do       -> $2=a.b.c
58 default.do     -> $2=a.b.c
59 default.c.do   -> $2=a.b
60 default.b.c.do -> $2=a
61 @end example
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
64         directory.
65     @end itemize
66
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.
70
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".
74
75 @item @code{stderr} is not captured at all and can be seen by default.
76
77 @item Empty targets are considered always out-of-date.
78
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.
83
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.
87
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.
96
97 @end itemize