| @@ -1,1031 +1,1031 @@ | | | @@ -1,1031 +1,1031 @@ |
1 | .\" $NetBSD: make.1,v 1.227 2014/01/10 16:12:52 christos Exp $ | | 1 | .\" $NetBSD: make.1,v 1.228 2014/01/10 16:28:34 wiz Exp $ |
2 | .\" | | 2 | .\" |
3 | .\" Copyright (c) 1990, 1993 | | 3 | .\" Copyright (c) 1990, 1993 |
4 | .\" The Regents of the University of California. All rights reserved. | | 4 | .\" The Regents of the University of California. All rights reserved. |
5 | .\" | | 5 | .\" |
6 | .\" Redistribution and use in source and binary forms, with or without | | 6 | .\" Redistribution and use in source and binary forms, with or without |
7 | .\" modification, are permitted provided that the following conditions | | 7 | .\" modification, are permitted provided that the following conditions |
8 | .\" are met: | | 8 | .\" are met: |
9 | .\" 1. Redistributions of source code must retain the above copyright | | 9 | .\" 1. Redistributions of source code must retain the above copyright |
10 | .\" notice, this list of conditions and the following disclaimer. | | 10 | .\" notice, this list of conditions and the following disclaimer. |
11 | .\" 2. Redistributions in binary form must reproduce the above copyright | | 11 | .\" 2. Redistributions in binary form must reproduce the above copyright |
12 | .\" notice, this list of conditions and the following disclaimer in the | | 12 | .\" notice, this list of conditions and the following disclaimer in the |
13 | .\" documentation and/or other materials provided with the distribution. | | 13 | .\" documentation and/or other materials provided with the distribution. |
14 | .\" 3. Neither the name of the University nor the names of its contributors | | 14 | .\" 3. Neither the name of the University nor the names of its contributors |
15 | .\" may be used to endorse or promote products derived from this software | | 15 | .\" may be used to endorse or promote products derived from this software |
16 | .\" without specific prior written permission. | | 16 | .\" without specific prior written permission. |
17 | .\" | | 17 | .\" |
18 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | | 18 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
19 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | | 19 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
20 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | | 20 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
21 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | | 21 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
22 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 22 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
23 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 23 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
24 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 24 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
25 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 25 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
26 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 26 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
27 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 27 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
28 | .\" SUCH DAMAGE. | | 28 | .\" SUCH DAMAGE. |
29 | .\" | | 29 | .\" |
30 | .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 | | 30 | .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 |
31 | .\" | | 31 | .\" |
32 | .Dd October 25, 2013 | | 32 | .Dd January 10, 2014 |
33 | .Dt MAKE 1 | | 33 | .Dt MAKE 1 |
34 | .Os | | 34 | .Os |
35 | .Sh NAME | | 35 | .Sh NAME |
36 | .Nm make | | 36 | .Nm make |
37 | .Nd maintain program dependencies | | 37 | .Nd maintain program dependencies |
38 | .Sh SYNOPSIS | | 38 | .Sh SYNOPSIS |
39 | .Nm | | 39 | .Nm |
40 | .Op Fl BeikNnqrstWwX | | 40 | .Op Fl BeikNnqrstWwX |
41 | .Op Fl C Ar directory | | 41 | .Op Fl C Ar directory |
42 | .Op Fl D Ar variable | | 42 | .Op Fl D Ar variable |
43 | .Op Fl d Ar flags | | 43 | .Op Fl d Ar flags |
44 | .Op Fl f Ar makefile | | 44 | .Op Fl f Ar makefile |
45 | .Op Fl I Ar directory | | 45 | .Op Fl I Ar directory |
46 | .Op Fl J Ar private | | 46 | .Op Fl J Ar private |
47 | .Op Fl j Ar max_jobs | | 47 | .Op Fl j Ar max_jobs |
48 | .Op Fl m Ar directory | | 48 | .Op Fl m Ar directory |
49 | .Op Fl T Ar file | | 49 | .Op Fl T Ar file |
50 | .Op Fl V Ar variable | | 50 | .Op Fl V Ar variable |
51 | .Op Ar variable=value | | 51 | .Op Ar variable=value |
52 | .Op Ar target ... | | 52 | .Op Ar target ... |
53 | .Sh DESCRIPTION | | 53 | .Sh DESCRIPTION |
54 | .Nm | | 54 | .Nm |
55 | is a program designed to simplify the maintenance of other programs. | | 55 | is a program designed to simplify the maintenance of other programs. |
56 | Its input is a list of specifications as to the files upon which programs | | 56 | Its input is a list of specifications as to the files upon which programs |
57 | and other files depend. | | 57 | and other files depend. |
58 | If no | | 58 | If no |
59 | .Fl f Ar makefile | | 59 | .Fl f Ar makefile |
60 | makefile option is given, | | 60 | makefile option is given, |
61 | .Nm | | 61 | .Nm |
62 | will try to open | | 62 | will try to open |
63 | .Ql Pa makefile | | 63 | .Ql Pa makefile |
64 | then | | 64 | then |
65 | .Ql Pa Makefile | | 65 | .Ql Pa Makefile |
66 | in order to find the specifications. | | 66 | in order to find the specifications. |
67 | If the file | | 67 | If the file |
68 | .Ql Pa .depend | | 68 | .Ql Pa .depend |
69 | exists, it is read (see | | 69 | exists, it is read (see |
70 | .Xr mkdep 1 ) . | | 70 | .Xr mkdep 1 ) . |
71 | .Pp | | 71 | .Pp |
72 | This manual page is intended as a reference document only. | | 72 | This manual page is intended as a reference document only. |
73 | For a more thorough description of | | 73 | For a more thorough description of |
74 | .Nm | | 74 | .Nm |
75 | and makefiles, please refer to | | 75 | and makefiles, please refer to |
76 | .%T "PMake \- A Tutorial" . | | 76 | .%T "PMake \- A Tutorial" . |
77 | .Pp | | 77 | .Pp |
78 | .Nm | | 78 | .Nm |
79 | will prepend the contents of the | | 79 | will prepend the contents of the |
80 | .Va MAKEFLAGS | | 80 | .Va MAKEFLAGS |
81 | environment variable to the command line arguments before parsing them. | | 81 | environment variable to the command line arguments before parsing them. |
82 | .Pp | | 82 | .Pp |
83 | The options are as follows: | | 83 | The options are as follows: |
84 | .Bl -tag -width Ds | | 84 | .Bl -tag -width Ds |
85 | .It Fl B | | 85 | .It Fl B |
86 | Try to be backwards compatible by executing a single shell per command and | | 86 | Try to be backwards compatible by executing a single shell per command and |
87 | by executing the commands to make the sources of a dependency line in sequence. | | 87 | by executing the commands to make the sources of a dependency line in sequence. |
88 | .It Fl C Ar directory | | 88 | .It Fl C Ar directory |
89 | Change to | | 89 | Change to |
90 | .Ar directory | | 90 | .Ar directory |
91 | before reading the makefiles or doing anything else. | | 91 | before reading the makefiles or doing anything else. |
92 | If multiple | | 92 | If multiple |
93 | .Fl C | | 93 | .Fl C |
94 | options are specified, each is interpreted relative to the previous one: | | 94 | options are specified, each is interpreted relative to the previous one: |
95 | .Fl C Pa / Fl C Pa etc | | 95 | .Fl C Pa / Fl C Pa etc |
96 | is equivalent to | | 96 | is equivalent to |
97 | .Fl C Pa /etc . | | 97 | .Fl C Pa /etc . |
98 | .It Fl D Ar variable | | 98 | .It Fl D Ar variable |
99 | Define | | 99 | Define |
100 | .Ar variable | | 100 | .Ar variable |
101 | to be 1, in the global context. | | 101 | to be 1, in the global context. |
102 | .It Fl d Ar [-]flags | | 102 | .It Fl d Ar [-]flags |
103 | Turn on debugging, and specify which portions of | | 103 | Turn on debugging, and specify which portions of |
104 | .Nm | | 104 | .Nm |
105 | are to print debugging information. | | 105 | are to print debugging information. |
106 | Unless the flags are preceded by | | 106 | Unless the flags are preceded by |
107 | .Ql \- | | 107 | .Ql \- |
108 | they are added to the | | 108 | they are added to the |
109 | .Va MAKEFLAGS | | 109 | .Va MAKEFLAGS |
110 | environment variable and will be processed by any child make processes. | | 110 | environment variable and will be processed by any child make processes. |
111 | By default, debugging information is printed to standard error, | | 111 | By default, debugging information is printed to standard error, |
112 | but this can be changed using the | | 112 | but this can be changed using the |
113 | .Ar F | | 113 | .Ar F |
114 | debugging flag. | | 114 | debugging flag. |
115 | The debugging output is always unbuffered; in addition, if debugging | | 115 | The debugging output is always unbuffered; in addition, if debugging |
116 | is enabled but debugging output is not directed to standard output, | | 116 | is enabled but debugging output is not directed to standard output, |
117 | then the standard output is line buffered. | | 117 | then the standard output is line buffered. |
118 | .Ar Flags | | 118 | .Ar Flags |
119 | is one or more of the following: | | 119 | is one or more of the following: |
120 | .Bl -tag -width Ds | | 120 | .Bl -tag -width Ds |
121 | .It Ar A | | 121 | .It Ar A |
122 | Print all possible debugging information; | | 122 | Print all possible debugging information; |
123 | equivalent to specifying all of the debugging flags. | | 123 | equivalent to specifying all of the debugging flags. |
124 | .It Ar a | | 124 | .It Ar a |
125 | Print debugging information about archive searching and caching. | | 125 | Print debugging information about archive searching and caching. |
126 | .It Ar C | | 126 | .It Ar C |
127 | Print debugging information about current working directory. | | 127 | Print debugging information about current working directory. |
128 | .It Ar c | | 128 | .It Ar c |
129 | Print debugging information about conditional evaluation. | | 129 | Print debugging information about conditional evaluation. |
130 | .It Ar d | | 130 | .It Ar d |
131 | Print debugging information about directory searching and caching. | | 131 | Print debugging information about directory searching and caching. |
132 | .It Ar e | | 132 | .It Ar e |
133 | Print debugging information about failed commands and targets. | | 133 | Print debugging information about failed commands and targets. |
134 | .It Ar F Ns Oo Sy \&+ Oc Ns Ar filename | | 134 | .It Ar F Ns Oo Sy \&+ Oc Ns Ar filename |
135 | Specify where debugging output is written. | | 135 | Specify where debugging output is written. |
136 | This must be the last flag, because it consumes the remainder of | | 136 | This must be the last flag, because it consumes the remainder of |
137 | the argument. | | 137 | the argument. |
138 | If the character immediately after the | | 138 | If the character immediately after the |
139 | .Ql F | | 139 | .Ql F |
140 | flag is | | 140 | flag is |
141 | .Ql \&+ , | | 141 | .Ql \&+ , |
142 | then the file will be opened in append mode; | | 142 | then the file will be opened in append mode; |
143 | otherwise the file will be overwritten. | | 143 | otherwise the file will be overwritten. |
144 | If the file name is | | 144 | If the file name is |
145 | .Ql stdout | | 145 | .Ql stdout |
146 | or | | 146 | or |
147 | .Ql stderr | | 147 | .Ql stderr |
148 | then debugging output will be written to the | | 148 | then debugging output will be written to the |
149 | standard output or standard error output file descriptors respectively | | 149 | standard output or standard error output file descriptors respectively |
150 | (and the | | 150 | (and the |
151 | .Ql \&+ | | 151 | .Ql \&+ |
152 | option has no effect). | | 152 | option has no effect). |
153 | Otherwise, the output will be written to the named file. | | 153 | Otherwise, the output will be written to the named file. |
154 | If the file name ends | | 154 | If the file name ends |
155 | .Ql .%d | | 155 | .Ql .%d |
156 | then the | | 156 | then the |
157 | .Ql %d | | 157 | .Ql %d |
158 | is replaced by the pid. | | 158 | is replaced by the pid. |
159 | .It Ar f | | 159 | .It Ar f |
160 | Print debugging information about loop evaluation. | | 160 | Print debugging information about loop evaluation. |
161 | .It Ar "g1" | | 161 | .It Ar "g1" |
162 | Print the input graph before making anything. | | 162 | Print the input graph before making anything. |
163 | .It Ar "g2" | | 163 | .It Ar "g2" |
164 | Print the input graph after making everything, or before exiting | | 164 | Print the input graph after making everything, or before exiting |
165 | on error. | | 165 | on error. |
166 | .It Ar "g3" | | 166 | .It Ar "g3" |
167 | Print the input graph before exiting on error. | | 167 | Print the input graph before exiting on error. |
168 | .It Ar j | | 168 | .It Ar j |
169 | Print debugging information about running multiple shells. | | 169 | Print debugging information about running multiple shells. |
170 | .It Ar l | | 170 | .It Ar l |
171 | Print commands in Makefiles regardless of whether or not they are prefixed by | | 171 | Print commands in Makefiles regardless of whether or not they are prefixed by |
172 | .Ql @ | | 172 | .Ql @ |
173 | or other "quiet" flags. | | 173 | or other "quiet" flags. |
174 | Also known as "loud" behavior. | | 174 | Also known as "loud" behavior. |
175 | .It Ar M | | 175 | .It Ar M |
176 | Print debugging information about "meta" mode decisions about targets. | | 176 | Print debugging information about "meta" mode decisions about targets. |
177 | .It Ar m | | 177 | .It Ar m |
178 | Print debugging information about making targets, including modification | | 178 | Print debugging information about making targets, including modification |
179 | dates. | | 179 | dates. |
180 | .It Ar n | | 180 | .It Ar n |
181 | Don't delete the temporary command scripts created when running commands. | | 181 | Don't delete the temporary command scripts created when running commands. |
182 | These temporary scripts are created in the directory | | 182 | These temporary scripts are created in the directory |
183 | referred to by the | | 183 | referred to by the |
184 | .Ev TMPDIR | | 184 | .Ev TMPDIR |
185 | environment variable, or in | | 185 | environment variable, or in |
186 | .Pa /tmp | | 186 | .Pa /tmp |
187 | if | | 187 | if |
188 | .Ev TMPDIR | | 188 | .Ev TMPDIR |
189 | is unset or set to the empty string. | | 189 | is unset or set to the empty string. |
190 | The temporary scripts are created by | | 190 | The temporary scripts are created by |
191 | .Xr mkstemp 3 , | | 191 | .Xr mkstemp 3 , |
192 | and have names of the form | | 192 | and have names of the form |
193 | .Pa makeXXXXXX . | | 193 | .Pa makeXXXXXX . |
194 | .Em NOTE : | | 194 | .Em NOTE : |
195 | This can create many files in | | 195 | This can create many files in |
196 | .Ev TMPDIR | | 196 | .Ev TMPDIR |
197 | or | | 197 | or |
198 | .Pa /tmp , | | 198 | .Pa /tmp , |
199 | so use with care. | | 199 | so use with care. |
200 | .It Ar p | | 200 | .It Ar p |
201 | Print debugging information about makefile parsing. | | 201 | Print debugging information about makefile parsing. |
202 | .It Ar s | | 202 | .It Ar s |
203 | Print debugging information about suffix-transformation rules. | | 203 | Print debugging information about suffix-transformation rules. |
204 | .It Ar t | | 204 | .It Ar t |
205 | Print debugging information about target list maintenance. | | 205 | Print debugging information about target list maintenance. |
206 | .It Ar V | | 206 | .It Ar V |
207 | Force the | | 207 | Force the |
208 | .Fl V | | 208 | .Fl V |
209 | option to print raw values of variables. | | 209 | option to print raw values of variables. |
210 | .It Ar v | | 210 | .It Ar v |
211 | Print debugging information about variable assignment. | | 211 | Print debugging information about variable assignment. |
212 | .It Ar w | | 212 | .It Ar w |
213 | Print entering and leaving directory messages, pre and post processing. | | 213 | Print entering and leaving directory messages, pre and post processing. |
214 | .It Ar x | | 214 | .It Ar x |
215 | Run shell commands with | | 215 | Run shell commands with |
216 | .Fl x | | 216 | .Fl x |
217 | so the actual commands are printed as they are executed. | | 217 | so the actual commands are printed as they are executed. |
218 | .El | | 218 | .El |
219 | .It Fl e | | 219 | .It Fl e |
220 | Specify that environment variables override macro assignments within | | 220 | Specify that environment variables override macro assignments within |
221 | makefiles. | | 221 | makefiles. |
222 | .It Fl f Ar makefile | | 222 | .It Fl f Ar makefile |
223 | Specify a makefile to read instead of the default | | 223 | Specify a makefile to read instead of the default |
224 | .Ql Pa makefile . | | 224 | .Ql Pa makefile . |
225 | If | | 225 | If |
226 | .Ar makefile | | 226 | .Ar makefile |
227 | is | | 227 | is |
228 | .Ql Fl , | | 228 | .Ql Fl , |
229 | standard input is read. | | 229 | standard input is read. |
230 | Multiple makefiles may be specified, and are read in the order specified. | | 230 | Multiple makefiles may be specified, and are read in the order specified. |
231 | .It Fl I Ar directory | | 231 | .It Fl I Ar directory |
232 | Specify a directory in which to search for makefiles and included makefiles. | | 232 | Specify a directory in which to search for makefiles and included makefiles. |
233 | The system makefile directory (or directories, see the | | 233 | The system makefile directory (or directories, see the |
234 | .Fl m | | 234 | .Fl m |
235 | option) is automatically included as part of this list. | | 235 | option) is automatically included as part of this list. |
236 | .It Fl i | | 236 | .It Fl i |
237 | Ignore non-zero exit of shell commands in the makefile. | | 237 | Ignore non-zero exit of shell commands in the makefile. |
238 | Equivalent to specifying | | 238 | Equivalent to specifying |
239 | .Ql Fl | | 239 | .Ql Fl |
240 | before each command line in the makefile. | | 240 | before each command line in the makefile. |
241 | .It Fl J Ar private | | 241 | .It Fl J Ar private |
242 | This option should | | 242 | This option should |
243 | .Em not | | 243 | .Em not |
244 | be specified by the user. | | 244 | be specified by the user. |
245 | .Pp | | 245 | .Pp |
246 | When the | | 246 | When the |
247 | .Ar j | | 247 | .Ar j |
248 | option is in use in a recursive build, this option is passed by a make | | 248 | option is in use in a recursive build, this option is passed by a make |
249 | to child makes to allow all the make processes in the build to | | 249 | to child makes to allow all the make processes in the build to |
250 | cooperate to avoid overloading the system. | | 250 | cooperate to avoid overloading the system. |
251 | .It Fl j Ar max_jobs | | 251 | .It Fl j Ar max_jobs |
252 | Specify the maximum number of jobs that | | 252 | Specify the maximum number of jobs that |
253 | .Nm | | 253 | .Nm |
254 | may have running at any one time. | | 254 | may have running at any one time. |
255 | The value is saved in | | 255 | The value is saved in |
256 | .Va .MAKE.JOBS . | | 256 | .Va .MAKE.JOBS . |
257 | Turns compatibility mode off, unless the | | 257 | Turns compatibility mode off, unless the |
258 | .Ar B | | 258 | .Ar B |
259 | flag is also specified. | | 259 | flag is also specified. |
260 | When compatibility mode is off, all commands associated with a | | 260 | When compatibility mode is off, all commands associated with a |
261 | target are executed in a single shell invocation as opposed to the | | 261 | target are executed in a single shell invocation as opposed to the |
262 | traditional one shell invocation per line. | | 262 | traditional one shell invocation per line. |
263 | This can break traditional scripts which change directories on each | | 263 | This can break traditional scripts which change directories on each |
264 | command invocation and then expect to start with a fresh environment | | 264 | command invocation and then expect to start with a fresh environment |
265 | on the next line. | | 265 | on the next line. |
266 | It is more efficient to correct the scripts rather than turn backwards | | 266 | It is more efficient to correct the scripts rather than turn backwards |
267 | compatibility on. | | 267 | compatibility on. |
268 | .It Fl k | | 268 | .It Fl k |
269 | Continue processing after errors are encountered, but only on those targets | | 269 | Continue processing after errors are encountered, but only on those targets |
270 | that do not depend on the target whose creation caused the error. | | 270 | that do not depend on the target whose creation caused the error. |
271 | .It Fl m Ar directory | | 271 | .It Fl m Ar directory |
272 | Specify a directory in which to search for sys.mk and makefiles included | | 272 | Specify a directory in which to search for sys.mk and makefiles included |
273 | via the | | 273 | via the |
274 | .Ao Ar file Ac Ns -style | | 274 | .Ao Ar file Ac Ns -style |
275 | include statement. | | 275 | include statement. |
276 | The | | 276 | The |
277 | .Fl m | | 277 | .Fl m |
278 | option can be used multiple times to form a search path. | | 278 | option can be used multiple times to form a search path. |
279 | This path will override the default system include path: /usr/share/mk. | | 279 | This path will override the default system include path: /usr/share/mk. |
280 | Furthermore the system include path will be appended to the search path used | | 280 | Furthermore the system include path will be appended to the search path used |
281 | for | | 281 | for |
282 | .Qo Ar file Qc Ns -style | | 282 | .Qo Ar file Qc Ns -style |
283 | include statements (see the | | 283 | include statements (see the |
284 | .Fl I | | 284 | .Fl I |
285 | option). | | 285 | option). |
286 | .Pp | | 286 | .Pp |
287 | If a file or directory name in the | | 287 | If a file or directory name in the |
288 | .Fl m | | 288 | .Fl m |
289 | argument (or the | | 289 | argument (or the |
290 | .Ev MAKESYSPATH | | 290 | .Ev MAKESYSPATH |
291 | environment variable) starts with the string | | 291 | environment variable) starts with the string |
292 | .Qq \&.../ | | 292 | .Qq \&.../ |
293 | then | | 293 | then |
294 | .Nm | | 294 | .Nm |
295 | will search for the specified file or directory named in the remaining part | | 295 | will search for the specified file or directory named in the remaining part |
296 | of the argument string. | | 296 | of the argument string. |
297 | The search starts with the current directory of | | 297 | The search starts with the current directory of |
298 | the Makefile and then works upward towards the root of the filesystem. | | 298 | the Makefile and then works upward towards the root of the filesystem. |
299 | If the search is successful, then the resulting directory replaces the | | 299 | If the search is successful, then the resulting directory replaces the |
300 | .Qq \&.../ | | 300 | .Qq \&.../ |
301 | specification in the | | 301 | specification in the |
302 | .Fl m | | 302 | .Fl m |
303 | argument. | | 303 | argument. |
304 | If used, this feature allows | | 304 | If used, this feature allows |
305 | .Nm | | 305 | .Nm |
306 | to easily search in the current source tree for customized sys.mk files | | 306 | to easily search in the current source tree for customized sys.mk files |
307 | (e.g., by using | | 307 | (e.g., by using |
308 | .Qq \&.../mk/sys.mk | | 308 | .Qq \&.../mk/sys.mk |
309 | as an argument). | | 309 | as an argument). |
310 | .It Fl n | | 310 | .It Fl n |
311 | Display the commands that would have been executed, but do not | | 311 | Display the commands that would have been executed, but do not |
312 | actually execute them unless the target depends on the .MAKE special | | 312 | actually execute them unless the target depends on the .MAKE special |
313 | source (see below). | | 313 | source (see below). |
314 | .It Fl N | | 314 | .It Fl N |
315 | Display the commands which would have been executed, but do not | | 315 | Display the commands which would have been executed, but do not |
316 | actually execute any of them; useful for debugging top-level makefiles | | 316 | actually execute any of them; useful for debugging top-level makefiles |
317 | without descending into subdirectories. | | 317 | without descending into subdirectories. |
318 | .It Fl q | | 318 | .It Fl q |
319 | Do not execute any commands, but exit 0 if the specified targets are | | 319 | Do not execute any commands, but exit 0 if the specified targets are |
320 | up-to-date and 1, otherwise. | | 320 | up-to-date and 1, otherwise. |
321 | .It Fl r | | 321 | .It Fl r |
322 | Do not use the built-in rules specified in the system makefile. | | 322 | Do not use the built-in rules specified in the system makefile. |
323 | .It Fl s | | 323 | .It Fl s |
324 | Do not echo any commands as they are executed. | | 324 | Do not echo any commands as they are executed. |
325 | Equivalent to specifying | | 325 | Equivalent to specifying |
326 | .Ql Ic @ | | 326 | .Ql Ic @ |
327 | before each command line in the makefile. | | 327 | before each command line in the makefile. |
328 | .It Fl T Ar tracefile | | 328 | .It Fl T Ar tracefile |
329 | When used with the | | 329 | When used with the |
330 | .Fl j | | 330 | .Fl j |
331 | flag, | | 331 | flag, |
332 | append a trace record to | | 332 | append a trace record to |
333 | .Ar tracefile | | 333 | .Ar tracefile |
334 | for each job started and completed. | | 334 | for each job started and completed. |
335 | .It Fl t | | 335 | .It Fl t |
336 | Rather than re-building a target as specified in the makefile, create it | | 336 | Rather than re-building a target as specified in the makefile, create it |
337 | or update its modification time to make it appear up-to-date. | | 337 | or update its modification time to make it appear up-to-date. |
338 | .It Fl V Ar variable | | 338 | .It Fl V Ar variable |
339 | Print | | 339 | Print |
340 | .Nm Ns 's | | 340 | .Nm Ns 's |
341 | idea of the value of | | 341 | idea of the value of |
342 | .Ar variable , | | 342 | .Ar variable , |
343 | in the global context. | | 343 | in the global context. |
344 | Do not build any targets. | | 344 | Do not build any targets. |
345 | Multiple instances of this option may be specified; | | 345 | Multiple instances of this option may be specified; |
346 | the variables will be printed one per line, | | 346 | the variables will be printed one per line, |
347 | with a blank line for each null or undefined variable. | | 347 | with a blank line for each null or undefined variable. |
348 | If | | 348 | If |
349 | .Ar variable | | 349 | .Ar variable |
350 | contains a | | 350 | contains a |
351 | .Ql \&$ | | 351 | .Ql \&$ |
352 | then the value will be expanded before printing. | | 352 | then the value will be expanded before printing. |
353 | .It Fl W | | 353 | .It Fl W |
354 | Treat any warnings during makefile parsing as errors. | | 354 | Treat any warnings during makefile parsing as errors. |
355 | .It Fl X | | 355 | .It Fl X |
356 | Don't export variables passed on the command line to the environment | | 356 | Don't export variables passed on the command line to the environment |
357 | individually. | | 357 | individually. |
358 | Variables passed on the command line are still exported | | 358 | Variables passed on the command line are still exported |
359 | via the | | 359 | via the |
360 | .Va MAKEFLAGS | | 360 | .Va MAKEFLAGS |
361 | environment variable. | | 361 | environment variable. |
362 | This option may be useful on systems which have a small limit on the | | 362 | This option may be useful on systems which have a small limit on the |
363 | size of command arguments. | | 363 | size of command arguments. |
364 | .It Ar variable=value | | 364 | .It Ar variable=value |
365 | Set the value of the variable | | 365 | Set the value of the variable |
366 | .Ar variable | | 366 | .Ar variable |
367 | to | | 367 | to |
368 | .Ar value . | | 368 | .Ar value . |
369 | Normally, all values passed on the command line are also exported to | | 369 | Normally, all values passed on the command line are also exported to |
370 | sub-makes in the environment. | | 370 | sub-makes in the environment. |
371 | The | | 371 | The |
372 | .Fl X | | 372 | .Fl X |
373 | flag disables this behavior. | | 373 | flag disables this behavior. |
374 | Variable assignments should follow options for POSIX compatibility | | 374 | Variable assignments should follow options for POSIX compatibility |
375 | but no ordering is enforced. | | 375 | but no ordering is enforced. |
376 | .El | | 376 | .El |
377 | .Pp | | 377 | .Pp |
378 | There are seven different types of lines in a makefile: file dependency | | 378 | There are seven different types of lines in a makefile: file dependency |
379 | specifications, shell commands, variable assignments, include statements, | | 379 | specifications, shell commands, variable assignments, include statements, |
380 | conditional directives, for loops, and comments. | | 380 | conditional directives, for loops, and comments. |
381 | .Pp | | 381 | .Pp |
382 | In general, lines may be continued from one line to the next by ending | | 382 | In general, lines may be continued from one line to the next by ending |
383 | them with a backslash | | 383 | them with a backslash |
384 | .Pq Ql \e . | | 384 | .Pq Ql \e . |
385 | The trailing newline character and initial whitespace on the following | | 385 | The trailing newline character and initial whitespace on the following |
386 | line are compressed into a single space. | | 386 | line are compressed into a single space. |
387 | .Sh FILE DEPENDENCY SPECIFICATIONS | | 387 | .Sh FILE DEPENDENCY SPECIFICATIONS |
388 | Dependency lines consist of one or more targets, an operator, and zero | | 388 | Dependency lines consist of one or more targets, an operator, and zero |
389 | or more sources. | | 389 | or more sources. |
390 | This creates a relationship where the targets | | 390 | This creates a relationship where the targets |
391 | .Dq depend | | 391 | .Dq depend |
392 | on the sources | | 392 | on the sources |
393 | and are usually created from them. | | 393 | and are usually created from them. |
394 | The exact relationship between the target and the source is determined | | 394 | The exact relationship between the target and the source is determined |
395 | by the operator that separates them. | | 395 | by the operator that separates them. |
396 | The three operators are as follows: | | 396 | The three operators are as follows: |
397 | .Bl -tag -width flag | | 397 | .Bl -tag -width flag |
398 | .It Ic \&: | | 398 | .It Ic \&: |
399 | A target is considered out-of-date if its modification time is less than | | 399 | A target is considered out-of-date if its modification time is less than |
400 | those of any of its sources. | | 400 | those of any of its sources. |
401 | Sources for a target accumulate over dependency lines when this operator | | 401 | Sources for a target accumulate over dependency lines when this operator |
402 | is used. | | 402 | is used. |
403 | The target is removed if | | 403 | The target is removed if |
404 | .Nm | | 404 | .Nm |
405 | is interrupted. | | 405 | is interrupted. |
406 | .It Ic \&! | | 406 | .It Ic \&! |
407 | Targets are always re-created, but not until all sources have been | | 407 | Targets are always re-created, but not until all sources have been |
408 | examined and re-created as necessary. | | 408 | examined and re-created as necessary. |
409 | Sources for a target accumulate over dependency lines when this operator | | 409 | Sources for a target accumulate over dependency lines when this operator |
410 | is used. | | 410 | is used. |
411 | The target is removed if | | 411 | The target is removed if |
412 | .Nm | | 412 | .Nm |
413 | is interrupted. | | 413 | is interrupted. |
414 | .It Ic \&:: | | 414 | .It Ic \&:: |
415 | If no sources are specified, the target is always re-created. | | 415 | If no sources are specified, the target is always re-created. |
416 | Otherwise, a target is considered out-of-date if any of its sources has | | 416 | Otherwise, a target is considered out-of-date if any of its sources has |
417 | been modified more recently than the target. | | 417 | been modified more recently than the target. |
418 | Sources for a target do not accumulate over dependency lines when this | | 418 | Sources for a target do not accumulate over dependency lines when this |
419 | operator is used. | | 419 | operator is used. |
420 | The target will not be removed if | | 420 | The target will not be removed if |
421 | .Nm | | 421 | .Nm |
422 | is interrupted. | | 422 | is interrupted. |
423 | .El | | 423 | .El |
424 | .Pp | | 424 | .Pp |
425 | Targets and sources may contain the shell wildcard values | | 425 | Targets and sources may contain the shell wildcard values |
426 | .Ql \&? , | | 426 | .Ql \&? , |
427 | .Ql * , | | 427 | .Ql * , |
428 | .Ql [] , | | 428 | .Ql [] , |
429 | and | | 429 | and |
430 | .Ql {} . | | 430 | .Ql {} . |
431 | The values | | 431 | The values |
432 | .Ql \&? , | | 432 | .Ql \&? , |
433 | .Ql * , | | 433 | .Ql * , |
434 | and | | 434 | and |
435 | .Ql [] | | 435 | .Ql [] |
436 | may only be used as part of the final | | 436 | may only be used as part of the final |
437 | component of the target or source, and must be used to describe existing | | 437 | component of the target or source, and must be used to describe existing |
438 | files. | | 438 | files. |
439 | The value | | 439 | The value |
440 | .Ql {} | | 440 | .Ql {} |
441 | need not necessarily be used to describe existing files. | | 441 | need not necessarily be used to describe existing files. |
442 | Expansion is in directory order, not alphabetically as done in the shell. | | 442 | Expansion is in directory order, not alphabetically as done in the shell. |
443 | .Sh SHELL COMMANDS | | 443 | .Sh SHELL COMMANDS |
444 | Each target may have associated with it a series of shell commands, normally | | 444 | Each target may have associated with it a series of shell commands, normally |
445 | used to create the target. | | 445 | used to create the target. |
446 | Each of the commands in this script | | 446 | Each of the commands in this script |
447 | .Em must | | 447 | .Em must |
448 | be preceded by a tab. | | 448 | be preceded by a tab. |
449 | While any target may appear on a dependency line, only one of these | | 449 | While any target may appear on a dependency line, only one of these |
450 | dependencies may be followed by a creation script, unless the | | 450 | dependencies may be followed by a creation script, unless the |
451 | .Ql Ic \&:: | | 451 | .Ql Ic \&:: |
452 | operator is used. | | 452 | operator is used. |
453 | .Pp | | 453 | .Pp |
454 | If the first characters of the command line are any combination of | | 454 | If the first characters of the command line are any combination of |
455 | .Ql Ic @ , | | 455 | .Ql Ic @ , |
456 | .Ql Ic + , | | 456 | .Ql Ic + , |
457 | or | | 457 | or |
458 | .Ql Ic \- , | | 458 | .Ql Ic \- , |
459 | the command is treated specially. | | 459 | the command is treated specially. |
460 | A | | 460 | A |
461 | .Ql Ic @ | | 461 | .Ql Ic @ |
462 | causes the command not to be echoed before it is executed. | | 462 | causes the command not to be echoed before it is executed. |
463 | A | | 463 | A |
464 | .Ql Ic + | | 464 | .Ql Ic + |
465 | causes the command to be executed even when | | 465 | causes the command to be executed even when |
466 | .Fl n | | 466 | .Fl n |
467 | is given. | | 467 | is given. |
468 | This is similar to the effect of the .MAKE special source, | | 468 | This is similar to the effect of the .MAKE special source, |
469 | except that the effect can be limited to a single line of a script. | | 469 | except that the effect can be limited to a single line of a script. |
470 | A | | 470 | A |
471 | .Ql Ic \- | | 471 | .Ql Ic \- |
472 | causes any non-zero exit status of the command line to be ignored. | | 472 | causes any non-zero exit status of the command line to be ignored. |
473 | .Pp | | 473 | .Pp |
474 | When | | 474 | When |
475 | .Nm | | 475 | .Nm |
476 | is run in jobs mode with | | 476 | is run in jobs mode with |
477 | .Fl j Ar max_jobs , | | 477 | .Fl j Ar max_jobs , |
478 | the entire script for the target is fed to a | | 478 | the entire script for the target is fed to a |
479 | single instance of the shell. | | 479 | single instance of the shell. |
480 | .Pp | | 480 | .Pp |
481 | In compatibility (non-jobs) mode, each command is run in a separate process. | | 481 | In compatibility (non-jobs) mode, each command is run in a separate process. |
482 | If the command contains any shell meta characters | | 482 | If the command contains any shell meta characters |
483 | .Pq Ql #=|^(){};&<>*?[]:$`\e\en | | 483 | .Pq Ql #=|^(){};&<>*?[]:$`\e\en |
484 | it will be passed to the shell, otherwise | | 484 | it will be passed to the shell, otherwise |
485 | .Nm | | 485 | .Nm |
486 | will attempt direct execution. | | 486 | will attempt direct execution. |
487 | .Pp | | 487 | .Pp |
488 | Since | | 488 | Since |
489 | .Nm | | 489 | .Nm |
490 | will | | 490 | will |
491 | .Xr chdir 2 | | 491 | .Xr chdir 2 |
492 | to | | 492 | to |
493 | .Ql Va .OBJDIR | | 493 | .Ql Va .OBJDIR |
494 | before executing any targets, each child process | | 494 | before executing any targets, each child process |
495 | starts with that as its current working directory. | | 495 | starts with that as its current working directory. |
496 | .Pp | | 496 | .Pp |
497 | Makefiles should be written so that the mode of | | 497 | Makefiles should be written so that the mode of |
498 | .Nm | | 498 | .Nm |
499 | operation does not change their behavior. | | 499 | operation does not change their behavior. |
500 | For example, any command which needs to use | | 500 | For example, any command which needs to use |
501 | .Dq cd | | 501 | .Dq cd |
502 | or | | 502 | or |
503 | .Dq chdir , | | 503 | .Dq chdir , |
504 | without side-effect should be put in parenthesis: | | 504 | without side-effect should be put in parenthesis: |
505 | .Bd -literal -offset indent | | 505 | .Bd -literal -offset indent |
506 | | | 506 | |
507 | avoid-chdir-side-effects: | | 507 | avoid-chdir-side-effects: |
508 | @echo Building $@ in `pwd` | | 508 | @echo Building $@ in `pwd` |
509 | @(cd ${.CURDIR} && ${.MAKE} $@) | | 509 | @(cd ${.CURDIR} && ${.MAKE} $@) |
510 | @echo Back in `pwd` | | 510 | @echo Back in `pwd` |
511 | | | 511 | |
512 | ensure-one-shell-regardless-of-mode: | | 512 | ensure-one-shell-regardless-of-mode: |
513 | @echo Building $@ in `pwd`; \\ | | 513 | @echo Building $@ in `pwd`; \\ |
514 | (cd ${.CURDIR} && ${.MAKE} $@); \\ | | 514 | (cd ${.CURDIR} && ${.MAKE} $@); \\ |
515 | echo Back in `pwd` | | 515 | echo Back in `pwd` |
516 | .Ed | | 516 | .Ed |
517 | .Sh VARIABLE ASSIGNMENTS | | 517 | .Sh VARIABLE ASSIGNMENTS |
518 | Variables in make are much like variables in the shell, and, by tradition, | | 518 | Variables in make are much like variables in the shell, and, by tradition, |
519 | consist of all upper-case letters. | | 519 | consist of all upper-case letters. |
520 | .Ss Variable assignment modifiers | | 520 | .Ss Variable assignment modifiers |
521 | The five operators that can be used to assign values to variables are as | | 521 | The five operators that can be used to assign values to variables are as |
522 | follows: | | 522 | follows: |
523 | .Bl -tag -width Ds | | 523 | .Bl -tag -width Ds |
524 | .It Ic \&= | | 524 | .It Ic \&= |
525 | Assign the value to the variable. | | 525 | Assign the value to the variable. |
526 | Any previous value is overridden. | | 526 | Any previous value is overridden. |
527 | .It Ic \&+= | | 527 | .It Ic \&+= |
528 | Append the value to the current value of the variable. | | 528 | Append the value to the current value of the variable. |
529 | .It Ic \&?= | | 529 | .It Ic \&?= |
530 | Assign the value to the variable if it is not already defined. | | 530 | Assign the value to the variable if it is not already defined. |
531 | .It Ic \&:= | | 531 | .It Ic \&:= |
532 | Assign with expansion, i.e. expand the value before assigning it | | 532 | Assign with expansion, i.e. expand the value before assigning it |
533 | to the variable. | | 533 | to the variable. |
534 | Normally, expansion is not done until the variable is referenced. | | 534 | Normally, expansion is not done until the variable is referenced. |
535 | .Em NOTE : | | 535 | .Em NOTE : |
536 | References to undefined variables are | | 536 | References to undefined variables are |
537 | .Em not | | 537 | .Em not |
538 | expanded. | | 538 | expanded. |
539 | This can cause problems when variable modifiers are used. | | 539 | This can cause problems when variable modifiers are used. |
540 | .It Ic \&!= | | 540 | .It Ic \&!= |
541 | Expand the value and pass it to the shell for execution and assign | | 541 | Expand the value and pass it to the shell for execution and assign |
542 | the result to the variable. | | 542 | the result to the variable. |
543 | Any newlines in the result are replaced with spaces. | | 543 | Any newlines in the result are replaced with spaces. |
544 | .El | | 544 | .El |
545 | .Pp | | 545 | .Pp |
546 | Any white-space before the assigned | | 546 | Any white-space before the assigned |
547 | .Ar value | | 547 | .Ar value |
548 | is removed; if the value is being appended, a single space is inserted | | 548 | is removed; if the value is being appended, a single space is inserted |
549 | between the previous contents of the variable and the appended value. | | 549 | between the previous contents of the variable and the appended value. |
550 | .Pp | | 550 | .Pp |
551 | Variables are expanded by surrounding the variable name with either | | 551 | Variables are expanded by surrounding the variable name with either |
552 | curly braces | | 552 | curly braces |
553 | .Pq Ql {} | | 553 | .Pq Ql {} |
554 | or parentheses | | 554 | or parentheses |
555 | .Pq Ql () | | 555 | .Pq Ql () |
556 | and preceding it with | | 556 | and preceding it with |
557 | a dollar sign | | 557 | a dollar sign |
558 | .Pq Ql \&$ . | | 558 | .Pq Ql \&$ . |
559 | If the variable name contains only a single letter, the surrounding | | 559 | If the variable name contains only a single letter, the surrounding |
560 | braces or parentheses are not required. | | 560 | braces or parentheses are not required. |
561 | This shorter form is not recommended. | | 561 | This shorter form is not recommended. |
562 | .Pp | | 562 | .Pp |
563 | If the variable name contains a dollar, then the name itself is expanded first. | | 563 | If the variable name contains a dollar, then the name itself is expanded first. |
564 | This allows almost arbitrary variable names, however names containing dollar, | | 564 | This allows almost arbitrary variable names, however names containing dollar, |
565 | braces, parenthesis, or whitespace are really best avoided! | | 565 | braces, parenthesis, or whitespace are really best avoided! |
566 | .Pp | | 566 | .Pp |
567 | If the result of expanding a variable contains a dollar sign | | 567 | If the result of expanding a variable contains a dollar sign |
568 | .Pq Ql \&$ | | 568 | .Pq Ql \&$ |
569 | the string is expanded again. | | 569 | the string is expanded again. |
570 | .Pp | | 570 | .Pp |
571 | Variable substitution occurs at three distinct times, depending on where | | 571 | Variable substitution occurs at three distinct times, depending on where |
572 | the variable is being used. | | 572 | the variable is being used. |
573 | .Bl -enum | | 573 | .Bl -enum |
574 | .It | | 574 | .It |
575 | Variables in dependency lines are expanded as the line is read. | | 575 | Variables in dependency lines are expanded as the line is read. |
576 | .It | | 576 | .It |
577 | Variables in shell commands are expanded when the shell command is | | 577 | Variables in shell commands are expanded when the shell command is |
578 | executed. | | 578 | executed. |
579 | .It | | 579 | .It |
580 | .Dq .for | | 580 | .Dq .for |
581 | loop index variables are expanded on each loop iteration. | | 581 | loop index variables are expanded on each loop iteration. |
582 | Note that other variables are not expanded inside loops so | | 582 | Note that other variables are not expanded inside loops so |
583 | the following example code: | | 583 | the following example code: |
584 | .Bd -literal -offset indent | | 584 | .Bd -literal -offset indent |
585 | | | 585 | |
586 | .Dv .for i in 1 2 3 | | 586 | .Dv .for i in 1 2 3 |
587 | a+= ${i} | | 587 | a+= ${i} |
588 | j= ${i} | | 588 | j= ${i} |
589 | b+= ${j} | | 589 | b+= ${j} |
590 | .Dv .endfor | | 590 | .Dv .endfor |
591 | | | 591 | |
592 | all: | | 592 | all: |
593 | @echo ${a} | | 593 | @echo ${a} |
594 | @echo ${b} | | 594 | @echo ${b} |
595 | | | 595 | |
596 | .Ed | | 596 | .Ed |
597 | will print: | | 597 | will print: |
598 | .Bd -literal -offset indent | | 598 | .Bd -literal -offset indent |
599 | 1 2 3 | | 599 | 1 2 3 |
600 | 3 3 3 | | 600 | 3 3 3 |
601 | | | 601 | |
602 | .Ed | | 602 | .Ed |
603 | Because while ${a} contains | | 603 | Because while ${a} contains |
604 | .Dq 1 2 3 | | 604 | .Dq 1 2 3 |
605 | after the loop is executed, ${b} | | 605 | after the loop is executed, ${b} |
606 | contains | | 606 | contains |
607 | .Dq ${j} ${j} ${j} | | 607 | .Dq ${j} ${j} ${j} |
608 | which expands to | | 608 | which expands to |
609 | .Dq 3 3 3 | | 609 | .Dq 3 3 3 |
610 | since after the loop completes ${j} contains | | 610 | since after the loop completes ${j} contains |
611 | .Dq 3 . | | 611 | .Dq 3 . |
612 | .El | | 612 | .El |
613 | .Ss Variable classes | | 613 | .Ss Variable classes |
614 | The four different classes of variables (in order of increasing precedence) | | 614 | The four different classes of variables (in order of increasing precedence) |
615 | are: | | 615 | are: |
616 | .Bl -tag -width Ds | | 616 | .Bl -tag -width Ds |
617 | .It Environment variables | | 617 | .It Environment variables |
618 | Variables defined as part of | | 618 | Variables defined as part of |
619 | .Nm Ns 's | | 619 | .Nm Ns 's |
620 | environment. | | 620 | environment. |
621 | .It Global variables | | 621 | .It Global variables |
622 | Variables defined in the makefile or in included makefiles. | | 622 | Variables defined in the makefile or in included makefiles. |
623 | .It Command line variables | | 623 | .It Command line variables |
624 | Variables defined as part of the command line. | | 624 | Variables defined as part of the command line. |
625 | .It Local variables | | 625 | .It Local variables |
626 | Variables that are defined specific to a certain target. | | 626 | Variables that are defined specific to a certain target. |
627 | The seven local variables are as follows: | | 627 | The seven local variables are as follows: |
628 | .Bl -tag -width ".ARCHIVE" | | 628 | .Bl -tag -width ".ARCHIVE" |
629 | .It Va .ALLSRC | | 629 | .It Va .ALLSRC |
630 | The list of all sources for this target; also known as | | 630 | The list of all sources for this target; also known as |
631 | .Ql Va \&\*[Gt] . | | 631 | .Ql Va \&\*[Gt] . |
632 | .It Va .ARCHIVE | | 632 | .It Va .ARCHIVE |
633 | The name of the archive file. | | 633 | The name of the archive file. |
634 | .It Va .IMPSRC | | 634 | .It Va .IMPSRC |
635 | In suffix-transformation rules, the name/path of the source from which the | | 635 | In suffix-transformation rules, the name/path of the source from which the |
636 | target is to be transformed (the | | 636 | target is to be transformed (the |
637 | .Dq implied | | 637 | .Dq implied |
638 | source); also known as | | 638 | source); also known as |
639 | .Ql Va \&\*[Lt] . | | 639 | .Ql Va \&\*[Lt] . |
640 | It is not defined in explicit rules. | | 640 | It is not defined in explicit rules. |
641 | .It Va .INCLUDEDFROMDIR | | 641 | .It Va .INCLUDEDFROMDIR |
642 | The directory of the file this Makefile was included from. | | 642 | The directory of the file this Makefile was included from. |
643 | .It Va .INCLUDEDFROMFILE | | 643 | .It Va .INCLUDEDFROMFILE |
644 | The filename of the file this Makefile was included from. | | 644 | The filename of the file this Makefile was included from. |
645 | .It Va .MEMBER | | 645 | .It Va .MEMBER |
646 | The name of the archive member. | | 646 | The name of the archive member. |
647 | .It Va .OODATE | | 647 | .It Va .OODATE |
648 | The list of sources for this target that were deemed out-of-date; also | | 648 | The list of sources for this target that were deemed out-of-date; also |
649 | known as | | 649 | known as |
650 | .Ql Va \&? . | | 650 | .Ql Va \&? . |
651 | .It Va .PREFIX | | 651 | .It Va .PREFIX |
652 | The file prefix of the target, containing only the file portion, no suffix | | 652 | The file prefix of the target, containing only the file portion, no suffix |
653 | or preceding directory components; also known as | | 653 | or preceding directory components; also known as |
654 | .Ql Va * . | | 654 | .Ql Va * . |
655 | .It Va .TARGET | | 655 | .It Va .TARGET |
656 | The name of the target; also known as | | 656 | The name of the target; also known as |
657 | .Ql Va @ . | | 657 | .Ql Va @ . |
658 | .El | | 658 | .El |
659 | .Pp | | 659 | .Pp |
660 | The shorter forms | | 660 | The shorter forms |
661 | .Ql Va @ , | | 661 | .Ql Va @ , |
662 | .Ql Va \&? , | | 662 | .Ql Va \&? , |
663 | .Ql Va \&\*[Lt] , | | 663 | .Ql Va \&\*[Lt] , |
664 | .Ql Va \&\*[Gt] , | | 664 | .Ql Va \&\*[Gt] , |
665 | and | | 665 | and |
666 | .Ql Va * | | 666 | .Ql Va * |
667 | are permitted for backward | | 667 | are permitted for backward |
668 | compatibility with historical makefiles and are not recommended. | | 668 | compatibility with historical makefiles and are not recommended. |
669 | The six variables | | 669 | The six variables |
670 | .Ql Va "@F" , | | 670 | .Ql Va "@F" , |
671 | .Ql Va "@D" , | | 671 | .Ql Va "@D" , |
672 | .Ql Va "\*[Lt]F" , | | 672 | .Ql Va "\*[Lt]F" , |
673 | .Ql Va "\*[Lt]D" , | | 673 | .Ql Va "\*[Lt]D" , |
674 | .Ql Va "*F" , | | 674 | .Ql Va "*F" , |
675 | and | | 675 | and |
676 | .Ql Va "*D" | | 676 | .Ql Va "*D" |
677 | are permitted for compatibility with | | 677 | are permitted for compatibility with |
678 | .At V | | 678 | .At V |
679 | makefiles and are not recommended. | | 679 | makefiles and are not recommended. |
680 | .Pp | | 680 | .Pp |
681 | Four of the local variables may be used in sources on dependency lines | | 681 | Four of the local variables may be used in sources on dependency lines |
682 | because they expand to the proper value for each target on the line. | | 682 | because they expand to the proper value for each target on the line. |
683 | These variables are | | 683 | These variables are |
684 | .Ql Va .TARGET , | | 684 | .Ql Va .TARGET , |
685 | .Ql Va .PREFIX , | | 685 | .Ql Va .PREFIX , |
686 | .Ql Va .ARCHIVE , | | 686 | .Ql Va .ARCHIVE , |
687 | and | | 687 | and |
688 | .Ql Va .MEMBER . | | 688 | .Ql Va .MEMBER . |
689 | .El | | 689 | .El |
690 | .Ss Additional built-in variables | | 690 | .Ss Additional built-in variables |
691 | In addition, | | 691 | In addition, |
692 | .Nm | | 692 | .Nm |
693 | sets or knows about the following variables: | | 693 | sets or knows about the following variables: |
694 | .Bl -tag -width .MAKEOVERRIDES | | 694 | .Bl -tag -width .MAKEOVERRIDES |
695 | .It Va \&$ | | 695 | .It Va \&$ |
696 | A single dollar sign | | 696 | A single dollar sign |
697 | .Ql \&$ , | | 697 | .Ql \&$ , |
698 | i.e. | | 698 | i.e. |
699 | .Ql \&$$ | | 699 | .Ql \&$$ |
700 | expands to a single dollar | | 700 | expands to a single dollar |
701 | sign. | | 701 | sign. |
702 | .It Va .ALLTARGETS | | 702 | .It Va .ALLTARGETS |
703 | The list of all targets encountered in the Makefile. | | 703 | The list of all targets encountered in the Makefile. |
704 | If evaluated during | | 704 | If evaluated during |
705 | Makefile parsing, lists only those targets encountered thus far. | | 705 | Makefile parsing, lists only those targets encountered thus far. |
706 | .It Va .CURDIR | | 706 | .It Va .CURDIR |
707 | A path to the directory where | | 707 | A path to the directory where |
708 | .Nm | | 708 | .Nm |
709 | was executed. | | 709 | was executed. |
710 | Refer to the description of | | 710 | Refer to the description of |
711 | .Ql Ev PWD | | 711 | .Ql Ev PWD |
712 | for more details. | | 712 | for more details. |
713 | .It Ev MAKE | | 713 | .It Ev MAKE |
714 | The name that | | 714 | The name that |
715 | .Nm | | 715 | .Nm |
716 | was executed with | | 716 | was executed with |
717 | .Pq Va argv[0] . | | 717 | .Pq Va argv[0] . |
718 | For compatibility | | 718 | For compatibility |
719 | .Nm | | 719 | .Nm |
720 | also sets | | 720 | also sets |
721 | .Va .MAKE | | 721 | .Va .MAKE |
722 | with the same value. | | 722 | with the same value. |
723 | The preferred variable to use is the environment variable | | 723 | The preferred variable to use is the environment variable |
724 | .Ev MAKE | | 724 | .Ev MAKE |
725 | because it is more compatible with other versions of | | 725 | because it is more compatible with other versions of |
726 | .Nm | | 726 | .Nm |
727 | and cannot be confused with the special target with the same name. | | 727 | and cannot be confused with the special target with the same name. |
728 | .It Va .MAKE.DEPENDFILE | | 728 | .It Va .MAKE.DEPENDFILE |
729 | Names the makefile (default | | 729 | Names the makefile (default |
730 | .Ql Pa .depend ) | | 730 | .Ql Pa .depend ) |
731 | from which generated dependencies are read. | | 731 | from which generated dependencies are read. |
732 | .It Va .MAKE.EXPAND_VARIABLES | | 732 | .It Va .MAKE.EXPAND_VARIABLES |
733 | A boolean that controls the default behavior of the | | 733 | A boolean that controls the default behavior of the |
734 | .Fl V | | 734 | .Fl V |
735 | option. | | 735 | option. |
736 | .It Va .MAKE.EXPORTED | | 736 | .It Va .MAKE.EXPORTED |
737 | The list of variables exported by | | 737 | The list of variables exported by |
738 | .Nm . | | 738 | .Nm . |
739 | .It Va .MAKE.JOBS | | 739 | .It Va .MAKE.JOBS |
740 | The argument to the | | 740 | The argument to the |
741 | .Fl j | | 741 | .Fl j |
742 | option. | | 742 | option. |
743 | .It Va .MAKE.JOB.PREFIX | | 743 | .It Va .MAKE.JOB.PREFIX |
744 | If | | 744 | If |
745 | .Nm | | 745 | .Nm |
746 | is run with | | 746 | is run with |
747 | .Ar j | | 747 | .Ar j |
748 | then output for each target is prefixed with a token | | 748 | then output for each target is prefixed with a token |
749 | .Ql --- target --- | | 749 | .Ql --- target --- |
750 | the first part of which can be controlled via | | 750 | the first part of which can be controlled via |
751 | .Va .MAKE.JOB.PREFIX . | | 751 | .Va .MAKE.JOB.PREFIX . |
752 | If | | 752 | If |
753 | .Va .MAKE.JOB.PREFIX | | 753 | .Va .MAKE.JOB.PREFIX |
754 | is empty, no token is printed. | | 754 | is empty, no token is printed. |
755 | .br | | 755 | .br |
756 | For example: | | 756 | For example: |
757 | .Li .MAKE.JOB.PREFIX=${.newline}---${.MAKE:T}[${.MAKE.PID}] | | 757 | .Li .MAKE.JOB.PREFIX=${.newline}---${.MAKE:T}[${.MAKE.PID}] |
758 | would produce tokens like | | 758 | would produce tokens like |
759 | .Ql ---make[1234] target --- | | 759 | .Ql ---make[1234] target --- |
760 | making it easier to track the degree of parallelism being achieved. | | 760 | making it easier to track the degree of parallelism being achieved. |
761 | .It Ev MAKEFLAGS | | 761 | .It Ev MAKEFLAGS |
762 | The environment variable | | 762 | The environment variable |
763 | .Ql Ev MAKEFLAGS | | 763 | .Ql Ev MAKEFLAGS |
764 | may contain anything that | | 764 | may contain anything that |
765 | may be specified on | | 765 | may be specified on |
766 | .Nm Ns 's | | 766 | .Nm Ns 's |
767 | command line. | | 767 | command line. |
768 | Anything specified on | | 768 | Anything specified on |
769 | .Nm Ns 's | | 769 | .Nm Ns 's |
770 | command line is appended to the | | 770 | command line is appended to the |
771 | .Ql Ev MAKEFLAGS | | 771 | .Ql Ev MAKEFLAGS |
772 | variable which is then | | 772 | variable which is then |
773 | entered into the environment for all programs which | | 773 | entered into the environment for all programs which |
774 | .Nm | | 774 | .Nm |
775 | executes. | | 775 | executes. |
776 | .It Va .MAKE.LEVEL | | 776 | .It Va .MAKE.LEVEL |
777 | The recursion depth of | | 777 | The recursion depth of |
778 | .Nm . | | 778 | .Nm . |
779 | The initial instance of | | 779 | The initial instance of |
780 | .Nm | | 780 | .Nm |
781 | will be 0, and an incremented value is put into the environment | | 781 | will be 0, and an incremented value is put into the environment |
782 | to be seen by the next generation. | | 782 | to be seen by the next generation. |
783 | This allows tests like: | | 783 | This allows tests like: |
784 | .Li .if ${.MAKE.LEVEL} == 0 | | 784 | .Li .if ${.MAKE.LEVEL} == 0 |
785 | to protect things which should only be evaluated in the initial instance of | | 785 | to protect things which should only be evaluated in the initial instance of |
786 | .Nm . | | 786 | .Nm . |
787 | .It Va .MAKE.MAKEFILE_PREFERENCE | | 787 | .It Va .MAKE.MAKEFILE_PREFERENCE |
788 | The ordered list of makefile names | | 788 | The ordered list of makefile names |
789 | (default | | 789 | (default |
790 | .Ql Pa makefile , | | 790 | .Ql Pa makefile , |
791 | .Ql Pa Makefile ) | | 791 | .Ql Pa Makefile ) |
792 | that | | 792 | that |
793 | .Nm | | 793 | .Nm |
794 | will look for. | | 794 | will look for. |
795 | .It Va .MAKE.MAKEFILES | | 795 | .It Va .MAKE.MAKEFILES |
796 | The list of makefiles read by | | 796 | The list of makefiles read by |
797 | .Nm , | | 797 | .Nm , |
798 | which is useful for tracking dependencies. | | 798 | which is useful for tracking dependencies. |
799 | Each makefile is recorded only once, regardless of the number of times read. | | 799 | Each makefile is recorded only once, regardless of the number of times read. |
800 | .It Va .MAKE.MODE | | 800 | .It Va .MAKE.MODE |
801 | Processed after reading all makefiles. | | 801 | Processed after reading all makefiles. |
802 | Can affect the mode that | | 802 | Can affect the mode that |
803 | .Nm | | 803 | .Nm |
804 | runs in. | | 804 | runs in. |
805 | It can contain a number of keywords: | | 805 | It can contain a number of keywords: |
806 | .Bl -hang -width ignore-cmd | | 806 | .Bl -hang -width ignore-cmd |
807 | .It Pa compat | | 807 | .It Pa compat |
808 | Like | | 808 | Like |
809 | .Fl B , | | 809 | .Fl B , |
810 | puts | | 810 | puts |
811 | .Nm | | 811 | .Nm |
812 | into "compat" mode. | | 812 | into "compat" mode. |
813 | .It Pa meta | | 813 | .It Pa meta |
814 | Puts | | 814 | Puts |
815 | .Nm | | 815 | .Nm |
816 | into "meta" mode, where meta files are created for each target | | 816 | into "meta" mode, where meta files are created for each target |
817 | to capture the command run, the output generated and if | | 817 | to capture the command run, the output generated and if |
818 | .Xr filemon 4 | | 818 | .Xr filemon 4 |
819 | is available, the system calls which are of interest to | | 819 | is available, the system calls which are of interest to |
820 | .Nm . | | 820 | .Nm . |
821 | The captured output can be very useful when diagnosing errors. | | 821 | The captured output can be very useful when diagnosing errors. |
822 | .It Pa curdirOk= Ar bf | | 822 | .It Pa curdirOk= Ar bf |
823 | Normally | | 823 | Normally |
824 | .Nm | | 824 | .Nm |
825 | will not create .meta files in | | 825 | will not create .meta files in |
826 | .Ql Va .CURDIR . | | 826 | .Ql Va .CURDIR . |
827 | This can be overridden by setting | | 827 | This can be overridden by setting |
828 | .Va bf | | 828 | .Va bf |
829 | to a value which represents True. | | 829 | to a value which represents True. |
830 | .It Pa env | | 830 | .It Pa env |
831 | For debugging, it can be useful to inlcude the environment | | 831 | For debugging, it can be useful to inlcude the environment |
832 | in the .meta file. | | 832 | in the .meta file. |
833 | .It Pa verbose | | 833 | .It Pa verbose |
834 | If in "meta" mode, print a clue about the target being built. | | 834 | If in "meta" mode, print a clue about the target being built. |
835 | This is useful if the build is otherwise running silently. | | 835 | This is useful if the build is otherwise running silently. |
836 | The message printed the value of: | | 836 | The message printed the value of: |
837 | .Va .MAKE.META.PREFIX . | | 837 | .Va .MAKE.META.PREFIX . |
838 | .It Pa ignore-cmd | | 838 | .It Pa ignore-cmd |
839 | Some makefiles have commands which are simply not stable. | | 839 | Some makefiles have commands which are simply not stable. |
840 | This keyword causes them to be ignored for | | 840 | This keyword causes them to be ignored for |
841 | determining whether a target is out of date in "meta" mode. | | 841 | determining whether a target is out of date in "meta" mode. |
842 | See also | | 842 | See also |
843 | .Ic .NOMETA_CMP . | | 843 | .Ic .NOMETA_CMP . |
844 | .It Pa silent= Ar bf | | 844 | .It Pa silent= Ar bf |
845 | If | | 845 | If |
846 | .Va bf | | 846 | .Va bf |
847 | is True, when a .meta file is created, mark the target | | 847 | is True, when a .meta file is created, mark the target |
848 | .Ic .SILENT . | | 848 | .Ic .SILENT . |
849 | .El | | 849 | .El |
850 | .It Va .MAKE.META.BAILIWICK | | 850 | .It Va .MAKE.META.BAILIWICK |
851 | In "meta" mode, provides a list of prefixes which | | 851 | In "meta" mode, provides a list of prefixes which |
852 | match the directories controlled by | | 852 | match the directories controlled by |
853 | .Nm . | | 853 | .Nm . |
854 | If a file that was generated outside of | | 854 | If a file that was generated outside of |
855 | .Va .OBJDIR | | 855 | .Va .OBJDIR |
856 | but within said bailiwick is missing, | | 856 | but within said bailiwick is missing, |
857 | the current target is considered out-of-date. | | 857 | the current target is considered out-of-date. |
858 | .It Va .MAKE.META.CREATED | | 858 | .It Va .MAKE.META.CREATED |
859 | In "meta" mode, this variable contains a list of all the meta files | | 859 | In "meta" mode, this variable contains a list of all the meta files |
860 | updated. | | 860 | updated. |
861 | If not empty, it can be used to trigger processing of | | 861 | If not empty, it can be used to trigger processing of |
862 | .Va .MAKE.META.FILES . | | 862 | .Va .MAKE.META.FILES . |
863 | .It Va .MAKE.META.FILES | | 863 | .It Va .MAKE.META.FILES |
864 | In "meta" mode, this variable contains a list of all the meta files | | 864 | In "meta" mode, this variable contains a list of all the meta files |
865 | used (updated or not). | | 865 | used (updated or not). |
866 | This list can be used to process the meta files to extract dependency | | 866 | This list can be used to process the meta files to extract dependency |
867 | information. | | 867 | information. |
868 | .It Va .MAKE.META.IGNORE_PATHS | | 868 | .It Va .MAKE.META.IGNORE_PATHS |
869 | Provides a list of path prefixes that should be ignored; | | 869 | Provides a list of path prefixes that should be ignored; |
870 | because the contents are expected to change over time. | | 870 | because the contents are expected to change over time. |
871 | The default list includes: | | 871 | The default list includes: |
872 | .Ql Pa /dev /etc /proc /tmp /var/run /var/tmp | | 872 | .Ql Pa /dev /etc /proc /tmp /var/run /var/tmp |
873 | .It Va .MAKE.META.PREFIX | | 873 | .It Va .MAKE.META.PREFIX |
874 | Defines the message printed for each meta file updated in "meta verbose" mode. | | 874 | Defines the message printed for each meta file updated in "meta verbose" mode. |
875 | The default value is: | | 875 | The default value is: |
876 | .Dl Building ${.TARGET:H:tA}/${.TARGET:T} | | 876 | .Dl Building ${.TARGET:H:tA}/${.TARGET:T} |
877 | .It Va .MAKEOVERRIDES | | 877 | .It Va .MAKEOVERRIDES |
878 | This variable is used to record the names of variables assigned to | | 878 | This variable is used to record the names of variables assigned to |
879 | on the command line, so that they may be exported as part of | | 879 | on the command line, so that they may be exported as part of |
880 | .Ql Ev MAKEFLAGS . | | 880 | .Ql Ev MAKEFLAGS . |
881 | This behaviour can be disabled by assigning an empty value to | | 881 | This behaviour can be disabled by assigning an empty value to |
882 | .Ql Va .MAKEOVERRIDES | | 882 | .Ql Va .MAKEOVERRIDES |
883 | within a makefile. | | 883 | within a makefile. |
884 | Extra variables can be exported from a makefile | | 884 | Extra variables can be exported from a makefile |
885 | by appending their names to | | 885 | by appending their names to |
886 | .Ql Va .MAKEOVERRIDES . | | 886 | .Ql Va .MAKEOVERRIDES . |
887 | .Ql Ev MAKEFLAGS | | 887 | .Ql Ev MAKEFLAGS |
888 | is re-exported whenever | | 888 | is re-exported whenever |
889 | .Ql Va .MAKEOVERRIDES | | 889 | .Ql Va .MAKEOVERRIDES |
890 | is modified. | | 890 | is modified. |
891 | .It Va .MAKE.PATH_FILEMON | | 891 | .It Va .MAKE.PATH_FILEMON |
892 | If | | 892 | If |
893 | .Nm | | 893 | .Nm |
894 | was built with | | 894 | was built with |
895 | .Xr filemon 4 | | 895 | .Xr filemon 4 |
896 | support, this is set to the path of the device node. | | 896 | support, this is set to the path of the device node. |
897 | This allows makefiles to test for this support. | | 897 | This allows makefiles to test for this support. |
898 | .It Va .MAKE.PID | | 898 | .It Va .MAKE.PID |
899 | The process-id of | | 899 | The process-id of |
900 | .Nm . | | 900 | .Nm . |
901 | .It Va .MAKE.PPID | | 901 | .It Va .MAKE.PPID |
902 | The parent process-id of | | 902 | The parent process-id of |
903 | .Nm . | | 903 | .Nm . |
904 | .It Va MAKE_PRINT_VAR_ON_ERROR | | 904 | .It Va MAKE_PRINT_VAR_ON_ERROR |
905 | When | | 905 | When |
906 | .Nm | | 906 | .Nm |
907 | stops due to an error, it prints its name and the value of | | 907 | stops due to an error, it prints its name and the value of |
908 | .Ql Va .CURDIR | | 908 | .Ql Va .CURDIR |
909 | as well as the value of any variables named in | | 909 | as well as the value of any variables named in |
910 | .Ql Va MAKE_PRINT_VAR_ON_ERROR . | | 910 | .Ql Va MAKE_PRINT_VAR_ON_ERROR . |
911 | .It Va .newline | | 911 | .It Va .newline |
912 | This variable is simply assigned a newline character as its value. | | 912 | This variable is simply assigned a newline character as its value. |
913 | This allows expansions using the | | 913 | This allows expansions using the |
914 | .Cm \&:@ | | 914 | .Cm \&:@ |
915 | modifier to put a newline between | | 915 | modifier to put a newline between |
916 | iterations of the loop rather than a space. | | 916 | iterations of the loop rather than a space. |
917 | For example, the printing of | | 917 | For example, the printing of |
918 | .Ql Va MAKE_PRINT_VAR_ON_ERROR | | 918 | .Ql Va MAKE_PRINT_VAR_ON_ERROR |
919 | could be done as ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@}. | | 919 | could be done as ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@}. |
920 | .It Va .OBJDIR | | 920 | .It Va .OBJDIR |
921 | A path to the directory where the targets are built. | | 921 | A path to the directory where the targets are built. |
922 | Its value is determined by trying to | | 922 | Its value is determined by trying to |
923 | .Xr chdir 2 | | 923 | .Xr chdir 2 |
924 | to the following directories in order and using the first match: | | 924 | to the following directories in order and using the first match: |
925 | .Bl -enum | | 925 | .Bl -enum |
926 | .It | | 926 | .It |
927 | .Ev ${MAKEOBJDIRPREFIX}${.CURDIR} | | 927 | .Ev ${MAKEOBJDIRPREFIX}${.CURDIR} |
928 | .Pp | | 928 | .Pp |
929 | (Only if | | 929 | (Only if |
930 | .Ql Ev MAKEOBJDIRPREFIX | | 930 | .Ql Ev MAKEOBJDIRPREFIX |
931 | is set in the environment or on the command line.) | | 931 | is set in the environment or on the command line.) |
932 | .It | | 932 | .It |
933 | .Ev ${MAKEOBJDIR} | | 933 | .Ev ${MAKEOBJDIR} |
934 | .Pp | | 934 | .Pp |
935 | (Only if | | 935 | (Only if |
936 | .Ql Ev MAKEOBJDIR | | 936 | .Ql Ev MAKEOBJDIR |
937 | is set in the environment or on the command line.) | | 937 | is set in the environment or on the command line.) |
938 | .It | | 938 | .It |
939 | .Ev ${.CURDIR} Ns Pa /obj. Ns Ev ${MACHINE} | | 939 | .Ev ${.CURDIR} Ns Pa /obj. Ns Ev ${MACHINE} |
940 | .It | | 940 | .It |
941 | .Ev ${.CURDIR} Ns Pa /obj | | 941 | .Ev ${.CURDIR} Ns Pa /obj |
942 | .It | | 942 | .It |
943 | .Pa /usr/obj/ Ns Ev ${.CURDIR} | | 943 | .Pa /usr/obj/ Ns Ev ${.CURDIR} |
944 | .It | | 944 | .It |
945 | .Ev ${.CURDIR} | | 945 | .Ev ${.CURDIR} |
946 | .El | | 946 | .El |
947 | .Pp | | 947 | .Pp |
948 | Variable expansion is performed on the value before it's used, | | 948 | Variable expansion is performed on the value before it's used, |
949 | so expressions such as | | 949 | so expressions such as |
950 | .Dl ${.CURDIR:S,^/usr/src,/var/obj,} | | 950 | .Dl ${.CURDIR:S,^/usr/src,/var/obj,} |
951 | may be used. | | 951 | may be used. |
952 | This is especially useful with | | 952 | This is especially useful with |
953 | .Ql Ev MAKEOBJDIR . | | 953 | .Ql Ev MAKEOBJDIR . |
954 | .Pp | | 954 | .Pp |
955 | .Ql Va .OBJDIR | | 955 | .Ql Va .OBJDIR |
956 | may be modified in the makefile as a global variable. | | 956 | may be modified in the makefile as a global variable. |
957 | In all cases, | | 957 | In all cases, |
958 | .Nm | | 958 | .Nm |
959 | will | | 959 | will |
960 | .Xr chdir 2 | | 960 | .Xr chdir 2 |
961 | to | | 961 | to |
962 | .Ql Va .OBJDIR | | 962 | .Ql Va .OBJDIR |
963 | and set | | 963 | and set |
964 | .Ql Ev PWD | | 964 | .Ql Ev PWD |
965 | to that directory before executing any targets. | | 965 | to that directory before executing any targets. |
966 | . | | 966 | . |
967 | .It Va .PARSEDIR | | 967 | .It Va .PARSEDIR |
968 | A path to the directory of the current | | 968 | A path to the directory of the current |
969 | .Ql Pa Makefile | | 969 | .Ql Pa Makefile |
970 | being parsed. | | 970 | being parsed. |
971 | .It Va .PARSEFILE | | 971 | .It Va .PARSEFILE |
972 | The basename of the current | | 972 | The basename of the current |
973 | .Ql Pa Makefile | | 973 | .Ql Pa Makefile |
974 | being parsed. | | 974 | being parsed. |
975 | This variable and | | 975 | This variable and |
976 | .Ql Va .PARSEDIR | | 976 | .Ql Va .PARSEDIR |
977 | are both set only while the | | 977 | are both set only while the |
978 | .Ql Pa Makefiles | | 978 | .Ql Pa Makefiles |
979 | are being parsed. | | 979 | are being parsed. |
980 | If you want to retain their current values, assign them to a variable | | 980 | If you want to retain their current values, assign them to a variable |
981 | using assignment with expansion: | | 981 | using assignment with expansion: |
982 | .Pq Ql Cm \&:= . | | 982 | .Pq Ql Cm \&:= . |
983 | .It Va .PATH | | 983 | .It Va .PATH |
984 | A variable that represents the list of directories that | | 984 | A variable that represents the list of directories that |
985 | .Nm | | 985 | .Nm |
986 | will search for files. | | 986 | will search for files. |
987 | The search list should be updated using the target | | 987 | The search list should be updated using the target |
988 | .Ql Va .PATH | | 988 | .Ql Va .PATH |
989 | rather than the variable. | | 989 | rather than the variable. |
990 | .It Ev PWD | | 990 | .It Ev PWD |
991 | Alternate path to the current directory. | | 991 | Alternate path to the current directory. |
992 | .Nm | | 992 | .Nm |
993 | normally sets | | 993 | normally sets |
994 | .Ql Va .CURDIR | | 994 | .Ql Va .CURDIR |
995 | to the canonical path given by | | 995 | to the canonical path given by |
996 | .Xr getcwd 3 . | | 996 | .Xr getcwd 3 . |
997 | However, if the environment variable | | 997 | However, if the environment variable |
998 | .Ql Ev PWD | | 998 | .Ql Ev PWD |
999 | is set and gives a path to the current directory, then | | 999 | is set and gives a path to the current directory, then |
1000 | .Nm | | 1000 | .Nm |
1001 | sets | | 1001 | sets |
1002 | .Ql Va .CURDIR | | 1002 | .Ql Va .CURDIR |
1003 | to the value of | | 1003 | to the value of |
1004 | .Ql Ev PWD | | 1004 | .Ql Ev PWD |
1005 | instead. | | 1005 | instead. |
1006 | This behaviour is disabled if | | 1006 | This behaviour is disabled if |
1007 | .Ql Ev MAKEOBJDIRPREFIX | | 1007 | .Ql Ev MAKEOBJDIRPREFIX |
1008 | is set or | | 1008 | is set or |
1009 | .Ql Ev MAKEOBJDIR | | 1009 | .Ql Ev MAKEOBJDIR |
1010 | contains a variable transform. | | 1010 | contains a variable transform. |
1011 | .Ql Ev PWD | | 1011 | .Ql Ev PWD |
1012 | is set to the value of | | 1012 | is set to the value of |
1013 | .Ql Va .OBJDIR | | 1013 | .Ql Va .OBJDIR |
1014 | for all programs which | | 1014 | for all programs which |
1015 | .Nm | | 1015 | .Nm |
1016 | executes. | | 1016 | executes. |
1017 | .It Ev .TARGETS | | 1017 | .It Ev .TARGETS |
1018 | The list of targets explicitly specified on the command line, if any. | | 1018 | The list of targets explicitly specified on the command line, if any. |
1019 | .It Ev VPATH | | 1019 | .It Ev VPATH |
1020 | Colon-separated | | 1020 | Colon-separated |
1021 | .Pq Dq \&: | | 1021 | .Pq Dq \&: |
1022 | lists of directories that | | 1022 | lists of directories that |
1023 | .Nm | | 1023 | .Nm |
1024 | will search for files. | | 1024 | will search for files. |
1025 | The variable is supported for compatibility with old make programs only, | | 1025 | The variable is supported for compatibility with old make programs only, |
1026 | use | | 1026 | use |
1027 | .Ql Va .PATH | | 1027 | .Ql Va .PATH |
1028 | instead. | | 1028 | instead. |
1029 | .El | | 1029 | .El |
1030 | .Ss Variable modifiers | | 1030 | .Ss Variable modifiers |
1031 | Variable expansion may be modified to select or modify each word of the | | 1031 | Variable expansion may be modified to select or modify each word of the |