blob: f2e95033e5e07524eb1397b2830d965c07740551 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
|
.TH MASH-MAKE 1
.SH NAME
mash-make \- builtin `make' functionality
.SH SYNOPSIS
.B load make
.B make
[
.I -clear
]
.br
.B depends
[
.I target
]
.br
.B match
.I pattern
.br
.B rules
[
.I pattern
]
.br
.SH DESCRIPTION
.I Make
is a loadable builtin for
.IR mash .
It can be taught about dependencies that exist between components of a program and
rules for reconstructing the components of a program.
.PP
.I Make
will examine file modification times to determine which components need
to be updated and will
issue commands to reconstruct them in the correct sequence.
It will update a target if any of its prerequisites are more up to date than the target
or if the target does not exist.
.PP
Typically, dependencies and rules are kept in a file called
.BR mashfile .
The sequence
.PP
.EX
load make
run mashfile
.EE
.PP
is used to load the
.I make
builtin and read the rules from
.BR mashfile .
Thereafter, the command
.IP
.B make
.I target
.PP
will perform the correct sequence of operations to reconstruct
.I target
and its dependents.
.PP
A dependency is specified in
.I mash
with a line of the form:
.IP
.IB target-list " : " dependent-list " ; "
.PP
or
.IP
.IB target-list " : " dependent-list " { " rules " } ;"
.PP
Each of the targets in
.I target-list
depends upon each of the dependents in
.IR dependent-list .
The optional
.I rules
specify how to build the targets. For example
.EX
lflags = -Cg;
rotta.dis : rotta.b rotta.m { limbo $lflags rotta.b };
.EE
If the rules are omitted
.I make
must be able to infer them from implicit rules.
.PP
An implicit rule is defined with a line of the form:
.IP
.I pattern
.B :~
.I dependency
.B {
.I rules
.B }
.PP
If
.I pattern
matches a target that
.I make
needs to build then
.I make
will build the target by first making the
.I dependency
and then applying the
.IR rules .
The wildcard components of the matched target are available in
the
.I dependency
and the
.I rules
as variables
.BR $1 ,
.BR $2 ,
.BR $3 ...
with
.B $1
containing the text matched by the first wildcard,
.B $2
the second wildcard
and so on. The whole of the target is available in the variable
.BR $0 .
For example,
.PP
.EX
/*/*.m :~ $2.m { cp $2.m /$1/$2.m };
/module/rotta.m: rotta.m;
/altmodule/frame.m: frame.m;
.EE
.PP
More commonly, implicit rules are defined to provide
.I make
with knowledge of how to compile
.I limbo
source to produce
.I Dis
format binaries.
Typically,
.PP
.EX
*.dis :~ $1.b { limbo $lflags $1.b};
/dis/*.dis :~ $1.dis { cp $1.dis /dis};
.EE
.PP
A target is built with the command
.IP
.B make
.I target
.PP
The list of rules can be reset with
.IP
.B make -clear
.PP
The list of dependencies for a target or for all targets can be
displayed with the command
.IP
.B depends
[
.I target
]
.PP
The rules that match a pattern and the components of the pattern
can be displayed with
.IP
.B match
.BI ' pattern '
.PP
Taking care to hide the pattern from
.I mash
file name pattern matching with quotes.
The command
.IP
.B rules
[
.I pattern
]
.PP
will display all the rules or the rules that apply to pattern
.I pattern
(if given).
.SH SOURCE
.B /appl/cmd/mash/make.b
.SH "SEE ALSO"
.IR mash (1)
|