1SAMU(1) BSD General Commands Manual SAMU(1)
2
4 samu — ninja-compatible build tool
5
7 samu [-C dir] [-d debugflag] [-f buildfile] [-j maxjobs] [-k maxfail]
8 [-w warnflag=action] [-nv] [target...]
9 samu [-C dir] [-f buildfile] -t clean [-gr] [target...]
10 samu [-C dir] [-f buildfile] -t compdb [-x] [rule...]
11 samu [-C dir] [-f buildfile] -t commands [target...]
12 samu [-C dir] [-f buildfile] -t query [target...]
13 samu [-C dir] [-f buildfile] -t targets [depth [maxdepth]]
14 samu [-C dir] [-f buildfile] -t targets rule [rulename]
15 samu [-C dir] [-f buildfile] -t targets all
16 samu -t list
17
19 samu loads a build manifest from buildfile and rebuilds targets if they
20 are out of date. If no targets are specified, the manifest's default
21 targets are built. If there are no default targets, the leaf nodes of
22 the dependency graph are built (outputs that have no consuming action).
23
24 Targets are out of date if they are older than the generating action's
25 newest input, they have no entry in the build log, or if the command to
26 build the target differs from what was used previously. Targets built
27 with generator rules are not rebuilt if the command changes.
28
29 If the clean tool is used, the targets are cleaned instead. When a tar‐
30 get is cleaned, it is removed and are all of its inputs are cleaned.
31 Targets with no generating actions are never removed. Targets built with
32 generator rules are only removed if -g is specified.
33
34 If the commands tool is used, a list of shell commands used to build the
35 specified (or default) targets is printed.
36
37 If the compdb tool is used, a compilation database
38 https://clang.llvm.org/docs/JSONCompilationDatabase.html: () is printed
39 instead.
40
41 If the query tool is used, the inputs and outputs of the targets are
42 printed instead.
43
44 If the targets tool is used, a list of targets will be displayed, either
45 by rule or by depth. The first argument determines how the targets will
46 be displayed:
47
48 depth An indented tree of targets will be displayed, starting by the
49 root targets (those with no dependent targets), up to the depth
50 specified by maxdepth (defaults to 1).
51
52 rule If rulename is given, a list of targets using the given rule will
53 be displayed. Otherwise, a list of source files will be dis‐
54 played.
55
56 all A list of all targets will be displayed.
57
58 If the list tool is used, a list of available tools is displayed.
59
61 -C Switch working directory to dir before building.
62
63 -d Enable a debugging option. This flag may be specified multiple
64 times to enable multiple debugging options. Possible values for
65 debugflag are:
66
67 explain Print messages explaining why outputs were dirty.
68
69 keepdepfile Don't remove $depfile after it was parsed.
70
71 keeprsp Don't remove $rspfile after job completion or fail‐
72 ure.
73
74 -f Load manifest from buildfile instead of build.ninja.
75
76 -j Run up to maxjobs jobs in parallel (default based on number of
77 CPUs). If zero, allow unlimited concurrent jobs.
78
79 -k Allow up to maxfail job failures. If negative or zero, allow any
80 number of job failures.
81
82 -n Do not actually execute the commands or update the log.
83
84 -v Print full commands instead of just description.
85
86 -w Control how certain errors are handled. If warnflag is dupbuild,
87 action specifies what to do if an output is listed in multiple
88 build edges. If action is err, treat it like an error and fail.
89 If action is warn, only print a diagnostic message.
90
91 -t Instead of building, invoke a subtool. All arguments and flags
92 after the subtool are interpreted by the subtool. The currently
93 supported subtools are clean, compdb, and targets.
94
95 -g When cleaning, also clean outputs of generator actions.
96
97 -r targets are interpreted as rules, and all outputs of actions with
98 the specified rule types will be cleaned instead.
99
100 -x When printing a compilation database, replace @$rspfile with
101 $rspfile_content (with <blank> in place of <newline>).
102
104 SAMUFLAGS Options for samu that get applied before those specified on
105 the command-line. The only options allowed in SAMUFLAGS
106 are -v and -j.
107
108 NINJA_STATUS The status output printed to the left of each rule descrip‐
109 tion, using printf-like conversion specifiers. If unset,
110 the default is "[%s/%t] ".
111
112 Available conversion specifiers:
113
114 %s Number of started jobs.
115
116 %f Number of finished jobs.
117
118 %t Total number of jobs.
119
120 %r Number of running jobs.
121
122 %u Number of remaining jobs.
123
124 %p Percentage of completed jobs.
125
126 %o Rate of finished jobs per second (to 1 decimal
127 place).
128
129 %e Elapsed time in seconds (to 3 decimal places).
130
131 %% The '%' character.
132
134 make(1)
135
136BSD October 24, 2020 BSD