1SAMU(1)                   BSD General Commands Manual                  SAMU(1)
2

NAME

4     samu — ninja-compatible build tool
5

SYNOPSIS

7     samu [-C dir] [-d debugflag] [-f buildfile] [-j maxjobs] [-k maxfail]
8          [-w warnflag=action] [-v] [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 targets [depth [maxdepth]]
12     samu [-C dir] [-f buildfile] -t targets rule [rulename]
13     samu [-C dir] [-f buildfile] -t targets all
14

DESCRIPTION

16     samu loads a build manifest from buildfile and rebuilds targets if they
17     are out of date.  If no targets are specified, the manifest's default
18     targets are built.  If there are no default targets, the leaf nodes of
19     the dependency graph are built (outputs that have no consuming action).
20
21     Targets are out of date if they are older than the generating action's
22     newest input, they have no entry in the build log, or if the command to
23     build the target differs from what was used previously.  Targets built
24     with generator rules are not rebuilt if the command changes.
25
26     If the clean tool is used, the targets are cleaned instead.  When a tar‐
27     get is cleaned, it is removed and are all of its inputs are cleaned.
28     Targets with no generating actions are never removed.  Targets built with
29     generator rules are only removed if -g is specified.
30
31     If the compdb tool is used, a compilation database
32     https://clang.llvm.org/docs/JSONCompilationDatabase.html: () is printed
33     instead.
34
35     If the targets tool is used, a list of targets will be displayed, either
36     by rule or by depth.  The first argument determines how the targets will
37     be displayed:
38
39     depth   An indented tree of targets will be displayed, starting by the
40             root targets (those with no dependent targets), up to the depth
41             specified by maxdepth (defaults to 1).
42
43     rule    If rulename is given, a list of targets using the given rule will
44             be displayed.  Otherwise, a list of source files will be dis‐
45             played.
46
47     all     A list of all targets will be displayed.
48

OPTIONS

50     -C      Switch working directory to dir before building.
51
52     -d      Enable a debugging option.  This flag may be specified multiple
53             times to enable multiple debugging options.  Possible values for
54             debugflag are:
55
56             explain      Print messages explaining why outputs were dirty.
57
58             keepdepfile  Don't remove $depfile after it was parsed.
59
60             keeprsp      Don't remove $rspfile after job completion or fail‐
61                          ure.
62
63     -f      Load manifest from buildfile instead of build.ninja.
64
65     -j      Run up to maxjobs jobs in parallel (default based on number of
66             CPUs).  If zero, allow unlimited concurrent jobs.
67
68     -k      Allow up to maxfail job failures.  If negative or zero, allow any
69             number of job failures.
70
71     -v      Print full commands instead of just description.
72
73     -w      Control how certain errors are handled.  If warnflag is dupbuild,
74             action specifies what to do if an output is listed in multiple
75             build edges.  If action is err, treat it like an error and fail.
76             If action is warn, only print a diagnostic message.
77
78     -t      Instead of building, invoke a subtool.  All arguments and flags
79             after the subtool are interpreted by the subtool.  The currently
80             supported subtools are clean, compdb, and targets.
81
82     -g      When cleaning, also clean outputs of generator actions.
83
84     -r      targets are interpreted as rules, and all outputs of actions with
85             the specified rule types will be cleaned instead.
86
87     -x      When printing a compilation database, replace @$rspfile with
88             $rspfile_content (with <blank> in place of <newline>).
89

ENVIRONMENT

91     SAMUFLAGS     Options for samu that get applied before those specified on
92                   the command-line.  The only options allowed in SAMUFLAGS
93                   are -v and -j.
94
95     NINJA_STATUS  The status output printed to the left of each rule descrip‐
96                   tion, using printf-like conversion specifiers.  If unset,
97                   the default is "[%s/%t] ".
98
99                   Available conversion specifiers:
100
101                   %s      Number of started jobs.
102
103                   %f      Number of finished jobs.
104
105                   %t      Total number of jobs.
106
107                   %r      Number of running jobs.
108
109                   %u      Number of remaining jobs.
110
111                   %p      Percentage of completed jobs.
112
113                   %e      Elapsed time in seconds (to 3 decimal places).
114
115                   %%      The '%' character.
116

SEE ALSO

118     make(1)
119
120BSD                            January 26, 2020                            BSD
Impressum