2 goredo -- djb's redo implementation on pure Go
3 Copyright (C) 2020-2021 Sergey Matveev <stargrave@stargrave.org>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, version 3 of the License.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
28 Warranty = `Copyright (C) 2020-2021 Sergey Matveev
30 This program is free software: you can redistribute it and/or modify
31 it under the terms of the GNU General Public License as published by
32 the Free Software Foundation, version 3 of the License.
34 This program is distributed in the hope that it will be useful,
35 but WITHOUT ANY WARRANTY; without even the implied warranty of
36 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
37 GNU General Public License for more details.
39 You should have received a copy of the GNU General Public License
40 along with this program. If not, see <http://www.gnu.org/licenses/>.`
43 func usage(cmd string) {
47 d = `Usage: redo [-j X] [-k] [-s] [-x|-xx] [options] [target ...]
49 Forcefully and *sequentially* build specified targets.
50 If no targets specified, then use "all" one.`
51 case CmdNameRedoIfchange:
52 d = `Usage: redo-ifchange [-j X] [-k] [-s] [-x|-xx] target [...]
54 Build specified targets in parallel, if they are changed.
55 Record them as dependencies for current target.`
56 case CmdNameRedoIfcreate:
57 d = `Usage: redo-ifcreate target [...]
59 Record ifcreate dependency for current target. Unusable outside .do.`
60 case CmdNameRedoAlways:
61 d = `Usage: redo-always
63 Always build current target. Unusable outside .do.`
64 case CmdNameRedoCleanup:
65 d = `Usage: redo-cleanup [-n] {full,log,tmp} [...]
67 Remove either all goredo's related temporary files, or kept stderr
68 logs, or everything (including .redo directories) related.`
70 d = `Usage: redo-log target [ | tai64nlocal ]
72 Display kept target's stderr with TAI64N timestamped lines. Only the
73 last build is kept. You must enable stderr keeping with either -logs,
76 d = `Usage: redo-dot target [...]
78 Write dependency DOT graph to stdout.`
79 case CmdNameRedoStamp:
80 d = `Usage: redo-stamp < [$3]
82 Record stamp dependency for current target. Unusable outside .do.
83 Stamp dependency does not play any role, as all targets are hashed
85 case CmdNameRedoWhichdo:
86 d = `Usage: redo-whichdo target
88 Display .do search paths for specified target. Exits successfully
89 if the last .do in output if the found existing one.`
90 case CmdNameRedoTargets:
91 d = `Usage: redo-targets [target ...]
93 List all currently known targets.`
94 case CmdNameRedoSources:
95 d = `Usage: redo-sources [target ...]
97 List all currently known source files.`
99 d = `Usage: redo-ood [target ...]
101 List all currently known out-of-date targets.`
102 case CmdNameRedoAffects:
103 d = `Usage: redo-affects target [...]
105 List all targets that will be affected by changing the specified ones.`
107 d = `Usage: goredo -symlinks
109 goredo expects to be called through the symbolic link to it.
110 Available commands: redo, redo-affects, redo-always, redo-cleanup,
111 redo-dot, redo-ifchange, redo-ifcreate, redo-log, redo-ood,
112 redo-sources, redo-stamp, redo-targets, redo-whichdo.`
114 fmt.Fprintf(os.Stderr, "%s\n\nCommon options:\n", d)
116 fmt.Fprintln(os.Stderr, `
117 Additional environment variables:
118 NO_COLOR -- disable messages colouring
119 REDO_TOP_DIR -- do not search for .do above that directory
120 (it can contain .redo/top as an alternative)`)
121 if cmd == CmdNameRedo || cmd == CmdNameRedoIfchange {
122 fmt.Fprintln(os.Stderr, `
123 REDO_NO_SYNC -- disable files/directories explicit filesystem syncing
124 REDO_INODE_NO_TRUST -- do not trust inode information (except for size)
125 and always check file's hash
126 REDO_MAKE -- bmake/gmake/none(default) jobserver protocol compatibility`)