1*6eef5f0cSAntonio Huete Jimenez.\" $NetBSD: make.1,v 1.347 2022/09/15 14:49:36 uwe Exp $ 201e196c8SJohn Marino.\" 301e196c8SJohn Marino.\" Copyright (c) 1990, 1993 401e196c8SJohn Marino.\" The Regents of the University of California. All rights reserved. 501e196c8SJohn Marino.\" 601e196c8SJohn Marino.\" Redistribution and use in source and binary forms, with or without 701e196c8SJohn Marino.\" modification, are permitted provided that the following conditions 801e196c8SJohn Marino.\" are met: 901e196c8SJohn Marino.\" 1. Redistributions of source code must retain the above copyright 1001e196c8SJohn Marino.\" notice, this list of conditions and the following disclaimer. 1101e196c8SJohn Marino.\" 2. Redistributions in binary form must reproduce the above copyright 1201e196c8SJohn Marino.\" notice, this list of conditions and the following disclaimer in the 1301e196c8SJohn Marino.\" documentation and/or other materials provided with the distribution. 1401e196c8SJohn Marino.\" 3. Neither the name of the University nor the names of its contributors 1501e196c8SJohn Marino.\" may be used to endorse or promote products derived from this software 1601e196c8SJohn Marino.\" without specific prior written permission. 1701e196c8SJohn Marino.\" 1801e196c8SJohn Marino.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1901e196c8SJohn Marino.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2001e196c8SJohn Marino.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2101e196c8SJohn Marino.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2201e196c8SJohn Marino.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2301e196c8SJohn Marino.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2401e196c8SJohn Marino.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2501e196c8SJohn Marino.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2601e196c8SJohn Marino.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2701e196c8SJohn Marino.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2801e196c8SJohn Marino.\" SUCH DAMAGE. 2901e196c8SJohn Marino.\" 3001e196c8SJohn Marino.\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 3101e196c8SJohn Marino.\" 32*6eef5f0cSAntonio Huete Jimenez.Dd September 12, 2022 3301e196c8SJohn Marino.Dt MAKE 1 3401e196c8SJohn Marino.Os 3501e196c8SJohn Marino.Sh NAME 3601e196c8SJohn Marino.Nm make 3701e196c8SJohn Marino.Nd maintain program dependencies 3801e196c8SJohn Marino.Sh SYNOPSIS 3901e196c8SJohn Marino.Nm 40a34d5fb1SAntonio Huete Jimenez.Op Fl BeikNnqrSstWwX 4101e196c8SJohn Marino.Op Fl C Ar directory 4201e196c8SJohn Marino.Op Fl D Ar variable 4301e196c8SJohn Marino.Op Fl d Ar flags 4401e196c8SJohn Marino.Op Fl f Ar makefile 4501e196c8SJohn Marino.Op Fl I Ar directory 4601e196c8SJohn Marino.Op Fl J Ar private 4701e196c8SJohn Marino.Op Fl j Ar max_jobs 4801e196c8SJohn Marino.Op Fl m Ar directory 4901e196c8SJohn Marino.Op Fl T Ar file 5001e196c8SJohn Marino.Op Fl V Ar variable 51ca58f742SDaniel Fojt.Op Fl v Ar variable 52*6eef5f0cSAntonio Huete Jimenez.Op Ar variable\| Ns Cm \&= Ns Ar value 53*6eef5f0cSAntonio Huete Jimenez.Op Ar target No ... 5401e196c8SJohn Marino.Sh DESCRIPTION 5501e196c8SJohn Marino.Nm 5601e196c8SJohn Marinois a program designed to simplify the maintenance of other programs. 5701e196c8SJohn MarinoIts input is a list of specifications as to the files upon which programs 5801e196c8SJohn Marinoand other files depend. 5901e196c8SJohn MarinoIf no 6001e196c8SJohn Marino.Fl f Ar makefile 61*6eef5f0cSAntonio Huete Jimenezoption is given, 6201e196c8SJohn Marino.Nm 63*6eef5f0cSAntonio Huete Jimeneztries to open 64*6eef5f0cSAntonio Huete Jimenez.Sq Pa makefile 6501e196c8SJohn Marinothen 66*6eef5f0cSAntonio Huete Jimenez.Sq Pa Makefile 6701e196c8SJohn Marinoin order to find the specifications. 6801e196c8SJohn MarinoIf the file 69*6eef5f0cSAntonio Huete Jimenez.Sq Pa .depend 7001e196c8SJohn Marinoexists, it is read (see 7101e196c8SJohn Marino.Xr mkdep 1 ) . 7201e196c8SJohn Marino.Pp 7301e196c8SJohn MarinoThis manual page is intended as a reference document only. 7401e196c8SJohn MarinoFor a more thorough description of 7501e196c8SJohn Marino.Nm 7601e196c8SJohn Marinoand makefiles, please refer to 77*6eef5f0cSAntonio Huete Jimenez.%T "PMake \- A Tutorial" 78*6eef5f0cSAntonio Huete Jimenez(from 1993). 7901e196c8SJohn Marino.Pp 8001e196c8SJohn Marino.Nm 81*6eef5f0cSAntonio Huete Jimenezprepends the contents of the 82*6eef5f0cSAntonio Huete Jimenez.Ev MAKEFLAGS 8301e196c8SJohn Marinoenvironment variable to the command line arguments before parsing them. 8401e196c8SJohn Marino.Pp 8501e196c8SJohn MarinoThe options are as follows: 8601e196c8SJohn Marino.Bl -tag -width Ds 8701e196c8SJohn Marino.It Fl B 8801e196c8SJohn MarinoTry to be backwards compatible by executing a single shell per command and 89*6eef5f0cSAntonio Huete Jimenezby making the sources of a dependency line in sequence. 9001e196c8SJohn Marino.It Fl C Ar directory 9101e196c8SJohn MarinoChange to 9201e196c8SJohn Marino.Ar directory 9301e196c8SJohn Marinobefore reading the makefiles or doing anything else. 9401e196c8SJohn MarinoIf multiple 9501e196c8SJohn Marino.Fl C 9601e196c8SJohn Marinooptions are specified, each is interpreted relative to the previous one: 9701e196c8SJohn Marino.Fl C Pa / Fl C Pa etc 9801e196c8SJohn Marinois equivalent to 9901e196c8SJohn Marino.Fl C Pa /etc . 10001e196c8SJohn Marino.It Fl D Ar variable 10101e196c8SJohn MarinoDefine 10201e196c8SJohn Marino.Ar variable 103a34d5fb1SAntonio Huete Jimenezto be 1, in the global scope. 104*6eef5f0cSAntonio Huete Jimenez.It Fl d Oo Cm \- Oc Ns Ar flags 10501e196c8SJohn MarinoTurn on debugging, and specify which portions of 10601e196c8SJohn Marino.Nm 10701e196c8SJohn Marinoare to print debugging information. 10801e196c8SJohn MarinoUnless the flags are preceded by 109*6eef5f0cSAntonio Huete Jimenez.Ql \- , 11001e196c8SJohn Marinothey are added to the 111*6eef5f0cSAntonio Huete Jimenez.Ev MAKEFLAGS 112*6eef5f0cSAntonio Huete Jimenezenvironment variable and are passed on to any child make processes. 11301e196c8SJohn MarinoBy default, debugging information is printed to standard error, 11401e196c8SJohn Marinobut this can be changed using the 115*6eef5f0cSAntonio Huete Jimenez.Cm F 11601e196c8SJohn Marinodebugging flag. 11701e196c8SJohn MarinoThe debugging output is always unbuffered; in addition, if debugging 11801e196c8SJohn Marinois enabled but debugging output is not directed to standard output, 119*6eef5f0cSAntonio Huete Jimenezthe standard output is line buffered. 120*6eef5f0cSAntonio Huete JimenezThe available 121*6eef5f0cSAntonio Huete Jimenez.Ar flags 122*6eef5f0cSAntonio Huete Jimenezare: 12301e196c8SJohn Marino.Bl -tag -width Ds 124*6eef5f0cSAntonio Huete Jimenez.It Cm A 12501e196c8SJohn MarinoPrint all possible debugging information; 12601e196c8SJohn Marinoequivalent to specifying all of the debugging flags. 127*6eef5f0cSAntonio Huete Jimenez.It Cm a 12801e196c8SJohn MarinoPrint debugging information about archive searching and caching. 129*6eef5f0cSAntonio Huete Jimenez.It Cm C 130*6eef5f0cSAntonio Huete JimenezPrint debugging information about the current working directory. 131*6eef5f0cSAntonio Huete Jimenez.It Cm c 13201e196c8SJohn MarinoPrint debugging information about conditional evaluation. 133*6eef5f0cSAntonio Huete Jimenez.It Cm d 13401e196c8SJohn MarinoPrint debugging information about directory searching and caching. 135*6eef5f0cSAntonio Huete Jimenez.It Cm e 13601e196c8SJohn MarinoPrint debugging information about failed commands and targets. 137*6eef5f0cSAntonio Huete Jimenez.It Cm F Ns Oo Cm \&+ Oc Ns Ar filename 13801e196c8SJohn MarinoSpecify where debugging output is written. 13901e196c8SJohn MarinoThis must be the last flag, because it consumes the remainder of 14001e196c8SJohn Marinothe argument. 14101e196c8SJohn MarinoIf the character immediately after the 142*6eef5f0cSAntonio Huete Jimenez.Cm F 14301e196c8SJohn Marinoflag is 14401e196c8SJohn Marino.Ql \&+ , 145*6eef5f0cSAntonio Huete Jimenezthe file is opened in append mode; 146*6eef5f0cSAntonio Huete Jimenezotherwise the file is overwritten. 14701e196c8SJohn MarinoIf the file name is 14801e196c8SJohn Marino.Ql stdout 14901e196c8SJohn Marinoor 150*6eef5f0cSAntonio Huete Jimenez.Ql stderr , 151*6eef5f0cSAntonio Huete Jimenezdebugging output is written to the 15201e196c8SJohn Marinostandard output or standard error output file descriptors respectively 15301e196c8SJohn Marino(and the 15401e196c8SJohn Marino.Ql \&+ 15501e196c8SJohn Marinooption has no effect). 156*6eef5f0cSAntonio Huete JimenezOtherwise, the output is written to the named file. 157*6eef5f0cSAntonio Huete JimenezIf the file name ends with 158*6eef5f0cSAntonio Huete Jimenez.Ql .%d , 159*6eef5f0cSAntonio Huete Jimenezthe 16001e196c8SJohn Marino.Ql %d 16101e196c8SJohn Marinois replaced by the pid. 162*6eef5f0cSAntonio Huete Jimenez.It Cm f 16301e196c8SJohn MarinoPrint debugging information about loop evaluation. 164*6eef5f0cSAntonio Huete Jimenez.It Cm g1 16501e196c8SJohn MarinoPrint the input graph before making anything. 166*6eef5f0cSAntonio Huete Jimenez.It Cm g2 16701e196c8SJohn MarinoPrint the input graph after making everything, or before exiting 16801e196c8SJohn Marinoon error. 169*6eef5f0cSAntonio Huete Jimenez.It Cm g3 17001e196c8SJohn MarinoPrint the input graph before exiting on error. 171*6eef5f0cSAntonio Huete Jimenez.It Cm h 172a34d5fb1SAntonio Huete JimenezPrint debugging information about hash table operations. 173*6eef5f0cSAntonio Huete Jimenez.It Cm j 17401e196c8SJohn MarinoPrint debugging information about running multiple shells. 175*6eef5f0cSAntonio Huete Jimenez.It Cm L 176a34d5fb1SAntonio Huete JimenezTurn on lint checks. 177*6eef5f0cSAntonio Huete JimenezThis throws errors for variable assignments that do not parse correctly, 178*6eef5f0cSAntonio Huete Jimenezat the time of assignment, so the file and line number are available. 179*6eef5f0cSAntonio Huete Jimenez.It Cm l 18001e196c8SJohn MarinoPrint commands in Makefiles regardless of whether or not they are prefixed by 18101e196c8SJohn Marino.Ql @ 182*6eef5f0cSAntonio Huete Jimenezor other 183*6eef5f0cSAntonio Huete Jimenez.Dq quiet 184*6eef5f0cSAntonio Huete Jimenezflags. 185*6eef5f0cSAntonio Huete JimenezAlso known as 186*6eef5f0cSAntonio Huete Jimenez.Dq loud 187*6eef5f0cSAntonio Huete Jimenezbehavior. 188*6eef5f0cSAntonio Huete Jimenez.It Cm M 189*6eef5f0cSAntonio Huete JimenezPrint debugging information about 190*6eef5f0cSAntonio Huete Jimenez.Dq meta 191*6eef5f0cSAntonio Huete Jimenezmode decisions about targets. 192*6eef5f0cSAntonio Huete Jimenez.It Cm m 19301e196c8SJohn MarinoPrint debugging information about making targets, including modification 19401e196c8SJohn Marinodates. 195*6eef5f0cSAntonio Huete Jimenez.It Cm n 19601e196c8SJohn MarinoDon't delete the temporary command scripts created when running commands. 19701e196c8SJohn MarinoThese temporary scripts are created in the directory 19801e196c8SJohn Marinoreferred to by the 19901e196c8SJohn Marino.Ev TMPDIR 20001e196c8SJohn Marinoenvironment variable, or in 20101e196c8SJohn Marino.Pa /tmp 20201e196c8SJohn Marinoif 20301e196c8SJohn Marino.Ev TMPDIR 20401e196c8SJohn Marinois unset or set to the empty string. 20501e196c8SJohn MarinoThe temporary scripts are created by 20601e196c8SJohn Marino.Xr mkstemp 3 , 20701e196c8SJohn Marinoand have names of the form 20801e196c8SJohn Marino.Pa makeXXXXXX . 20901e196c8SJohn Marino.Em NOTE : 21001e196c8SJohn MarinoThis can create many files in 21101e196c8SJohn Marino.Ev TMPDIR 21201e196c8SJohn Marinoor 21301e196c8SJohn Marino.Pa /tmp , 21401e196c8SJohn Marinoso use with care. 215*6eef5f0cSAntonio Huete Jimenez.It Cm p 21601e196c8SJohn MarinoPrint debugging information about makefile parsing. 217*6eef5f0cSAntonio Huete Jimenez.It Cm s 21801e196c8SJohn MarinoPrint debugging information about suffix-transformation rules. 219*6eef5f0cSAntonio Huete Jimenez.It Cm t 22001e196c8SJohn MarinoPrint debugging information about target list maintenance. 221*6eef5f0cSAntonio Huete Jimenez.It Cm V 22201e196c8SJohn MarinoForce the 22301e196c8SJohn Marino.Fl V 224*6eef5f0cSAntonio Huete Jimenezoption to print raw values of variables, 225*6eef5f0cSAntonio Huete Jimenezoverriding the default behavior set via 226ca58f742SDaniel Fojt.Va .MAKE.EXPAND_VARIABLES . 227*6eef5f0cSAntonio Huete Jimenez.It Cm v 228*6eef5f0cSAntonio Huete JimenezPrint debugging information about variable assignment and expansion. 229*6eef5f0cSAntonio Huete Jimenez.It Cm x 23001e196c8SJohn MarinoRun shell commands with 23101e196c8SJohn Marino.Fl x 23201e196c8SJohn Marinoso the actual commands are printed as they are executed. 23301e196c8SJohn Marino.El 23401e196c8SJohn Marino.It Fl e 235*6eef5f0cSAntonio Huete JimenezLet environment variables override global variables within makefiles. 23601e196c8SJohn Marino.It Fl f Ar makefile 23701e196c8SJohn MarinoSpecify a makefile to read instead of the default 238*6eef5f0cSAntonio Huete Jimenez.Pa makefile 239*6eef5f0cSAntonio Huete Jimenezor 240*6eef5f0cSAntonio Huete Jimenez.Pa Makefile . 24101e196c8SJohn MarinoIf 24201e196c8SJohn Marino.Ar makefile 24301e196c8SJohn Marinois 244*6eef5f0cSAntonio Huete Jimenez.Ql \&- , 24501e196c8SJohn Marinostandard input is read. 24601e196c8SJohn MarinoMultiple makefiles may be specified, and are read in the order specified. 24701e196c8SJohn Marino.It Fl I Ar directory 24801e196c8SJohn MarinoSpecify a directory in which to search for makefiles and included makefiles. 24901e196c8SJohn MarinoThe system makefile directory (or directories, see the 25001e196c8SJohn Marino.Fl m 25101e196c8SJohn Marinooption) is automatically included as part of this list. 25201e196c8SJohn Marino.It Fl i 25301e196c8SJohn MarinoIgnore non-zero exit of shell commands in the makefile. 25401e196c8SJohn MarinoEquivalent to specifying 255*6eef5f0cSAntonio Huete Jimenez.Sq Ic \&- 25601e196c8SJohn Marinobefore each command line in the makefile. 25701e196c8SJohn Marino.It Fl J Ar private 25801e196c8SJohn MarinoThis option should 25901e196c8SJohn Marino.Em not 26001e196c8SJohn Marinobe specified by the user. 26101e196c8SJohn Marino.Pp 26201e196c8SJohn MarinoWhen the 263*6eef5f0cSAntonio Huete Jimenez.Fl j 26401e196c8SJohn Marinooption is in use in a recursive build, this option is passed by a make 26501e196c8SJohn Marinoto child makes to allow all the make processes in the build to 26601e196c8SJohn Marinocooperate to avoid overloading the system. 26701e196c8SJohn Marino.It Fl j Ar max_jobs 26801e196c8SJohn MarinoSpecify the maximum number of jobs that 26901e196c8SJohn Marino.Nm 27001e196c8SJohn Marinomay have running at any one time. 27101e196c8SJohn MarinoThe value is saved in 27201e196c8SJohn Marino.Va .MAKE.JOBS . 27301e196c8SJohn MarinoTurns compatibility mode off, unless the 274*6eef5f0cSAntonio Huete Jimenez.Fl B 275*6eef5f0cSAntonio Huete Jimenezoption is also specified. 27601e196c8SJohn MarinoWhen compatibility mode is off, all commands associated with a 27701e196c8SJohn Marinotarget are executed in a single shell invocation as opposed to the 27801e196c8SJohn Marinotraditional one shell invocation per line. 27901e196c8SJohn MarinoThis can break traditional scripts which change directories on each 28001e196c8SJohn Marinocommand invocation and then expect to start with a fresh environment 28101e196c8SJohn Marinoon the next line. 28201e196c8SJohn MarinoIt is more efficient to correct the scripts rather than turn backwards 28301e196c8SJohn Marinocompatibility on. 28401e196c8SJohn Marino.It Fl k 28501e196c8SJohn MarinoContinue processing after errors are encountered, but only on those targets 28601e196c8SJohn Marinothat do not depend on the target whose creation caused the error. 28701e196c8SJohn Marino.It Fl m Ar directory 288*6eef5f0cSAntonio Huete JimenezSpecify a directory in which to search for 289*6eef5f0cSAntonio Huete Jimenez.Pa sys.mk 290*6eef5f0cSAntonio Huete Jimenezand makefiles included via the 291ca58f742SDaniel Fojt.Li \&< Ns Ar file Ns Li \&> Ns -style 29201e196c8SJohn Marinoinclude statement. 29301e196c8SJohn MarinoThe 29401e196c8SJohn Marino.Fl m 29501e196c8SJohn Marinooption can be used multiple times to form a search path. 296*6eef5f0cSAntonio Huete JimenezThis path overrides the default system include path 297*6eef5f0cSAntonio Huete Jimenez.Pa /usr/share/mk . 298*6eef5f0cSAntonio Huete JimenezFurthermore, the system include path is appended to the search path used for 299ca58f742SDaniel Fojt.Li \*q Ns Ar file Ns Li \*q Ns -style 30001e196c8SJohn Marinoinclude statements (see the 30101e196c8SJohn Marino.Fl I 30201e196c8SJohn Marinooption). 30301e196c8SJohn Marino.Pp 304*6eef5f0cSAntonio Huete JimenezIf a directory name in the 30501e196c8SJohn Marino.Fl m 30601e196c8SJohn Marinoargument (or the 30701e196c8SJohn Marino.Ev MAKESYSPATH 30801e196c8SJohn Marinoenvironment variable) starts with the string 309*6eef5f0cSAntonio Huete Jimenez.Ql \&.../ , 31001e196c8SJohn Marino.Nm 311*6eef5f0cSAntonio Huete Jimenezsearches for the specified file or directory named in the remaining part 31201e196c8SJohn Marinoof the argument string. 313*6eef5f0cSAntonio Huete JimenezThe search starts with the current directory 314*6eef5f0cSAntonio Huete Jimenezand then works upward towards the root of the file system. 315*6eef5f0cSAntonio Huete JimenezIf the search is successful, the resulting directory replaces the 316*6eef5f0cSAntonio Huete Jimenez.Ql \&.../ 31701e196c8SJohn Marinospecification in the 31801e196c8SJohn Marino.Fl m 31901e196c8SJohn Marinoargument. 320*6eef5f0cSAntonio Huete JimenezThis feature allows 32101e196c8SJohn Marino.Nm 322*6eef5f0cSAntonio Huete Jimenezto easily search in the current source tree for customized 323*6eef5f0cSAntonio Huete Jimenez.Pa sys.mk 324*6eef5f0cSAntonio Huete Jimenezfiles (e.g., by using 325*6eef5f0cSAntonio Huete Jimenez.Ql \&.../mk/sys.mk 32601e196c8SJohn Marinoas an argument). 32701e196c8SJohn Marino.It Fl n 32801e196c8SJohn MarinoDisplay the commands that would have been executed, but do not 329*6eef5f0cSAntonio Huete Jimenezactually execute them unless the target depends on the 330*6eef5f0cSAntonio Huete Jimenez.Va .MAKE 331*6eef5f0cSAntonio Huete Jimenezspecial source (see below) or the command is prefixed with 332*6eef5f0cSAntonio Huete Jimenez.Sq Cm + . 33301e196c8SJohn Marino.It Fl N 334*6eef5f0cSAntonio Huete JimenezDisplay the commands that would have been executed, 335*6eef5f0cSAntonio Huete Jimenezbut do not actually execute any of them; 336*6eef5f0cSAntonio Huete Jimenezuseful for debugging top-level makefiles 33701e196c8SJohn Marinowithout descending into subdirectories. 33801e196c8SJohn Marino.It Fl q 339*6eef5f0cSAntonio Huete JimenezDo not execute any commands, 340*6eef5f0cSAntonio Huete Jimenezinstead exit 0 if the specified targets are up to date, and 1 otherwise. 34101e196c8SJohn Marino.It Fl r 34201e196c8SJohn MarinoDo not use the built-in rules specified in the system makefile. 343a34d5fb1SAntonio Huete Jimenez.It Fl S 344a34d5fb1SAntonio Huete JimenezStop processing if an error is encountered. 345a34d5fb1SAntonio Huete JimenezThis is the default behavior and the opposite of 346a34d5fb1SAntonio Huete Jimenez.Fl k . 34701e196c8SJohn Marino.It Fl s 34801e196c8SJohn MarinoDo not echo any commands as they are executed. 34901e196c8SJohn MarinoEquivalent to specifying 350*6eef5f0cSAntonio Huete Jimenez.Sq Ic @ 35101e196c8SJohn Marinobefore each command line in the makefile. 35201e196c8SJohn Marino.It Fl T Ar tracefile 35301e196c8SJohn MarinoWhen used with the 35401e196c8SJohn Marino.Fl j 35501e196c8SJohn Marinoflag, 35601e196c8SJohn Marinoappend a trace record to 35701e196c8SJohn Marino.Ar tracefile 35801e196c8SJohn Marinofor each job started and completed. 35901e196c8SJohn Marino.It Fl t 36001e196c8SJohn MarinoRather than re-building a target as specified in the makefile, create it 36101e196c8SJohn Marinoor update its modification time to make it appear up-to-date. 36201e196c8SJohn Marino.It Fl V Ar variable 363ca58f742SDaniel FojtPrint the value of 364ca58f742SDaniel Fojt.Ar variable . 36501e196c8SJohn MarinoDo not build any targets. 36601e196c8SJohn MarinoMultiple instances of this option may be specified; 367*6eef5f0cSAntonio Huete Jimenezthe variables are printed one per line, 36801e196c8SJohn Marinowith a blank line for each null or undefined variable. 369a34d5fb1SAntonio Huete JimenezThe value printed is extracted from the global scope after all 370ca58f742SDaniel Fojtmakefiles have been read. 371ca58f742SDaniel FojtBy default, the raw variable contents (which may 372ca58f742SDaniel Fojtinclude additional unexpanded variable references) are shown. 37301e196c8SJohn MarinoIf 37401e196c8SJohn Marino.Ar variable 37501e196c8SJohn Marinocontains a 376*6eef5f0cSAntonio Huete Jimenez.Ql \&$ , 377*6eef5f0cSAntonio Huete Jimenezthe value is recursively expanded to its complete resultant 378ca58f742SDaniel Fojttext before printing. 379*6eef5f0cSAntonio Huete JimenezThe expanded value is also printed if 380ca58f742SDaniel Fojt.Va .MAKE.EXPAND_VARIABLES 381*6eef5f0cSAntonio Huete Jimenezis set to true and the 382ca58f742SDaniel Fojt.Fl dV 383ca58f742SDaniel Fojtoption has not been used to override it. 384ca58f742SDaniel FojtNote that loop-local and target-local variables, as well as values 385ca58f742SDaniel Fojttaken temporarily by global variables during makefile processing, are 386ca58f742SDaniel Fojtnot accessible via this option. 387ca58f742SDaniel FojtThe 388ca58f742SDaniel Fojt.Fl dv 389ca58f742SDaniel Fojtdebug mode can be used to see these at the cost of generating 390ca58f742SDaniel Fojtsubstantial extraneous output. 391ca58f742SDaniel Fojt.It Fl v Ar variable 392ca58f742SDaniel FojtLike 393*6eef5f0cSAntonio Huete Jimenez.Fl V , 394*6eef5f0cSAntonio Huete Jimenezbut all printed variables are always expanded to their complete value. 395*6eef5f0cSAntonio Huete JimenezThe last occurrence of 396ca58f742SDaniel Fojt.Fl V 397*6eef5f0cSAntonio Huete Jimenezor 398*6eef5f0cSAntonio Huete Jimenez.Fl v 399*6eef5f0cSAntonio Huete Jimenezdecides whether all variables are expanded or not. 40001e196c8SJohn Marino.It Fl W 40101e196c8SJohn MarinoTreat any warnings during makefile parsing as errors. 4026a91b982SJohn Marino.It Fl w 4036a91b982SJohn MarinoPrint entering and leaving directory messages, pre and post processing. 40401e196c8SJohn Marino.It Fl X 40501e196c8SJohn MarinoDon't export variables passed on the command line to the environment 40601e196c8SJohn Marinoindividually. 407*6eef5f0cSAntonio Huete JimenezVariables passed on the command line are still exported via the 408*6eef5f0cSAntonio Huete Jimenez.Ev MAKEFLAGS 40901e196c8SJohn Marinoenvironment variable. 41001e196c8SJohn MarinoThis option may be useful on systems which have a small limit on the 41101e196c8SJohn Marinosize of command arguments. 412*6eef5f0cSAntonio Huete Jimenez.It Ar variable\| Ns Cm \&= Ns Ar value 41301e196c8SJohn MarinoSet the value of the variable 41401e196c8SJohn Marino.Ar variable 41501e196c8SJohn Marinoto 41601e196c8SJohn Marino.Ar value . 41701e196c8SJohn MarinoNormally, all values passed on the command line are also exported to 41801e196c8SJohn Marinosub-makes in the environment. 41901e196c8SJohn MarinoThe 42001e196c8SJohn Marino.Fl X 42101e196c8SJohn Marinoflag disables this behavior. 42201e196c8SJohn MarinoVariable assignments should follow options for POSIX compatibility 42301e196c8SJohn Marinobut no ordering is enforced. 42401e196c8SJohn Marino.El 42501e196c8SJohn Marino.Pp 426*6eef5f0cSAntonio Huete JimenezThere are several different types of lines in a makefile: dependency 42701e196c8SJohn Marinospecifications, shell commands, variable assignments, include statements, 428*6eef5f0cSAntonio Huete Jimenezconditional directives, for loops, other directives, and comments. 42901e196c8SJohn Marino.Pp 430*6eef5f0cSAntonio Huete JimenezLines may be continued from one line to the next 431*6eef5f0cSAntonio Huete Jimenezby ending them with a backslash 43201e196c8SJohn Marino.Pq Ql \e . 43301e196c8SJohn MarinoThe trailing newline character and initial whitespace on the following 43401e196c8SJohn Marinoline are compressed into a single space. 43501e196c8SJohn Marino.Sh FILE DEPENDENCY SPECIFICATIONS 43601e196c8SJohn MarinoDependency lines consist of one or more targets, an operator, and zero 43701e196c8SJohn Marinoor more sources. 43801e196c8SJohn MarinoThis creates a relationship where the targets 43901e196c8SJohn Marino.Dq depend 440*6eef5f0cSAntonio Huete Jimenezon the sources and are customarily created from them. 441*6eef5f0cSAntonio Huete JimenezA target is considered out of date if it does not exist, 442*6eef5f0cSAntonio Huete Jimenezor if its modification time is less than that of any of its sources. 443*6eef5f0cSAntonio Huete JimenezAn out-of-date target is re-created, but not until all sources 444a34d5fb1SAntonio Huete Jimenezhave been examined and themselves re-created as needed. 445a34d5fb1SAntonio Huete JimenezThree operators may be used: 44601e196c8SJohn Marino.Bl -tag -width flag 44701e196c8SJohn Marino.It Ic \&: 448a34d5fb1SAntonio Huete JimenezMany dependency lines may name this target but only one may have 449a34d5fb1SAntonio Huete Jimenezattached shell commands. 450a34d5fb1SAntonio Huete JimenezAll sources named in all dependency lines are considered together, 451a34d5fb1SAntonio Huete Jimenezand if needed the attached shell commands are run to create or 452a34d5fb1SAntonio Huete Jimenezre-create the target. 453a34d5fb1SAntonio Huete JimenezIf 45401e196c8SJohn Marino.Nm 455a34d5fb1SAntonio Huete Jimenezis interrupted, the target is removed. 45601e196c8SJohn Marino.It Ic \&! 457a34d5fb1SAntonio Huete JimenezThe same, but the target is always re-created whether or not it is out 458a34d5fb1SAntonio Huete Jimenezof date. 45901e196c8SJohn Marino.It Ic \&:: 460a34d5fb1SAntonio Huete JimenezAny dependency line may have attached shell commands, but each one 461a34d5fb1SAntonio Huete Jimenezis handled independently: its sources are considered and the attached 462a34d5fb1SAntonio Huete Jimenezshell commands are run if the target is out of date with respect to 463a34d5fb1SAntonio Huete Jimenez(only) those sources. 464a34d5fb1SAntonio Huete JimenezThus, different groups of the attached shell commands may be run 465a34d5fb1SAntonio Huete Jimenezdepending on the circumstances. 466a34d5fb1SAntonio Huete JimenezFurthermore, unlike 467a34d5fb1SAntonio Huete Jimenez.Ic \&:, 468a34d5fb1SAntonio Huete Jimenezfor dependency lines with no sources, the attached shell 469a34d5fb1SAntonio Huete Jimenezcommands are always run. 470a34d5fb1SAntonio Huete JimenezAlso unlike 471a34d5fb1SAntonio Huete Jimenez.Ic \&:, 472*6eef5f0cSAntonio Huete Jimenezthe target is not removed if 47301e196c8SJohn Marino.Nm 47401e196c8SJohn Marinois interrupted. 47501e196c8SJohn Marino.El 476a34d5fb1SAntonio Huete JimenezAll dependency lines mentioning a particular target must use the same 477a34d5fb1SAntonio Huete Jimenezoperator. 47801e196c8SJohn Marino.Pp 47901e196c8SJohn MarinoTargets and sources may contain the shell wildcard values 48001e196c8SJohn Marino.Ql \&? , 48101e196c8SJohn Marino.Ql * , 48201e196c8SJohn Marino.Ql [] , 48301e196c8SJohn Marinoand 48401e196c8SJohn Marino.Ql {} . 48501e196c8SJohn MarinoThe values 48601e196c8SJohn Marino.Ql \&? , 48701e196c8SJohn Marino.Ql * , 48801e196c8SJohn Marinoand 48901e196c8SJohn Marino.Ql [] 490*6eef5f0cSAntonio Huete Jimenezmay only be used as part of the final component of the target or source, 491*6eef5f0cSAntonio Huete Jimenezand only match existing files. 49201e196c8SJohn MarinoThe value 49301e196c8SJohn Marino.Ql {} 49401e196c8SJohn Marinoneed not necessarily be used to describe existing files. 49501e196c8SJohn MarinoExpansion is in directory order, not alphabetically as done in the shell. 49601e196c8SJohn Marino.Sh SHELL COMMANDS 497*6eef5f0cSAntonio Huete JimenezEach target may have associated with it one or more lines of shell commands, 498*6eef5f0cSAntonio Huete Jimeneznormally used to create the target. 4996a91b982SJohn MarinoEach of the lines in this script 50001e196c8SJohn Marino.Em must 50101e196c8SJohn Marinobe preceded by a tab. 5026a91b982SJohn Marino(For historical reasons, spaces are not accepted.) 503*6eef5f0cSAntonio Huete JimenezWhile targets can occur in many dependency lines if desired, 504*6eef5f0cSAntonio Huete Jimenezby default only one of these rules may be followed by a creation script. 5056a91b982SJohn MarinoIf the 506*6eef5f0cSAntonio Huete Jimenez.Sq Ic \&:: 507*6eef5f0cSAntonio Huete Jimenezoperator is used, however, 508*6eef5f0cSAntonio Huete Jimenezall rules may include scripts and the scripts are executed in the order found. 50901e196c8SJohn Marino.Pp 510*6eef5f0cSAntonio Huete JimenezEach line is treated as a separate shell command, 511*6eef5f0cSAntonio Huete Jimenezunless the end of line is escaped with a backslash 512*6eef5f0cSAntonio Huete Jimenez.Pq Ql \e , 5136a91b982SJohn Marinoin which case that line and the next are combined. 5146a91b982SJohn MarinoIf the first characters of the command are any combination of 515*6eef5f0cSAntonio Huete Jimenez.Sq Ic @ , 516*6eef5f0cSAntonio Huete Jimenez.Sq Ic + , 51701e196c8SJohn Marinoor 518*6eef5f0cSAntonio Huete Jimenez.Sq Ic \- , 51901e196c8SJohn Marinothe command is treated specially. 52001e196c8SJohn MarinoA 521*6eef5f0cSAntonio Huete Jimenez.Sq Ic @ 52201e196c8SJohn Marinocauses the command not to be echoed before it is executed. 52301e196c8SJohn MarinoA 524*6eef5f0cSAntonio Huete Jimenez.Sq Ic + 52501e196c8SJohn Marinocauses the command to be executed even when 52601e196c8SJohn Marino.Fl n 52701e196c8SJohn Marinois given. 528*6eef5f0cSAntonio Huete JimenezThis is similar to the effect of the 529*6eef5f0cSAntonio Huete Jimenez.Va .MAKE 530*6eef5f0cSAntonio Huete Jimenezspecial source, 53101e196c8SJohn Marinoexcept that the effect can be limited to a single line of a script. 53201e196c8SJohn MarinoA 533*6eef5f0cSAntonio Huete Jimenez.Sq Ic \- 534f445c897SJohn Marinoin compatibility mode 53501e196c8SJohn Marinocauses any non-zero exit status of the command line to be ignored. 5365f1e34d9SAlexandre Perrin.Pp 5375f1e34d9SAlexandre PerrinWhen 5385f1e34d9SAlexandre Perrin.Nm 5395f1e34d9SAlexandre Perrinis run in jobs mode with 5405f1e34d9SAlexandre Perrin.Fl j Ar max_jobs , 541*6eef5f0cSAntonio Huete Jimenezthe entire script for the target is fed to a single instance of the shell. 5425f1e34d9SAlexandre PerrinIn compatibility (non-jobs) mode, each command is run in a separate process. 5435f1e34d9SAlexandre PerrinIf the command contains any shell meta characters 544*6eef5f0cSAntonio Huete Jimenez.Pq Ql #=|^(){};&<>*?[]:$`\e\en , 545*6eef5f0cSAntonio Huete Jimenezit is passed to the shell; otherwise 5465f1e34d9SAlexandre Perrin.Nm 547*6eef5f0cSAntonio Huete Jimenezattempts direct execution. 548f445c897SJohn MarinoIf a line starts with 549*6eef5f0cSAntonio Huete Jimenez.Sq Ic \- 550*6eef5f0cSAntonio Huete Jimenezand the shell has ErrCtl enabled, 551*6eef5f0cSAntonio Huete Jimenezfailure of the command line is ignored as in compatibility mode. 552f445c897SJohn MarinoOtherwise 553*6eef5f0cSAntonio Huete Jimenez.Sq Ic \- 554f445c897SJohn Marinoaffects the entire job; 555*6eef5f0cSAntonio Huete Jimenezthe script stops at the first command line that fails, 556*6eef5f0cSAntonio Huete Jimenezbut the target is not deemed to have failed. 5575f1e34d9SAlexandre Perrin.Pp 5586a91b982SJohn MarinoMakefiles should be written so that the mode of 5596a91b982SJohn Marino.Nm 5606a91b982SJohn Marinooperation does not change their behavior. 561*6eef5f0cSAntonio Huete JimenezFor example, any command which uses 5626a91b982SJohn Marino.Dq cd 5636a91b982SJohn Marinoor 5646a91b982SJohn Marino.Dq chdir 565*6eef5f0cSAntonio Huete Jimenezwithout the intention of changing the directory for subsequent commands 5666a91b982SJohn Marinoshould be put in parentheses so it executes in a subshell. 567*6eef5f0cSAntonio Huete JimenezTo force the use of a single shell, escape the line breaks so as to make 5686a91b982SJohn Marinothe whole script one command. 5696a91b982SJohn MarinoFor example: 5706a91b982SJohn Marino.Bd -literal -offset indent 5716a91b982SJohn Marinoavoid-chdir-side-effects: 5726a91b982SJohn Marino @echo Building $@ in `pwd` 5736a91b982SJohn Marino @(cd ${.CURDIR} && ${MAKE} $@) 5746a91b982SJohn Marino @echo Back in `pwd` 5756a91b982SJohn Marino 5766a91b982SJohn Marinoensure-one-shell-regardless-of-mode: 5776a91b982SJohn Marino @echo Building $@ in `pwd`; \e 5786a91b982SJohn Marino (cd ${.CURDIR} && ${MAKE} $@); \e 5796a91b982SJohn Marino echo Back in `pwd` 5806a91b982SJohn Marino.Ed 5816a91b982SJohn Marino.Pp 5825f1e34d9SAlexandre PerrinSince 5835f1e34d9SAlexandre Perrin.Nm 584*6eef5f0cSAntonio Huete Jimenezchanges the current working directory to 585*6eef5f0cSAntonio Huete Jimenez.Sq Va .OBJDIR 586*6eef5f0cSAntonio Huete Jimenezbefore executing any targets, 587*6eef5f0cSAntonio Huete Jimenezeach child process starts with that as its current working directory. 58801e196c8SJohn Marino.Sh VARIABLE ASSIGNMENTS 589*6eef5f0cSAntonio Huete JimenezVariables in make behave much like macros in the C preprocessor. 590*6eef5f0cSAntonio Huete Jimenez.Pp 591*6eef5f0cSAntonio Huete JimenezVariable assignments have the form 592*6eef5f0cSAntonio Huete Jimenez.Sq Ar NAME Ar op Ar value , 593*6eef5f0cSAntonio Huete Jimenezwhere: 594*6eef5f0cSAntonio Huete Jimenez.Bl -tag -width Ds 595*6eef5f0cSAntonio Huete Jimenez.It Ar NAME 596*6eef5f0cSAntonio Huete Jimenezis a single-word variable name, 597*6eef5f0cSAntonio Huete Jimenezconsisting, by tradition, of all upper-case letters, 598*6eef5f0cSAntonio Huete Jimenez.It Ar op 599*6eef5f0cSAntonio Huete Jimenezis one of the five variable assignment operators described below, and 600*6eef5f0cSAntonio Huete Jimenez.It Ar value 601*6eef5f0cSAntonio Huete Jimenezis interpreted according to the variable assignment operator. 602*6eef5f0cSAntonio Huete Jimenez.El 603*6eef5f0cSAntonio Huete Jimenez.Pp 604*6eef5f0cSAntonio Huete JimenezWhitespace around 605*6eef5f0cSAntonio Huete Jimenez.Ar NAME , 606*6eef5f0cSAntonio Huete Jimenez.Ar op 607*6eef5f0cSAntonio Huete Jimenezand 608*6eef5f0cSAntonio Huete Jimenez.Ar value 609*6eef5f0cSAntonio Huete Jimenezis discarded. 610*6eef5f0cSAntonio Huete Jimenez.Ss Variable assignment operators 611*6eef5f0cSAntonio Huete JimenezThe five operators that assign values to variables are: 61201e196c8SJohn Marino.Bl -tag -width Ds 61301e196c8SJohn Marino.It Ic \&= 61401e196c8SJohn MarinoAssign the value to the variable. 615*6eef5f0cSAntonio Huete JimenezAny previous value is overwritten. 61601e196c8SJohn Marino.It Ic \&+= 617*6eef5f0cSAntonio Huete JimenezAppend the value to the current value of the variable, 618*6eef5f0cSAntonio Huete Jimenezseparating them by a single space. 61901e196c8SJohn Marino.It Ic \&?= 62001e196c8SJohn MarinoAssign the value to the variable if it is not already defined. 62101e196c8SJohn Marino.It Ic \&:= 62201e196c8SJohn MarinoAssign with expansion, i.e. expand the value before assigning it 62301e196c8SJohn Marinoto the variable. 62401e196c8SJohn MarinoNormally, expansion is not done until the variable is referenced. 625*6eef5f0cSAntonio Huete Jimenez.Pp 62601e196c8SJohn Marino.Em NOTE : 62701e196c8SJohn MarinoReferences to undefined variables are 62801e196c8SJohn Marino.Em not 62901e196c8SJohn Marinoexpanded. 63001e196c8SJohn MarinoThis can cause problems when variable modifiers are used. 631*6eef5f0cSAntonio Huete Jimenez.\" See var-op-expand.mk, the section with LATER and INDIRECT. 63201e196c8SJohn Marino.It Ic \&!= 633*6eef5f0cSAntonio Huete JimenezExpand the value and pass it to the shell for execution, 634*6eef5f0cSAntonio Huete Jimenezthen assign the output from the child's standard output to the variable. 63501e196c8SJohn MarinoAny newlines in the result are replaced with spaces. 63601e196c8SJohn Marino.El 637*6eef5f0cSAntonio Huete Jimenez.Ss Expansion of variables 638*6eef5f0cSAntonio Huete JimenezIn most contexts where variables are expanded, 639*6eef5f0cSAntonio Huete Jimenez.Ql \&$$ 640*6eef5f0cSAntonio Huete Jimenezexpands to a single dollar sign. 641*6eef5f0cSAntonio Huete JimenezIn other contexts (most variable modifiers, string literals in conditions), 642*6eef5f0cSAntonio Huete Jimenez.Ql \&\e$ 643*6eef5f0cSAntonio Huete Jimenezexpands to a single dollar sign. 64401e196c8SJohn Marino.Pp 645*6eef5f0cSAntonio Huete JimenezReferences to variables have the form 646*6eef5f0cSAntonio Huete Jimenez.Cm \&${ Ns Ar name Ns Oo Ns Cm \&: Ns Ar modifiers Oc Ns Cm \&} 647*6eef5f0cSAntonio Huete Jimenezor 648*6eef5f0cSAntonio Huete Jimenez.Cm \&$( Ns Ar name Ns Oo Ns Cm \&: Ns Ar modifiers Oc Ns Cm \&) . 649*6eef5f0cSAntonio Huete JimenezIf the variable name consists of only a single character, 650*6eef5f0cSAntonio Huete Jimenezthe surrounding curly braces or parentheses are not required. 65101e196c8SJohn MarinoThis shorter form is not recommended. 65201e196c8SJohn Marino.Pp 653*6eef5f0cSAntonio Huete JimenezIf the variable name contains a dollar, the name itself is expanded first. 65401e196c8SJohn MarinoThis allows almost arbitrary variable names, however names containing dollar, 655*6eef5f0cSAntonio Huete Jimenezbraces, parentheses or whitespace are really best avoided. 65601e196c8SJohn Marino.Pp 657*6eef5f0cSAntonio Huete JimenezIf the result of expanding a nested variable expression contains a dollar sign 658*6eef5f0cSAntonio Huete Jimenez.Pq Ql \&$ , 659*6eef5f0cSAntonio Huete Jimenezthe string is subject to further expansion. 66001e196c8SJohn Marino.Pp 661*6eef5f0cSAntonio Huete JimenezVariable substitution occurs at four distinct times, depending on where 66201e196c8SJohn Marinothe variable is being used. 66301e196c8SJohn Marino.Bl -enum 66401e196c8SJohn Marino.It 66501e196c8SJohn MarinoVariables in dependency lines are expanded as the line is read. 66601e196c8SJohn Marino.It 667*6eef5f0cSAntonio Huete JimenezVariables in conditionals are expanded individually, 668*6eef5f0cSAntonio Huete Jimenezbut only as far as necessary to determine the result of the conditional. 669*6eef5f0cSAntonio Huete Jimenez.It 67001e196c8SJohn MarinoVariables in shell commands are expanded when the shell command is 67101e196c8SJohn Marinoexecuted. 67201e196c8SJohn Marino.It 673*6eef5f0cSAntonio Huete Jimenez.Ic .for 67401e196c8SJohn Marinoloop index variables are expanded on each loop iteration. 675*6eef5f0cSAntonio Huete JimenezNote that other variables are not expanded when composing the body of a loop, 676*6eef5f0cSAntonio Huete Jimenezso the following example code: 67701e196c8SJohn Marino.Bd -literal -offset indent 678*6eef5f0cSAntonio Huete Jimenez\&.for i in 1 2 3 67901e196c8SJohn Marinoa+= ${i} 68001e196c8SJohn Marinoj= ${i} 68101e196c8SJohn Marinob+= ${j} 682*6eef5f0cSAntonio Huete Jimenez\&.endfor 68301e196c8SJohn Marino 68401e196c8SJohn Marinoall: 68501e196c8SJohn Marino @echo ${a} 68601e196c8SJohn Marino @echo ${b} 68701e196c8SJohn Marino.Ed 688*6eef5f0cSAntonio Huete Jimenez.Pp 689*6eef5f0cSAntonio Huete Jimenezprints: 69001e196c8SJohn Marino.Bd -literal -offset indent 69101e196c8SJohn Marino1 2 3 69201e196c8SJohn Marino3 3 3 69301e196c8SJohn Marino.Ed 694*6eef5f0cSAntonio Huete Jimenez.Pp 695*6eef5f0cSAntonio Huete JimenezBecause while 696*6eef5f0cSAntonio Huete Jimenez.Va a 69701e196c8SJohn Marinocontains 698*6eef5f0cSAntonio Huete Jimenez.Ql ${:U1} ${:U2} ${:U3} 699*6eef5f0cSAntonio Huete Jimenezafter the loop is executed, 700*6eef5f0cSAntonio Huete Jimenez.Va b 701*6eef5f0cSAntonio Huete Jimenezcontains 702*6eef5f0cSAntonio Huete Jimenez.Ql ${j} ${j} ${j} 70301e196c8SJohn Marinowhich expands to 704*6eef5f0cSAntonio Huete Jimenez.Ql 3 3 3 705*6eef5f0cSAntonio Huete Jimenezsince after the loop completes 706*6eef5f0cSAntonio Huete Jimenez.Va j 707*6eef5f0cSAntonio Huete Jimenezcontains 708*6eef5f0cSAntonio Huete Jimenez.Ql ${:U3} . 70901e196c8SJohn Marino.El 71001e196c8SJohn Marino.Ss Variable classes 71101e196c8SJohn MarinoThe four different classes of variables (in order of increasing precedence) 71201e196c8SJohn Marinoare: 71301e196c8SJohn Marino.Bl -tag -width Ds 71401e196c8SJohn Marino.It Environment variables 71501e196c8SJohn MarinoVariables defined as part of 71601e196c8SJohn Marino.Nm Ns 's 71701e196c8SJohn Marinoenvironment. 71801e196c8SJohn Marino.It Global variables 71901e196c8SJohn MarinoVariables defined in the makefile or in included makefiles. 72001e196c8SJohn Marino.It Command line variables 72101e196c8SJohn MarinoVariables defined as part of the command line. 72201e196c8SJohn Marino.It Local variables 72301e196c8SJohn MarinoVariables that are defined specific to a certain target. 7246a91b982SJohn Marino.El 7256a91b982SJohn Marino.Pp 726*6eef5f0cSAntonio Huete JimenezLocal variables can be set on a dependency line, unless 727*6eef5f0cSAntonio Huete Jimenez.Va .MAKE.TARGET_LOCAL_VARIABLES 728*6eef5f0cSAntonio Huete Jimenezis set to 729*6eef5f0cSAntonio Huete Jimenez.Ql false . 730*6eef5f0cSAntonio Huete JimenezThe rest of the line 731*6eef5f0cSAntonio Huete Jimenez(which already has had global variables expanded) 732*6eef5f0cSAntonio Huete Jimenezis the variable value. 733*6eef5f0cSAntonio Huete JimenezFor example: 734*6eef5f0cSAntonio Huete Jimenez.Bd -literal -offset indent 735*6eef5f0cSAntonio Huete JimenezCOMPILER_WRAPPERS= ccache distcc icecc 736*6eef5f0cSAntonio Huete Jimenez 737*6eef5f0cSAntonio Huete Jimenez${OBJS}: .MAKE.META.CMP_FILTER=${COMPILER_WRAPPERS:S,^,N,} 738*6eef5f0cSAntonio Huete Jimenez.Ed 739*6eef5f0cSAntonio Huete Jimenez.Pp 740*6eef5f0cSAntonio Huete JimenezOnly the targets 741*6eef5f0cSAntonio Huete Jimenez.Ql ${OBJS} 742*6eef5f0cSAntonio Huete Jimenezare impacted by that filter (in 743*6eef5f0cSAntonio Huete Jimenez.Dq meta 744*6eef5f0cSAntonio Huete Jimenezmode) and 745*6eef5f0cSAntonio Huete Jimenezsimply enabling/disabling any of the compiler wrappers does not render all 746*6eef5f0cSAntonio Huete Jimenezof those targets out-of-date. 747*6eef5f0cSAntonio Huete Jimenez.Pp 748*6eef5f0cSAntonio Huete Jimenez.Em NOTE : 749*6eef5f0cSAntonio Huete Jimeneztarget-local variable assignments behave differently in that; 750*6eef5f0cSAntonio Huete Jimenez.Bl -tag -width Ds -offset indent 751*6eef5f0cSAntonio Huete Jimenez.It Ic \&+= 752*6eef5f0cSAntonio Huete JimenezOnly appends to a previous local assignment 753*6eef5f0cSAntonio Huete Jimenezfor the same target and variable. 754*6eef5f0cSAntonio Huete Jimenez.It Ic \&:= 755*6eef5f0cSAntonio Huete JimenezIs redundant with respect to global variables, 756*6eef5f0cSAntonio Huete Jimenezwhich have already been expanded. 757*6eef5f0cSAntonio Huete Jimenez.El 758*6eef5f0cSAntonio Huete Jimenez.Pp 759*6eef5f0cSAntonio Huete JimenezThe seven built-in local variables are: 760*6eef5f0cSAntonio Huete Jimenez.Bl -tag -width ".Va .ARCHIVE" -offset indent 76101e196c8SJohn Marino.It Va .ALLSRC 76201e196c8SJohn MarinoThe list of all sources for this target; also known as 763*6eef5f0cSAntonio Huete Jimenez.Sq Va \&> . 76401e196c8SJohn Marino.It Va .ARCHIVE 7656a91b982SJohn MarinoThe name of the archive file; also known as 766*6eef5f0cSAntonio Huete Jimenez.Sq Va \&! . 76701e196c8SJohn Marino.It Va .IMPSRC 76801e196c8SJohn MarinoIn suffix-transformation rules, the name/path of the source from which the 76901e196c8SJohn Marinotarget is to be transformed (the 77001e196c8SJohn Marino.Dq implied 77101e196c8SJohn Marinosource); also known as 772*6eef5f0cSAntonio Huete Jimenez.Sq Va \&< . 77301e196c8SJohn MarinoIt is not defined in explicit rules. 77401e196c8SJohn Marino.It Va .MEMBER 7756a91b982SJohn MarinoThe name of the archive member; also known as 776*6eef5f0cSAntonio Huete Jimenez.Sq Va % . 77701e196c8SJohn Marino.It Va .OODATE 77801e196c8SJohn MarinoThe list of sources for this target that were deemed out-of-date; also 77901e196c8SJohn Marinoknown as 780*6eef5f0cSAntonio Huete Jimenez.Sq Va \&? . 78101e196c8SJohn Marino.It Va .PREFIX 78201e196c8SJohn MarinoThe file prefix of the target, containing only the file portion, no suffix 78301e196c8SJohn Marinoor preceding directory components; also known as 784*6eef5f0cSAntonio Huete Jimenez.Sq Va * . 7856a91b982SJohn MarinoThe suffix must be one of the known suffixes declared with 786*6eef5f0cSAntonio Huete Jimenez.Ic .SUFFIXES , 787*6eef5f0cSAntonio Huete Jimenezor it is not recognized. 78801e196c8SJohn Marino.It Va .TARGET 78901e196c8SJohn MarinoThe name of the target; also known as 790*6eef5f0cSAntonio Huete Jimenez.Sq Va @ . 791f445c897SJohn MarinoFor compatibility with other makes this is an alias for 792*6eef5f0cSAntonio Huete Jimenez.Va .ARCHIVE 793f445c897SJohn Marinoin archive member rules. 79401e196c8SJohn Marino.El 79501e196c8SJohn Marino.Pp 79601e196c8SJohn MarinoThe shorter forms 797*6eef5f0cSAntonio Huete Jimenez.Po 798*6eef5f0cSAntonio Huete Jimenez.Sq Va \&> , 799*6eef5f0cSAntonio Huete Jimenez.Sq Va \&! , 800*6eef5f0cSAntonio Huete Jimenez.Sq Va \&< , 801*6eef5f0cSAntonio Huete Jimenez.Sq Va \&% , 802*6eef5f0cSAntonio Huete Jimenez.Sq Va \&? , 803*6eef5f0cSAntonio Huete Jimenez.Sq Va \&* , 80401e196c8SJohn Marinoand 805*6eef5f0cSAntonio Huete Jimenez.Sq Va \&@ 806*6eef5f0cSAntonio Huete Jimenez.Pc 80701e196c8SJohn Marinoare permitted for backward 8086a91b982SJohn Marinocompatibility with historical makefiles and legacy POSIX make and are 8096a91b982SJohn Marinonot recommended. 8106a91b982SJohn Marino.Pp 8116a91b982SJohn MarinoVariants of these variables with the punctuation followed immediately by 8126a91b982SJohn Marino.Ql D 8136a91b982SJohn Marinoor 8146a91b982SJohn Marino.Ql F , 815*6eef5f0cSAntonio Huete Jimeneze.g.\& 816*6eef5f0cSAntonio Huete Jimenez.Ql $(@D) , 8176a91b982SJohn Marinoare legacy forms equivalent to using the 8186a91b982SJohn Marino.Ql :H 81901e196c8SJohn Marinoand 8206a91b982SJohn Marino.Ql :T 8216a91b982SJohn Marinomodifiers. 8226a91b982SJohn MarinoThese forms are accepted for compatibility with 82301e196c8SJohn Marino.At V 8246a91b982SJohn Marinomakefiles and POSIX but are not recommended. 82501e196c8SJohn Marino.Pp 82601e196c8SJohn MarinoFour of the local variables may be used in sources on dependency lines 82701e196c8SJohn Marinobecause they expand to the proper value for each target on the line. 82801e196c8SJohn MarinoThese variables are 829*6eef5f0cSAntonio Huete Jimenez.Sq Va .TARGET , 830*6eef5f0cSAntonio Huete Jimenez.Sq Va .PREFIX , 831*6eef5f0cSAntonio Huete Jimenez.Sq Va .ARCHIVE , 83201e196c8SJohn Marinoand 833*6eef5f0cSAntonio Huete Jimenez.Sq Va .MEMBER . 83401e196c8SJohn Marino.Ss Additional built-in variables 83501e196c8SJohn MarinoIn addition, 83601e196c8SJohn Marino.Nm 83701e196c8SJohn Marinosets or knows about the following variables: 83801e196c8SJohn Marino.Bl -tag -width .MAKEOVERRIDES 83901e196c8SJohn Marino.It Va .ALLTARGETS 840*6eef5f0cSAntonio Huete JimenezThe list of all targets encountered in the makefiles. 841*6eef5f0cSAntonio Huete JimenezIf evaluated during makefile parsing, 842*6eef5f0cSAntonio Huete Jimenezlists only those targets encountered thus far. 84301e196c8SJohn Marino.It Va .CURDIR 84401e196c8SJohn MarinoA path to the directory where 84501e196c8SJohn Marino.Nm 84601e196c8SJohn Marinowas executed. 84701e196c8SJohn MarinoRefer to the description of 848*6eef5f0cSAntonio Huete Jimenez.Sq Va PWD 84901e196c8SJohn Marinofor more details. 8506a91b982SJohn Marino.It Va .INCLUDEDFROMDIR 8516a91b982SJohn MarinoThe directory of the file this Makefile was included from. 8526a91b982SJohn Marino.It Va .INCLUDEDFROMFILE 8536a91b982SJohn MarinoThe filename of the file this Makefile was included from. 854*6eef5f0cSAntonio Huete Jimenez.It Va MAKE 85501e196c8SJohn MarinoThe name that 85601e196c8SJohn Marino.Nm 85701e196c8SJohn Marinowas executed with 85801e196c8SJohn Marino.Pq Va argv[0] . 859*6eef5f0cSAntonio Huete JimenezFor compatibility, 86001e196c8SJohn Marino.Nm 86101e196c8SJohn Marinoalso sets 86201e196c8SJohn Marino.Va .MAKE 86301e196c8SJohn Marinowith the same value. 86401e196c8SJohn MarinoThe preferred variable to use is the environment variable 86501e196c8SJohn Marino.Ev MAKE 866*6eef5f0cSAntonio Huete Jimenezbecause it is more compatible with other make variants 86701e196c8SJohn Marinoand cannot be confused with the special target with the same name. 86801e196c8SJohn Marino.It Va .MAKE.DEPENDFILE 86901e196c8SJohn MarinoNames the makefile (default 870*6eef5f0cSAntonio Huete Jimenez.Sq Pa .depend ) 87101e196c8SJohn Marinofrom which generated dependencies are read. 87201e196c8SJohn Marino.It Va .MAKE.EXPAND_VARIABLES 87301e196c8SJohn MarinoA boolean that controls the default behavior of the 87401e196c8SJohn Marino.Fl V 87501e196c8SJohn Marinooption. 876ca58f742SDaniel FojtIf true, variable values printed with 877ca58f742SDaniel Fojt.Fl V 878ca58f742SDaniel Fojtare fully expanded; if false, the raw variable contents (which may 879ca58f742SDaniel Fojtinclude additional unexpanded variable references) are shown. 88001e196c8SJohn Marino.It Va .MAKE.EXPORTED 88101e196c8SJohn MarinoThe list of variables exported by 88201e196c8SJohn Marino.Nm . 88301e196c8SJohn Marino.It Va .MAKE.JOBS 88401e196c8SJohn MarinoThe argument to the 88501e196c8SJohn Marino.Fl j 88601e196c8SJohn Marinooption. 88701e196c8SJohn Marino.It Va .MAKE.JOB.PREFIX 88801e196c8SJohn MarinoIf 88901e196c8SJohn Marino.Nm 89001e196c8SJohn Marinois run with 891*6eef5f0cSAntonio Huete Jimenez.Fl j , 892*6eef5f0cSAntonio Huete Jimenezthe output for each target is prefixed with a token 893*6eef5f0cSAntonio Huete Jimenez.Dl --- Ar target Li --- 89401e196c8SJohn Marinothe first part of which can be controlled via 89501e196c8SJohn Marino.Va .MAKE.JOB.PREFIX . 8965f1e34d9SAlexandre PerrinIf 8975f1e34d9SAlexandre Perrin.Va .MAKE.JOB.PREFIX 8985f1e34d9SAlexandre Perrinis empty, no token is printed. 899*6eef5f0cSAntonio Huete JimenezFor example, setting 900*6eef5f0cSAntonio Huete Jimenez.Va .MAKE.JOB.PREFIX 901*6eef5f0cSAntonio Huete Jimenezto 902*6eef5f0cSAntonio Huete Jimenez.Ql ${.newline}---${.MAKE:T}[${.MAKE.PID}] 90301e196c8SJohn Marinowould produce tokens like 904*6eef5f0cSAntonio Huete Jimenez.Dl ---make[1234] Ar target Li --- 90501e196c8SJohn Marinomaking it easier to track the degree of parallelism being achieved. 906*6eef5f0cSAntonio Huete Jimenez.It Va .MAKE.TARGET_LOCAL_VARIABLES 907*6eef5f0cSAntonio Huete JimenezIf set to 908*6eef5f0cSAntonio Huete Jimenez.Ql false , 909*6eef5f0cSAntonio Huete Jimenezapparent variable assignments in dependency lines are 910*6eef5f0cSAntonio Huete Jimeneztreated as normal sources. 911*6eef5f0cSAntonio Huete Jimenez.It Va MAKEFLAGS 91201e196c8SJohn MarinoThe environment variable 913*6eef5f0cSAntonio Huete Jimenez.Sq Ev MAKEFLAGS 91401e196c8SJohn Marinomay contain anything that 91501e196c8SJohn Marinomay be specified on 91601e196c8SJohn Marino.Nm Ns 's 91701e196c8SJohn Marinocommand line. 91801e196c8SJohn MarinoAnything specified on 91901e196c8SJohn Marino.Nm Ns 's 92001e196c8SJohn Marinocommand line is appended to the 921*6eef5f0cSAntonio Huete Jimenez.Va MAKEFLAGS 922*6eef5f0cSAntonio Huete Jimenezvariable, which is then added to the environment for all programs that 92301e196c8SJohn Marino.Nm 92401e196c8SJohn Marinoexecutes. 92501e196c8SJohn Marino.It Va .MAKE.LEVEL 92601e196c8SJohn MarinoThe recursion depth of 92701e196c8SJohn Marino.Nm . 928*6eef5f0cSAntonio Huete JimenezThe top-level instance of 92901e196c8SJohn Marino.Nm 930*6eef5f0cSAntonio Huete Jimenezhas level 0, and each child make has its parent level plus 1. 93101e196c8SJohn MarinoThis allows tests like: 93201e196c8SJohn Marino.Li .if ${.MAKE.LEVEL} == 0 933*6eef5f0cSAntonio Huete Jimenezto protect things which should only be evaluated in the top-level instance of 93401e196c8SJohn Marino.Nm . 93501e196c8SJohn Marino.It Va .MAKE.MAKEFILE_PREFERENCE 93601e196c8SJohn MarinoThe ordered list of makefile names 93701e196c8SJohn Marino(default 938*6eef5f0cSAntonio Huete Jimenez.Sq Pa makefile , 939*6eef5f0cSAntonio Huete Jimenez.Sq Pa Makefile ) 94001e196c8SJohn Marinothat 94101e196c8SJohn Marino.Nm 942*6eef5f0cSAntonio Huete Jimenezlooks for. 94301e196c8SJohn Marino.It Va .MAKE.MAKEFILES 94401e196c8SJohn MarinoThe list of makefiles read by 94501e196c8SJohn Marino.Nm , 94601e196c8SJohn Marinowhich is useful for tracking dependencies. 94701e196c8SJohn MarinoEach makefile is recorded only once, regardless of the number of times read. 94801e196c8SJohn Marino.It Va .MAKE.MODE 94901e196c8SJohn MarinoProcessed after reading all makefiles. 950*6eef5f0cSAntonio Huete JimenezAffects the mode that 95101e196c8SJohn Marino.Nm 95201e196c8SJohn Marinoruns in. 95301e196c8SJohn MarinoIt can contain a number of keywords: 954f445c897SJohn Marino.Bl -hang -width missing-filemon=bf. 955*6eef5f0cSAntonio Huete Jimenez.It Cm compat 95601e196c8SJohn MarinoLike 95701e196c8SJohn Marino.Fl B , 95801e196c8SJohn Marinoputs 95901e196c8SJohn Marino.Nm 960*6eef5f0cSAntonio Huete Jimenezinto 961*6eef5f0cSAntonio Huete Jimenez.Dq compat 962*6eef5f0cSAntonio Huete Jimenezmode. 963*6eef5f0cSAntonio Huete Jimenez.It Cm meta 96401e196c8SJohn MarinoPuts 96501e196c8SJohn Marino.Nm 966*6eef5f0cSAntonio Huete Jimenezinto 967*6eef5f0cSAntonio Huete Jimenez.Dq meta 968*6eef5f0cSAntonio Huete Jimenezmode, where meta files are created for each target 969*6eef5f0cSAntonio Huete Jimenezto capture the command run, the output generated, and if 97001e196c8SJohn Marino.Xr filemon 4 97101e196c8SJohn Marinois available, the system calls which are of interest to 97201e196c8SJohn Marino.Nm . 973*6eef5f0cSAntonio Huete JimenezThe captured output can be useful when diagnosing errors. 974*6eef5f0cSAntonio Huete Jimenez.It Cm curdirOk= Ns Ar bf 975*6eef5f0cSAntonio Huete JimenezBy default, 97601e196c8SJohn Marino.Nm 977*6eef5f0cSAntonio Huete Jimenezdoes not create 978*6eef5f0cSAntonio Huete Jimenez.Pa .meta 979*6eef5f0cSAntonio Huete Jimenezfiles in 980*6eef5f0cSAntonio Huete Jimenez.Sq Va .CURDIR . 98101e196c8SJohn MarinoThis can be overridden by setting 98201e196c8SJohn Marino.Va bf 983*6eef5f0cSAntonio Huete Jimenezto a value which represents true. 984*6eef5f0cSAntonio Huete Jimenez.It Cm missing-meta= Ns Ar bf 985f445c897SJohn MarinoIf 986f445c897SJohn Marino.Va bf 987*6eef5f0cSAntonio Huete Jimenezis true, a missing 988*6eef5f0cSAntonio Huete Jimenez.Pa .meta 989*6eef5f0cSAntonio Huete Jimenezfile makes the target out-of-date. 990*6eef5f0cSAntonio Huete Jimenez.It Cm missing-filemon= Ns Ar bf 991f445c897SJohn MarinoIf 992f445c897SJohn Marino.Va bf 993*6eef5f0cSAntonio Huete Jimenezis true, missing filemon data makes the target out-of-date. 994*6eef5f0cSAntonio Huete Jimenez.It Cm nofilemon 995f445c897SJohn MarinoDo not use 996f445c897SJohn Marino.Xr filemon 4 . 997*6eef5f0cSAntonio Huete Jimenez.It Cm env 998f445c897SJohn MarinoFor debugging, it can be useful to include the environment 999*6eef5f0cSAntonio Huete Jimenezin the 1000*6eef5f0cSAntonio Huete Jimenez.Pa .meta 1001*6eef5f0cSAntonio Huete Jimenezfile. 1002*6eef5f0cSAntonio Huete Jimenez.It Cm verbose 1003*6eef5f0cSAntonio Huete JimenezIf in 1004*6eef5f0cSAntonio Huete Jimenez.Dq meta 1005*6eef5f0cSAntonio Huete Jimenezmode, print a clue about the target being built. 100601e196c8SJohn MarinoThis is useful if the build is otherwise running silently. 1007*6eef5f0cSAntonio Huete JimenezThe message printed is the expanded value of 100801e196c8SJohn Marino.Va .MAKE.META.PREFIX . 1009*6eef5f0cSAntonio Huete Jimenez.It Cm ignore-cmd 101001e196c8SJohn MarinoSome makefiles have commands which are simply not stable. 101101e196c8SJohn MarinoThis keyword causes them to be ignored for 1012*6eef5f0cSAntonio Huete Jimenezdetermining whether a target is out of date in 1013*6eef5f0cSAntonio Huete Jimenez.Dq meta 1014*6eef5f0cSAntonio Huete Jimenezmode. 101501e196c8SJohn MarinoSee also 101601e196c8SJohn Marino.Ic .NOMETA_CMP . 1017*6eef5f0cSAntonio Huete Jimenez.It Cm silent= Ns Ar bf 101801e196c8SJohn MarinoIf 101901e196c8SJohn Marino.Va bf 1020*6eef5f0cSAntonio Huete Jimenezis true, when a .meta file is created, mark the target 102101e196c8SJohn Marino.Ic .SILENT . 1022*6eef5f0cSAntonio Huete Jimenez.It Cm randomize-targets 1023*6eef5f0cSAntonio Huete JimenezIn both compat and parallel mode, do not make the targets in the usual order, 1024*6eef5f0cSAntonio Huete Jimenezbut instead randomize their order. 1025*6eef5f0cSAntonio Huete JimenezThis mode can be used to detect undeclared dependencies between files. 102601e196c8SJohn Marino.El 102701e196c8SJohn Marino.It Va .MAKE.META.BAILIWICK 1028*6eef5f0cSAntonio Huete JimenezIn 1029*6eef5f0cSAntonio Huete Jimenez.Dq meta 1030*6eef5f0cSAntonio Huete Jimenezmode, provides a list of prefixes which 103101e196c8SJohn Marinomatch the directories controlled by 103201e196c8SJohn Marino.Nm . 103301e196c8SJohn MarinoIf a file that was generated outside of 103401e196c8SJohn Marino.Va .OBJDIR 103501e196c8SJohn Marinobut within said bailiwick is missing, 103601e196c8SJohn Marinothe current target is considered out-of-date. 1037*6eef5f0cSAntonio Huete Jimenez.It Va .MAKE.META.CMP_FILTER 1038*6eef5f0cSAntonio Huete JimenezIn 1039*6eef5f0cSAntonio Huete Jimenez.Dq meta 1040*6eef5f0cSAntonio Huete Jimenezmode, it can (very rarely!) be useful to filter command 1041*6eef5f0cSAntonio Huete Jimenezlines before comparison. 1042*6eef5f0cSAntonio Huete JimenezThis variable can be set to a set of modifiers that are applied to 1043*6eef5f0cSAntonio Huete Jimenezeach line of the old and new command that differ, if the filtered 1044*6eef5f0cSAntonio Huete Jimenezcommands still differ, the target is considered out-of-date. 104501e196c8SJohn Marino.It Va .MAKE.META.CREATED 1046*6eef5f0cSAntonio Huete JimenezIn 1047*6eef5f0cSAntonio Huete Jimenez.Dq meta 1048*6eef5f0cSAntonio Huete Jimenezmode, this variable contains a list of all the meta files 104901e196c8SJohn Marinoupdated. 105001e196c8SJohn MarinoIf not empty, it can be used to trigger processing of 105101e196c8SJohn Marino.Va .MAKE.META.FILES . 105201e196c8SJohn Marino.It Va .MAKE.META.FILES 1053*6eef5f0cSAntonio Huete JimenezIn 1054*6eef5f0cSAntonio Huete Jimenez.Dq meta 1055*6eef5f0cSAntonio Huete Jimenezmode, this variable contains a list of all the meta files 105601e196c8SJohn Marinoused (updated or not). 105701e196c8SJohn MarinoThis list can be used to process the meta files to extract dependency 105801e196c8SJohn Marinoinformation. 10595f1e34d9SAlexandre Perrin.It Va .MAKE.META.IGNORE_PATHS 10605f1e34d9SAlexandre PerrinProvides a list of path prefixes that should be ignored; 10615f1e34d9SAlexandre Perrinbecause the contents are expected to change over time. 10625f1e34d9SAlexandre PerrinThe default list includes: 1063*6eef5f0cSAntonio Huete Jimenez.Sq Pa /dev /etc /proc /tmp /var/run /var/tmp 1064f445c897SJohn Marino.It Va .MAKE.META.IGNORE_PATTERNS 1065f445c897SJohn MarinoProvides a list of patterns to match against pathnames. 1066f445c897SJohn MarinoIgnore any that match. 1067f445c897SJohn Marino.It Va .MAKE.META.IGNORE_FILTER 1068f445c897SJohn MarinoProvides a list of variable modifiers to apply to each pathname. 1069f445c897SJohn MarinoIgnore if the expansion is an empty string. 107001e196c8SJohn Marino.It Va .MAKE.META.PREFIX 1071*6eef5f0cSAntonio Huete JimenezDefines the message printed for each meta file updated in 1072*6eef5f0cSAntonio Huete Jimenez.Dq meta verbose 1073*6eef5f0cSAntonio Huete Jimenezmode. 107401e196c8SJohn MarinoThe default value is: 107501e196c8SJohn Marino.Dl Building ${.TARGET:H:tA}/${.TARGET:T} 107601e196c8SJohn Marino.It Va .MAKEOVERRIDES 107701e196c8SJohn MarinoThis variable is used to record the names of variables assigned to 107801e196c8SJohn Marinoon the command line, so that they may be exported as part of 1079*6eef5f0cSAntonio Huete Jimenez.Sq Ev MAKEFLAGS . 1080f445c897SJohn MarinoThis behavior can be disabled by assigning an empty value to 1081*6eef5f0cSAntonio Huete Jimenez.Sq Va .MAKEOVERRIDES 108201e196c8SJohn Marinowithin a makefile. 108301e196c8SJohn MarinoExtra variables can be exported from a makefile 108401e196c8SJohn Marinoby appending their names to 1085*6eef5f0cSAntonio Huete Jimenez.Sq Va .MAKEOVERRIDES . 1086*6eef5f0cSAntonio Huete Jimenez.Sq Ev MAKEFLAGS 108701e196c8SJohn Marinois re-exported whenever 1088*6eef5f0cSAntonio Huete Jimenez.Sq Va .MAKEOVERRIDES 108901e196c8SJohn Marinois modified. 10905f1e34d9SAlexandre Perrin.It Va .MAKE.PATH_FILEMON 10915f1e34d9SAlexandre PerrinIf 10925f1e34d9SAlexandre Perrin.Nm 10935f1e34d9SAlexandre Perrinwas built with 10945f1e34d9SAlexandre Perrin.Xr filemon 4 10955f1e34d9SAlexandre Perrinsupport, this is set to the path of the device node. 10965f1e34d9SAlexandre PerrinThis allows makefiles to test for this support. 109701e196c8SJohn Marino.It Va .MAKE.PID 1098*6eef5f0cSAntonio Huete JimenezThe process ID of 109901e196c8SJohn Marino.Nm . 110001e196c8SJohn Marino.It Va .MAKE.PPID 1101*6eef5f0cSAntonio Huete JimenezThe parent process ID of 110201e196c8SJohn Marino.Nm . 1103c9ed6119SAntonio Huete Jimenez.It Va .MAKE.BUILT.BY 1104c9ed6119SAntonio Huete JimenezThe compiler CCVER that built the 1105c9ed6119SAntonio Huete Jimenez.Dx 1106c9ed6119SAntonio Huete Jimenezworld. 1107c9ed6119SAntonio Huete Jimenez.It Va .MAKE.DF.OSREL 1108c9ed6119SAntonio Huete JimenezThe 1109c9ed6119SAntonio Huete Jimenez.Dx 1110c9ed6119SAntonio Huete Jimenezversion when the world was built. It is in the "<major>.<minor>" 1111c9ed6119SAntonio Huete Jimenezformat and it used by DPorts. 1112c9ed6119SAntonio Huete Jimenez.It Va .MAKE.DF.VERSION 1113c9ed6119SAntonio Huete JimenezThe value of __DragonFly_version when the 1114c9ed6119SAntonio Huete Jimenez.Dx 1115c9ed6119SAntonio Huete Jimenezworld was built. It is used by DPorts. 1116f445c897SJohn Marino.It Va .MAKE.SAVE_DOLLARS 1117*6eef5f0cSAntonio Huete JimenezIf true, 1118f445c897SJohn Marino.Ql $$ 1119f445c897SJohn Marinoare preserved when doing 1120f445c897SJohn Marino.Ql := 1121f445c897SJohn Marinoassignments. 1122f445c897SJohn MarinoThe default is false, for backwards compatibility. 1123c9ed6119SAntonio Huete JimenezSet to true for compatibility with other makes. 1124f445c897SJohn MarinoIf set to false, 1125f445c897SJohn Marino.Ql $$ 1126f445c897SJohn Marinobecomes 1127f445c897SJohn Marino.Ql $ 1128f445c897SJohn Marinoper normal evaluation rules. 1129a34d5fb1SAntonio Huete Jimenez.It Va .MAKE.UID 1130*6eef5f0cSAntonio Huete JimenezThe numeric ID of the user running 1131a34d5fb1SAntonio Huete Jimenez.Nm . 1132a34d5fb1SAntonio Huete Jimenez.It Va .MAKE.GID 1133*6eef5f0cSAntonio Huete JimenezThe numeric group ID of the user running 1134a34d5fb1SAntonio Huete Jimenez.Nm . 113501e196c8SJohn Marino.It Va MAKE_PRINT_VAR_ON_ERROR 113601e196c8SJohn MarinoWhen 113701e196c8SJohn Marino.Nm 1138f445c897SJohn Marinostops due to an error, it sets 1139*6eef5f0cSAntonio Huete Jimenez.Sq Va .ERROR_TARGET 1140f445c897SJohn Marinoto the name of the target that failed, 1141*6eef5f0cSAntonio Huete Jimenez.Sq Va .ERROR_CMD 1142f445c897SJohn Marinoto the commands of the failed target, 1143*6eef5f0cSAntonio Huete Jimenezand in 1144*6eef5f0cSAntonio Huete Jimenez.Dq meta 1145*6eef5f0cSAntonio Huete Jimenezmode, it also sets 1146*6eef5f0cSAntonio Huete Jimenez.Sq Va .ERROR_CWD 1147f445c897SJohn Marinoto the 1148f445c897SJohn Marino.Xr getcwd 3 , 1149f445c897SJohn Marinoand 1150*6eef5f0cSAntonio Huete Jimenez.Sq Va .ERROR_META_FILE 1151f445c897SJohn Marinoto the path of the meta file (if any) describing the failed target. 1152f445c897SJohn MarinoIt then prints its name and the value of 1153*6eef5f0cSAntonio Huete Jimenez.Sq Va .CURDIR 115401e196c8SJohn Marinoas well as the value of any variables named in 1155*6eef5f0cSAntonio Huete Jimenez.Sq Va MAKE_PRINT_VAR_ON_ERROR . 115601e196c8SJohn Marino.It Va .newline 115701e196c8SJohn MarinoThis variable is simply assigned a newline character as its value. 115801e196c8SJohn MarinoThis allows expansions using the 115901e196c8SJohn Marino.Cm \&:@ 116001e196c8SJohn Marinomodifier to put a newline between 116101e196c8SJohn Marinoiterations of the loop rather than a space. 1162*6eef5f0cSAntonio Huete JimenezFor example, in case of an error, 1163*6eef5f0cSAntonio Huete Jimenez.Nm 1164*6eef5f0cSAntonio Huete Jimenezprints the variable names and their values using: 1165*6eef5f0cSAntonio Huete Jimenez.Dl ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@} 116601e196c8SJohn Marino.It Va .OBJDIR 116701e196c8SJohn MarinoA path to the directory where the targets are built. 116801e196c8SJohn MarinoIts value is determined by trying to 116901e196c8SJohn Marino.Xr chdir 2 117001e196c8SJohn Marinoto the following directories in order and using the first match: 117101e196c8SJohn Marino.Bl -enum 117201e196c8SJohn Marino.It 1173*6eef5f0cSAntonio Huete Jimenez.Cm ${MAKEOBJDIRPREFIX} Ns Cm ${.CURDIR} 117401e196c8SJohn Marino.Pp 117501e196c8SJohn Marino(Only if 1176*6eef5f0cSAntonio Huete Jimenez.Sq Ev MAKEOBJDIRPREFIX 117701e196c8SJohn Marinois set in the environment or on the command line.) 117801e196c8SJohn Marino.It 1179*6eef5f0cSAntonio Huete Jimenez.Cm ${MAKEOBJDIR} 118001e196c8SJohn Marino.Pp 118101e196c8SJohn Marino(Only if 1182*6eef5f0cSAntonio Huete Jimenez.Sq Ev MAKEOBJDIR 118301e196c8SJohn Marinois set in the environment or on the command line.) 118401e196c8SJohn Marino.It 1185*6eef5f0cSAntonio Huete Jimenez.Cm ${.CURDIR} Ns Pa /obj. Ns Cm ${MACHINE} 118601e196c8SJohn Marino.It 1187*6eef5f0cSAntonio Huete Jimenez.Cm ${.CURDIR} Ns Pa /obj 118801e196c8SJohn Marino.It 1189*6eef5f0cSAntonio Huete Jimenez.Pa /usr/obj/ Ns Cm ${.CURDIR} 119001e196c8SJohn Marino.It 1191*6eef5f0cSAntonio Huete Jimenez.Cm ${.CURDIR} 119201e196c8SJohn Marino.El 119301e196c8SJohn Marino.Pp 1194*6eef5f0cSAntonio Huete JimenezVariable expansion is performed on the value before it is used, 119501e196c8SJohn Marinoso expressions such as 1196*6eef5f0cSAntonio Huete Jimenez.Cm ${.CURDIR:S,^/usr/src,/var/obj,} 119701e196c8SJohn Marinomay be used. 119801e196c8SJohn MarinoThis is especially useful with 1199*6eef5f0cSAntonio Huete Jimenez.Sq Ev MAKEOBJDIR . 120001e196c8SJohn Marino.Pp 1201*6eef5f0cSAntonio Huete Jimenez.Sq Va .OBJDIR 1202f445c897SJohn Marinomay be modified in the makefile via the special target 1203*6eef5f0cSAntonio Huete Jimenez.Sq Ic .OBJDIR . 120401e196c8SJohn MarinoIn all cases, 120501e196c8SJohn Marino.Nm 1206*6eef5f0cSAntonio Huete Jimenezchanges to the specified directory if it exists, and sets 1207*6eef5f0cSAntonio Huete Jimenez.Sq Va .OBJDIR 1208f445c897SJohn Marinoand 1209*6eef5f0cSAntonio Huete Jimenez.Sq Va PWD 121001e196c8SJohn Marinoto that directory before executing any targets. 1211a34d5fb1SAntonio Huete Jimenez.Pp 1212a34d5fb1SAntonio Huete JimenezExcept in the case of an explicit 1213*6eef5f0cSAntonio Huete Jimenez.Sq Ic .OBJDIR 1214a34d5fb1SAntonio Huete Jimeneztarget, 1215a34d5fb1SAntonio Huete Jimenez.Nm 1216*6eef5f0cSAntonio Huete Jimenezchecks that the specified directory is writable and ignores it if not. 1217a34d5fb1SAntonio Huete JimenezThis check can be skipped by setting the environment variable 1218*6eef5f0cSAntonio Huete Jimenez.Sq Ev MAKE_OBJDIR_CHECK_WRITABLE 1219a34d5fb1SAntonio Huete Jimenezto "no". 122001e196c8SJohn Marino.It Va .PARSEDIR 1221*6eef5f0cSAntonio Huete JimenezThe directory name of the current makefile being parsed. 122201e196c8SJohn Marino.It Va .PARSEFILE 1223*6eef5f0cSAntonio Huete JimenezThe basename of the current makefile being parsed. 122401e196c8SJohn MarinoThis variable and 1225*6eef5f0cSAntonio Huete Jimenez.Sq Va .PARSEDIR 1226*6eef5f0cSAntonio Huete Jimenezare both set only while the makefiles are being parsed. 1227*6eef5f0cSAntonio Huete JimenezTo retain their current values, 1228*6eef5f0cSAntonio Huete Jimenezassign them to a variable using assignment with expansion 1229*6eef5f0cSAntonio Huete Jimenez.Sq Cm \&:= . 123001e196c8SJohn Marino.It Va .PATH 1231*6eef5f0cSAntonio Huete JimenezThe space-separated list of directories that 123201e196c8SJohn Marino.Nm 1233*6eef5f0cSAntonio Huete Jimenezsearches for files. 1234*6eef5f0cSAntonio Huete JimenezTo update this search list, use the special target 1235*6eef5f0cSAntonio Huete Jimenez.Sq Ic .PATH 1236*6eef5f0cSAntonio Huete Jimenezrather than modifying the variable directly. 1237*6eef5f0cSAntonio Huete Jimenez.It Va PWD 123801e196c8SJohn MarinoAlternate path to the current directory. 123901e196c8SJohn Marino.Nm 124001e196c8SJohn Marinonormally sets 1241*6eef5f0cSAntonio Huete Jimenez.Sq Va .CURDIR 124201e196c8SJohn Marinoto the canonical path given by 124301e196c8SJohn Marino.Xr getcwd 3 . 124401e196c8SJohn MarinoHowever, if the environment variable 1245*6eef5f0cSAntonio Huete Jimenez.Sq Ev PWD 1246*6eef5f0cSAntonio Huete Jimenezis set and gives a path to the current directory, 124701e196c8SJohn Marino.Nm 124801e196c8SJohn Marinosets 1249*6eef5f0cSAntonio Huete Jimenez.Sq Va .CURDIR 125001e196c8SJohn Marinoto the value of 1251*6eef5f0cSAntonio Huete Jimenez.Sq Ev PWD 125201e196c8SJohn Marinoinstead. 1253f445c897SJohn MarinoThis behavior is disabled if 1254*6eef5f0cSAntonio Huete Jimenez.Sq Ev MAKEOBJDIRPREFIX 125501e196c8SJohn Marinois set or 1256*6eef5f0cSAntonio Huete Jimenez.Sq Ev MAKEOBJDIR 125701e196c8SJohn Marinocontains a variable transform. 1258*6eef5f0cSAntonio Huete Jimenez.Sq Va PWD 125901e196c8SJohn Marinois set to the value of 1260*6eef5f0cSAntonio Huete Jimenez.Sq Va .OBJDIR 126101e196c8SJohn Marinofor all programs which 126201e196c8SJohn Marino.Nm 126301e196c8SJohn Marinoexecutes. 1264*6eef5f0cSAntonio Huete Jimenez.It Va .SHELL 1265a34d5fb1SAntonio Huete JimenezThe pathname of the shell used to run target scripts. 1266a34d5fb1SAntonio Huete JimenezIt is read-only. 1267*6eef5f0cSAntonio Huete Jimenez.It Va .SUFFIXES 1268*6eef5f0cSAntonio Huete JimenezThe list of known suffixes. 1269*6eef5f0cSAntonio Huete JimenezIt is read-only. 1270*6eef5f0cSAntonio Huete Jimenez.It Va .TARGETS 127101e196c8SJohn MarinoThe list of targets explicitly specified on the command line, if any. 1272*6eef5f0cSAntonio Huete Jimenez.It Va VPATH 1273*6eef5f0cSAntonio Huete JimenezThe colon-separated 127401e196c8SJohn Marino.Pq Dq \&: 1275*6eef5f0cSAntonio Huete Jimenezlist of directories that 127601e196c8SJohn Marino.Nm 1277*6eef5f0cSAntonio Huete Jimenezsearches for files. 1278*6eef5f0cSAntonio Huete JimenezThis variable is supported for compatibility with old make programs only, use 1279*6eef5f0cSAntonio Huete Jimenez.Sq Va .PATH 128001e196c8SJohn Marinoinstead. 128101e196c8SJohn Marino.El 128201e196c8SJohn Marino.Ss Variable modifiers 1283*6eef5f0cSAntonio Huete JimenezThe general format of a variable expansion is: 128401e196c8SJohn Marino.Pp 1285*6eef5f0cSAntonio Huete Jimenez.Sm off 1286*6eef5f0cSAntonio Huete Jimenez.D1 Ic \&${ Ar variable\| Oo Ic \&: Ar modifier\| Oo Ic \&: No ... Oc Oc Ic \&} 1287*6eef5f0cSAntonio Huete Jimenez.Sm on 128801e196c8SJohn Marino.Pp 1289*6eef5f0cSAntonio Huete JimenezEach modifier begins with a colon. 1290*6eef5f0cSAntonio Huete JimenezTo escape a colon, precede it with a backslash 1291*6eef5f0cSAntonio Huete Jimenez.Ql \e . 129201e196c8SJohn Marino.Pp 1293*6eef5f0cSAntonio Huete JimenezA list of indirect modifiers can be specified via a variable, as follows: 129401e196c8SJohn Marino.Pp 1295*6eef5f0cSAntonio Huete Jimenez.Bd -literal -offset indent 1296*6eef5f0cSAntonio Huete Jimenez.Ar modifier_variable\^ Li \&= Ar modifier Ns Oo Ic \&: Ns No ... Oc 1297*6eef5f0cSAntonio Huete Jimenez 1298*6eef5f0cSAntonio Huete Jimenez.Sm off 1299*6eef5f0cSAntonio Huete Jimenez.Ic \&${ Ar variable Ic \&:${ Ar modifier_variable Ic \&} Oo Ic \&: No ... Oc Ic \&} 1300*6eef5f0cSAntonio Huete Jimenez.Sm on 1301*6eef5f0cSAntonio Huete Jimenez.Ed 130201e196c8SJohn Marino.Pp 1303*6eef5f0cSAntonio Huete JimenezIn this case, the first modifier in the 1304*6eef5f0cSAntonio Huete Jimenez.Ar modifier_variable 1305*6eef5f0cSAntonio Huete Jimenezdoes not start with a colon, 1306*6eef5f0cSAntonio Huete Jimenezsince that colon already occurs in the referencing variable. 1307*6eef5f0cSAntonio Huete JimenezIf any of the modifiers in the 1308*6eef5f0cSAntonio Huete Jimenez.Ar modifier_variable 1309*6eef5f0cSAntonio Huete Jimenezcontains a dollar sign 131001e196c8SJohn Marino.Pq Ql $ , 131101e196c8SJohn Marinothese must be doubled to avoid early expansion. 131201e196c8SJohn Marino.Pp 1313*6eef5f0cSAntonio Huete JimenezSome modifiers interpret the expression value as a single string, 1314*6eef5f0cSAntonio Huete Jimenezothers treat the expression value as a whitespace-separated list of words. 1315*6eef5f0cSAntonio Huete JimenezWhen splitting a string into words, 1316*6eef5f0cSAntonio Huete Jimenezwhitespace can be escaped using double quotes, single quotes and backslashes, 1317*6eef5f0cSAntonio Huete Jimenezlike in the shell. 1318*6eef5f0cSAntonio Huete JimenezThe quotes and backslashes are retained in the words. 1319*6eef5f0cSAntonio Huete Jimenez.Pp 132001e196c8SJohn MarinoThe supported modifiers are: 132101e196c8SJohn Marino.Bl -tag -width EEE 132201e196c8SJohn Marino.It Cm \&:E 132301e196c8SJohn MarinoReplaces each word in the variable with its suffix. 132401e196c8SJohn Marino.It Cm \&:H 1325*6eef5f0cSAntonio Huete JimenezReplaces each word in the variable with its dirname. 1326*6eef5f0cSAntonio Huete Jimenez.It Cm \&:M\| Ns Ar pattern 1327a34d5fb1SAntonio Huete JimenezSelects only those words that match 132801e196c8SJohn Marino.Ar pattern . 132901e196c8SJohn MarinoThe standard shell wildcard characters 133001e196c8SJohn Marino.Pf ( Ql * , 133101e196c8SJohn Marino.Ql \&? , 133201e196c8SJohn Marinoand 1333*6eef5f0cSAntonio Huete Jimenez.Ql \&[] ) 133401e196c8SJohn Marinomay 133501e196c8SJohn Marinobe used. 133601e196c8SJohn MarinoThe wildcard characters may be escaped with a backslash 133701e196c8SJohn Marino.Pq Ql \e . 13386a91b982SJohn MarinoAs a consequence of the way values are split into words, matched, 1339*6eef5f0cSAntonio Huete Jimenezand then joined, the construct 13406a91b982SJohn Marino.Dl ${VAR:M*} 1341*6eef5f0cSAntonio Huete Jimenezremoves all leading and trailing whitespace 1342*6eef5f0cSAntonio Huete Jimenezand normalizes the inter-word spacing to a single space. 1343*6eef5f0cSAntonio Huete Jimenez.It Cm \&:N\| Ns Ar pattern 1344*6eef5f0cSAntonio Huete JimenezThis is the opposite of 1345*6eef5f0cSAntonio Huete Jimenez.Sq Cm \&:M , 1346*6eef5f0cSAntonio Huete Jimenezselecting all words which do 1347*6eef5f0cSAntonio Huete Jimenez.Em not 1348*6eef5f0cSAntonio Huete Jimenezmatch 134901e196c8SJohn Marino.Ar pattern . 135001e196c8SJohn Marino.It Cm \&:O 1351*6eef5f0cSAntonio Huete JimenezOrders the words alphabetically. 1352*6eef5f0cSAntonio Huete Jimenez.It Cm \&:On 1353*6eef5f0cSAntonio Huete JimenezOrders the words numerically. 1354*6eef5f0cSAntonio Huete JimenezA number followed by one of 1355*6eef5f0cSAntonio Huete Jimenez.Ql k , 1356*6eef5f0cSAntonio Huete Jimenez.Ql M 1357*6eef5f0cSAntonio Huete Jimenezor 1358*6eef5f0cSAntonio Huete Jimenez.Ql G 1359*6eef5f0cSAntonio Huete Jimenezis multiplied by the appropriate factor, which is 1024 for 1360*6eef5f0cSAntonio Huete Jimenez.Ql k , 1361*6eef5f0cSAntonio Huete Jimenez1048576 for 1362*6eef5f0cSAntonio Huete Jimenez.Ql M , 1363*6eef5f0cSAntonio Huete Jimenezor 1073741824 for 1364*6eef5f0cSAntonio Huete Jimenez.Ql G . 1365*6eef5f0cSAntonio Huete JimenezBoth upper- and lower-case letters are accepted. 1366ca58f742SDaniel Fojt.It Cm \&:Or 1367*6eef5f0cSAntonio Huete JimenezOrders the words in reverse alphabetical order. 1368*6eef5f0cSAntonio Huete Jimenez.It Cm \&:Orn 1369*6eef5f0cSAntonio Huete JimenezOrders the words in reverse numerical order. 137001e196c8SJohn Marino.It Cm \&:Ox 1371*6eef5f0cSAntonio Huete JimenezShuffles the words. 1372*6eef5f0cSAntonio Huete JimenezThe results are different each time you are referring to the 137301e196c8SJohn Marinomodified variable; use the assignment with expansion 1374*6eef5f0cSAntonio Huete Jimenez.Sq Cm \&:= 1375f445c897SJohn Marinoto prevent such behavior. 137601e196c8SJohn MarinoFor example, 137701e196c8SJohn Marino.Bd -literal -offset indent 137801e196c8SJohn MarinoLIST= uno due tre quattro 137901e196c8SJohn MarinoRANDOM_LIST= ${LIST:Ox} 138001e196c8SJohn MarinoSTATIC_RANDOM_LIST:= ${LIST:Ox} 138101e196c8SJohn Marino 138201e196c8SJohn Marinoall: 138301e196c8SJohn Marino @echo "${RANDOM_LIST}" 138401e196c8SJohn Marino @echo "${RANDOM_LIST}" 138501e196c8SJohn Marino @echo "${STATIC_RANDOM_LIST}" 138601e196c8SJohn Marino @echo "${STATIC_RANDOM_LIST}" 138701e196c8SJohn Marino.Ed 138801e196c8SJohn Marinomay produce output similar to: 138901e196c8SJohn Marino.Bd -literal -offset indent 139001e196c8SJohn Marinoquattro due tre uno 139101e196c8SJohn Marinotre due quattro uno 139201e196c8SJohn Marinodue uno quattro tre 139301e196c8SJohn Marinodue uno quattro tre 139401e196c8SJohn Marino.Ed 139501e196c8SJohn Marino.It Cm \&:Q 1396*6eef5f0cSAntonio Huete JimenezQuotes every shell meta-character in the value, so that it can be passed 1397ca58f742SDaniel Fojtsafely to the shell. 1398ca58f742SDaniel Fojt.It Cm \&:q 1399*6eef5f0cSAntonio Huete JimenezQuotes every shell meta-character in the value, and also doubles 1400ca58f742SDaniel Fojt.Sq $ 1401ca58f742SDaniel Fojtcharacters so that it can be passed 140201e196c8SJohn Marinosafely through recursive invocations of 140301e196c8SJohn Marino.Nm . 1404*6eef5f0cSAntonio Huete JimenezThis is equivalent to 1405*6eef5f0cSAntonio Huete Jimenez.Sq Cm \&:S/\e\&$/&&/g:Q . 140601e196c8SJohn Marino.It Cm \&:R 140701e196c8SJohn MarinoReplaces each word in the variable with everything but its suffix. 1408*6eef5f0cSAntonio Huete Jimenez.It Cm \&:range Ns Oo Cm = Ns Ar count Oc 1409ca58f742SDaniel FojtThe value is an integer sequence representing the words of the original 1410ca58f742SDaniel Fojtvalue, or the supplied 1411*6eef5f0cSAntonio Huete Jimenez.Ar count . 1412*6eef5f0cSAntonio Huete Jimenez.It Cm \&:gmtime Ns Oo Cm = Ns Ar timestamp Oc 1413*6eef5f0cSAntonio Huete JimenezThe value is interpreted as a format string for 141401e196c8SJohn Marino.Xr strftime 3 , 1415ca58f742SDaniel Fojtusing 1416*6eef5f0cSAntonio Huete Jimenez.Xr gmtime 3 , 1417*6eef5f0cSAntonio Huete Jimenezproducing the formatted timestamp. 1418ca58f742SDaniel FojtIf a 1419*6eef5f0cSAntonio Huete Jimenez.Ar timestamp 1420ca58f742SDaniel Fojtvalue is not provided or is 0, the current time is used. 142101e196c8SJohn Marino.It Cm \&:hash 1422*6eef5f0cSAntonio Huete JimenezComputes a 32-bit hash of the value and encodes it as 8 hex digits. 1423*6eef5f0cSAntonio Huete Jimenez.It Cm \&:localtime Ns Oo Cm = Ns Ar timestamp Oc 1424*6eef5f0cSAntonio Huete JimenezThe value is interpreted as a format string for 142501e196c8SJohn Marino.Xr strftime 3 , 1426ca58f742SDaniel Fojtusing 1427*6eef5f0cSAntonio Huete Jimenez.Xr localtime 3 , 1428*6eef5f0cSAntonio Huete Jimenezproducing the formatted timestamp. 1429ca58f742SDaniel FojtIf a 1430*6eef5f0cSAntonio Huete Jimenez.Ar timestamp 1431ca58f742SDaniel Fojtvalue is not provided or is 0, the current time is used. 143201e196c8SJohn Marino.It Cm \&:tA 1433*6eef5f0cSAntonio Huete JimenezAttempts to convert the value to an absolute path using 1434*6eef5f0cSAntonio Huete Jimenez.Xr realpath 3 . 1435*6eef5f0cSAntonio Huete JimenezIf that fails, the value is unchanged. 143601e196c8SJohn Marino.It Cm \&:tl 1437*6eef5f0cSAntonio Huete JimenezConverts the value to lower-case letters. 143801e196c8SJohn Marino.It Cm \&:ts Ns Ar c 1439*6eef5f0cSAntonio Huete JimenezWhen joining the words after a modifier that treats the value as words, 1440*6eef5f0cSAntonio Huete Jimenezthe words are normally separated by a space. 1441*6eef5f0cSAntonio Huete JimenezThis modifier changes the separator to the character 144201e196c8SJohn Marino.Ar c . 144301e196c8SJohn MarinoIf 144401e196c8SJohn Marino.Ar c 1445*6eef5f0cSAntonio Huete Jimenezis omitted, no separator is used. 1446a34d5fb1SAntonio Huete JimenezThe common escapes (including octal numeric codes) work as expected. 144701e196c8SJohn Marino.It Cm \&:tu 1448*6eef5f0cSAntonio Huete JimenezConverts the value to upper-case letters. 144901e196c8SJohn Marino.It Cm \&:tW 1450*6eef5f0cSAntonio Huete JimenezCauses subsequent modifiers to treat the value as a single word 145101e196c8SJohn Marino(possibly containing embedded whitespace). 145201e196c8SJohn MarinoSee also 1453*6eef5f0cSAntonio Huete Jimenez.Sq Cm \&:[*] . 145401e196c8SJohn Marino.It Cm \&:tw 1455*6eef5f0cSAntonio Huete JimenezCauses the value to be treated as a list of words. 145601e196c8SJohn MarinoSee also 1457*6eef5f0cSAntonio Huete Jimenez.Sq Cm \&:[@] . 145801e196c8SJohn Marino.Sm off 1459*6eef5f0cSAntonio Huete Jimenez.It Cm \&:S\| No \&/ Ar old_string\| No \&/ Ar new_string\| No \&/ Op Cm 1gW 146001e196c8SJohn Marino.Sm on 1461a34d5fb1SAntonio Huete JimenezModifies the first occurrence of 146201e196c8SJohn Marino.Ar old_string 1463*6eef5f0cSAntonio Huete Jimenezin each word of the value, replacing it with 146401e196c8SJohn Marino.Ar new_string . 146501e196c8SJohn MarinoIf a 146601e196c8SJohn Marino.Ql g 1467*6eef5f0cSAntonio Huete Jimenezis appended to the last delimiter of the pattern, 1468*6eef5f0cSAntonio Huete Jimenezall occurrences in each word are replaced. 146901e196c8SJohn MarinoIf a 147001e196c8SJohn Marino.Ql 1 1471*6eef5f0cSAntonio Huete Jimenezis appended to the last delimiter of the pattern, 1472*6eef5f0cSAntonio Huete Jimenezonly the first occurrence is affected. 147301e196c8SJohn MarinoIf a 147401e196c8SJohn Marino.Ql W 1475a34d5fb1SAntonio Huete Jimenezis appended to the last delimiter of the pattern, 1476*6eef5f0cSAntonio Huete Jimenezthe value is treated as a single word. 147701e196c8SJohn MarinoIf 147801e196c8SJohn Marino.Ar old_string 147901e196c8SJohn Marinobegins with a caret 148001e196c8SJohn Marino.Pq Ql ^ , 148101e196c8SJohn Marino.Ar old_string 148201e196c8SJohn Marinois anchored at the beginning of each word. 148301e196c8SJohn MarinoIf 148401e196c8SJohn Marino.Ar old_string 148501e196c8SJohn Marinoends with a dollar sign 148601e196c8SJohn Marino.Pq Ql \&$ , 148701e196c8SJohn Marinoit is anchored at the end of each word. 148801e196c8SJohn MarinoInside 148901e196c8SJohn Marino.Ar new_string , 149001e196c8SJohn Marinoan ampersand 1491ca58f742SDaniel Fojt.Pq Ql & 149201e196c8SJohn Marinois replaced by 149301e196c8SJohn Marino.Ar old_string 1494*6eef5f0cSAntonio Huete Jimenez(without the anchoring 149501e196c8SJohn Marino.Ql ^ 149601e196c8SJohn Marinoor 149701e196c8SJohn Marino.Ql \&$ ) . 1498*6eef5f0cSAntonio Huete JimenezAny character may be used as the delimiter for the parts of the modifier 149901e196c8SJohn Marinostring. 1500*6eef5f0cSAntonio Huete JimenezThe anchoring, ampersand and delimiter characters can be escaped with a 150101e196c8SJohn Marinobackslash 150201e196c8SJohn Marino.Pq Ql \e . 150301e196c8SJohn Marino.Pp 150401e196c8SJohn MarinoVariable expansion occurs in the normal fashion inside both 150501e196c8SJohn Marino.Ar old_string 150601e196c8SJohn Marinoand 150701e196c8SJohn Marino.Ar new_string 150801e196c8SJohn Marinowith the single exception that a backslash is used to prevent the expansion 150901e196c8SJohn Marinoof a dollar sign 151001e196c8SJohn Marino.Pq Ql \&$ , 151101e196c8SJohn Marinonot a preceding dollar sign as is usual. 151201e196c8SJohn Marino.Sm off 1513*6eef5f0cSAntonio Huete Jimenez.It Cm \&:C\| No \&/ Ar pattern\| No \&/ Ar replacement\| No \&/ Op Cm 1gW 151401e196c8SJohn Marino.Sm on 151501e196c8SJohn MarinoThe 151601e196c8SJohn Marino.Cm \&:C 1517*6eef5f0cSAntonio Huete Jimenezmodifier works like the 151801e196c8SJohn Marino.Cm \&:S 151901e196c8SJohn Marinomodifier except that the old and new strings, instead of being 1520*6eef5f0cSAntonio Huete Jimenezsimple strings, are an extended regular expression 152101e196c8SJohn Marino.Ar pattern 1522*6eef5f0cSAntonio Huete Jimenez(see 1523*6eef5f0cSAntonio Huete Jimenez.Xr regex 3 ) 152401e196c8SJohn Marinoand an 152501e196c8SJohn Marino.Xr ed 1 Ns \-style 152601e196c8SJohn Marino.Ar replacement . 152701e196c8SJohn MarinoNormally, the first occurrence of the pattern 152801e196c8SJohn Marino.Ar pattern 152901e196c8SJohn Marinoin each word of the value is substituted with 153001e196c8SJohn Marino.Ar replacement . 153101e196c8SJohn MarinoThe 153201e196c8SJohn Marino.Ql 1 153301e196c8SJohn Marinomodifier causes the substitution to apply to at most one word; the 153401e196c8SJohn Marino.Ql g 153501e196c8SJohn Marinomodifier causes the substitution to apply to as many instances of the 153601e196c8SJohn Marinosearch pattern 153701e196c8SJohn Marino.Ar pattern 153801e196c8SJohn Marinoas occur in the word or words it is found in; the 153901e196c8SJohn Marino.Ql W 154001e196c8SJohn Marinomodifier causes the value to be treated as a single word 154101e196c8SJohn Marino(possibly containing embedded whitespace). 15426a91b982SJohn Marino.Pp 15436a91b982SJohn MarinoAs for the 15446a91b982SJohn Marino.Cm \&:S 15456a91b982SJohn Marinomodifier, the 15466a91b982SJohn Marino.Ar pattern 15476a91b982SJohn Marinoand 15486a91b982SJohn Marino.Ar replacement 15496a91b982SJohn Marinoare subjected to variable expansion before being parsed as 15506a91b982SJohn Marinoregular expressions. 155101e196c8SJohn Marino.It Cm \&:T 1552*6eef5f0cSAntonio Huete JimenezReplaces each word in the variable with its last path component (basename). 155301e196c8SJohn Marino.It Cm \&:u 1554a34d5fb1SAntonio Huete JimenezRemoves adjacent duplicate words (like 155501e196c8SJohn Marino.Xr uniq 1 ) . 155601e196c8SJohn Marino.Sm off 1557*6eef5f0cSAntonio Huete Jimenez.It Cm \&:\&?\| Ar true_string\| Cm \&: Ar false_string 155801e196c8SJohn Marino.Sm on 1559*6eef5f0cSAntonio Huete JimenezIf the variable name (not its value), when parsed as a 1560*6eef5f0cSAntonio Huete Jimenez.Cm .if 1561*6eef5f0cSAntonio Huete Jimenezconditional expression, evaluates to true, return as its value the 156201e196c8SJohn Marino.Ar true_string , 156301e196c8SJohn Marinootherwise return the 156401e196c8SJohn Marino.Ar false_string . 1565*6eef5f0cSAntonio Huete JimenezSince the variable name is used as the expression, 1566*6eef5f0cSAntonio Huete Jimenez\&:\&? must be the first modifier after the variable name 1567*6eef5f0cSAntonio Huete Jimenez.No itself Ns \^\(em\^ Ns 1568*6eef5f0cSAntonio Huete Jimenezwhich, of course, usually contains variable expansions. 156901e196c8SJohn MarinoA common error is trying to use expressions like 157001e196c8SJohn Marino.Dl ${NUMBERS:M42:?match:no} 1571*6eef5f0cSAntonio Huete Jimenezwhich actually tests defined(NUMBERS). 1572*6eef5f0cSAntonio Huete JimenezTo determine if any words match 1573*6eef5f0cSAntonio Huete Jimenez.Dq 42 , 1574*6eef5f0cSAntonio Huete Jimenezyou need to use something like: 157501e196c8SJohn Marino.Dl ${"${NUMBERS:M42}" != \&"\&":?match:no} . 1576*6eef5f0cSAntonio Huete Jimenez.It Cm :\| Ns Ar old_string\| Ns Cm = Ns Ar new_string 157701e196c8SJohn MarinoThis is the 157801e196c8SJohn Marino.At V 157901e196c8SJohn Marinostyle variable substitution. 158001e196c8SJohn MarinoIt must be the last modifier specified. 158101e196c8SJohn MarinoIf 158201e196c8SJohn Marino.Ar old_string 158301e196c8SJohn Marinoor 158401e196c8SJohn Marino.Ar new_string 158501e196c8SJohn Marinodo not contain the pattern matching character 1586*6eef5f0cSAntonio Huete Jimenez.Ql % , 1587*6eef5f0cSAntonio Huete Jimenezit is assumed that they are anchored at the end of each word, 1588*6eef5f0cSAntonio Huete Jimenezso only suffixes or entire words may be replaced. 158901e196c8SJohn MarinoOtherwise 1590*6eef5f0cSAntonio Huete Jimenez.Ql % 159101e196c8SJohn Marinois the substring of 159201e196c8SJohn Marino.Ar old_string 159301e196c8SJohn Marinoto be replaced in 159401e196c8SJohn Marino.Ar new_string . 1595ca58f742SDaniel FojtIf only 1596ca58f742SDaniel Fojt.Ar old_string 1597ca58f742SDaniel Fojtcontains the pattern matching character 1598*6eef5f0cSAntonio Huete Jimenez.Ql % , 1599ca58f742SDaniel Fojtand 1600ca58f742SDaniel Fojt.Ar old_string 1601*6eef5f0cSAntonio Huete Jimenezmatches, the result is the 1602ca58f742SDaniel Fojt.Ar new_string . 1603ca58f742SDaniel FojtIf only the 1604ca58f742SDaniel Fojt.Ar new_string 1605ca58f742SDaniel Fojtcontains the pattern matching character 1606*6eef5f0cSAntonio Huete Jimenez.Ql % , 1607*6eef5f0cSAntonio Huete Jimenezit is not treated specially and it is printed as a literal 1608*6eef5f0cSAntonio Huete Jimenez.Ql % 1609ca58f742SDaniel Fojton match. 1610ca58f742SDaniel FojtIf there is more than one pattern matching character 1611*6eef5f0cSAntonio Huete Jimenez.Ql % 1612ca58f742SDaniel Fojtin either the 1613ca58f742SDaniel Fojt.Ar new_string 1614ca58f742SDaniel Fojtor 1615ca58f742SDaniel Fojt.Ar old_string , 1616ca58f742SDaniel Fojtonly the first instance is treated specially (as the pattern character); 1617a34d5fb1SAntonio Huete Jimenezall subsequent instances are treated as regular characters. 161801e196c8SJohn Marino.Pp 161901e196c8SJohn MarinoVariable expansion occurs in the normal fashion inside both 162001e196c8SJohn Marino.Ar old_string 162101e196c8SJohn Marinoand 162201e196c8SJohn Marino.Ar new_string 162301e196c8SJohn Marinowith the single exception that a backslash is used to prevent the 162401e196c8SJohn Marinoexpansion of a dollar sign 162501e196c8SJohn Marino.Pq Ql \&$ , 162601e196c8SJohn Marinonot a preceding dollar sign as is usual. 162701e196c8SJohn Marino.Sm off 1628*6eef5f0cSAntonio Huete Jimenez.It Cm \&:@ Ar varname\| Cm @ Ar string\| Cm @ 162901e196c8SJohn Marino.Sm on 163001e196c8SJohn MarinoThis is the loop expansion mechanism from the OSF Development 163101e196c8SJohn MarinoEnvironment (ODE) make. 163201e196c8SJohn MarinoUnlike 163301e196c8SJohn Marino.Cm \&.for 1634a34d5fb1SAntonio Huete Jimenezloops, expansion occurs at the time of reference. 1635*6eef5f0cSAntonio Huete JimenezFor each word in the value, assign the word to the variable named 1636*6eef5f0cSAntonio Huete Jimenez.Ar varname 1637*6eef5f0cSAntonio Huete Jimenezand evaluate 163801e196c8SJohn Marino.Ar string . 163901e196c8SJohn MarinoThe ODE convention is that 1640*6eef5f0cSAntonio Huete Jimenez.Ar varname 1641*6eef5f0cSAntonio Huete Jimenezshould start and end with a period, for example: 164201e196c8SJohn Marino.Dl ${LINKS:@.LINK.@${LN} ${TARGET} ${.LINK.}@} 164301e196c8SJohn Marino.Pp 1644*6eef5f0cSAntonio Huete JimenezHowever, a single-letter variable is often more readable: 164501e196c8SJohn Marino.Dl ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@} 1646*6eef5f0cSAntonio Huete Jimenez.It Cm \&:_ Ns Oo Cm = Ns Ar var Oc 1647a34d5fb1SAntonio Huete JimenezSaves the current variable value in 1648ca58f742SDaniel Fojt.Ql $_ 1649ca58f742SDaniel Fojtor the named 1650*6eef5f0cSAntonio Huete Jimenez.Ar var 1651ca58f742SDaniel Fojtfor later reference. 1652ca58f742SDaniel FojtExample usage: 1653ca58f742SDaniel Fojt.Bd -literal -offset indent 1654ca58f742SDaniel FojtM_cmpv.units = 1 1000 1000000 1655ca58f742SDaniel FojtM_cmpv = S,., ,g:_:range:@i@+ $${_:[-$$i]} \&\\ 1656ca58f742SDaniel Fojt\\* $${M_cmpv.units:[$$i]}@:S,^,expr 0 ,1:sh 1657ca58f742SDaniel Fojt 1658ca58f742SDaniel Fojt.Dv .if ${VERSION:${M_cmpv}} < ${3.1.12:L:${M_cmpv}} 1659ca58f742SDaniel Fojt 1660ca58f742SDaniel Fojt.Ed 1661ca58f742SDaniel FojtHere 1662ca58f742SDaniel Fojt.Ql $_ 1663ca58f742SDaniel Fojtis used to save the result of the 1664ca58f742SDaniel Fojt.Ql :S 1665ca58f742SDaniel Fojtmodifier which is later referenced using the index values from 1666ca58f742SDaniel Fojt.Ql :range . 1667*6eef5f0cSAntonio Huete Jimenez.It Cm \&:U\| Ns Ar newval 1668a34d5fb1SAntonio Huete JimenezIf the variable is undefined, 166901e196c8SJohn Marino.Ar newval 167001e196c8SJohn Marinois the value. 167101e196c8SJohn MarinoIf the variable is defined, the existing value is returned. 167201e196c8SJohn MarinoThis is another ODE make feature. 167301e196c8SJohn MarinoIt is handy for setting per-target CFLAGS for instance: 167401e196c8SJohn Marino.Dl ${_${.TARGET:T}_CFLAGS:U${DEF_CFLAGS}} 167501e196c8SJohn MarinoIf a value is only required if the variable is undefined, use: 167601e196c8SJohn Marino.Dl ${VAR:D:Unewval} 1677*6eef5f0cSAntonio Huete Jimenez.It Cm \&:D\| Ns Ar newval 1678a34d5fb1SAntonio Huete JimenezIf the variable is defined, 167901e196c8SJohn Marino.Ar newval 168001e196c8SJohn Marinois the value. 168101e196c8SJohn Marino.It Cm \&:L 168201e196c8SJohn MarinoThe name of the variable is the value. 168301e196c8SJohn Marino.It Cm \&:P 1684*6eef5f0cSAntonio Huete JimenezThe path of the node which has the same name as the variable is the value. 1685*6eef5f0cSAntonio Huete JimenezIf no such node exists or its path is null, the name of the variable is used. 168601e196c8SJohn MarinoIn order for this modifier to work, the name (node) must at least have 1687*6eef5f0cSAntonio Huete Jimenezappeared on the right-hand side of a dependency. 168801e196c8SJohn Marino.Sm off 1689*6eef5f0cSAntonio Huete Jimenez.It Cm \&:\&! Ar cmd\| Cm \&! 169001e196c8SJohn Marino.Sm on 169101e196c8SJohn MarinoThe output of running 169201e196c8SJohn Marino.Ar cmd 169301e196c8SJohn Marinois the value. 169401e196c8SJohn Marino.It Cm \&:sh 1695*6eef5f0cSAntonio Huete JimenezThe value is run as a command, and the output becomes the new value. 169601e196c8SJohn Marino.It Cm \&::= Ns Ar str 169701e196c8SJohn MarinoThe variable is assigned the value 169801e196c8SJohn Marino.Ar str 169901e196c8SJohn Marinoafter substitution. 1700*6eef5f0cSAntonio Huete JimenezThis modifier and its variations are useful in obscure situations 1701*6eef5f0cSAntonio Huete Jimenezsuch as wanting to set a variable 1702*6eef5f0cSAntonio Huete Jimenezat a point where a target's shell commands are being parsed. 1703*6eef5f0cSAntonio Huete JimenezThese assignment modifiers always expand to nothing. 170401e196c8SJohn Marino.Pp 170501e196c8SJohn MarinoThe 1706*6eef5f0cSAntonio Huete Jimenez.Sq Cm \&:: 170701e196c8SJohn Marinohelps avoid false matches with the 170801e196c8SJohn Marino.At V 170901e196c8SJohn Marinostyle 171001e196c8SJohn Marino.Cm \&:= 1711*6eef5f0cSAntonio Huete Jimenezmodifier and since substitution always occurs, the 171201e196c8SJohn Marino.Cm \&::= 171301e196c8SJohn Marinoform is vaguely appropriate. 171401e196c8SJohn Marino.It Cm \&::?= Ns Ar str 171501e196c8SJohn MarinoAs for 171601e196c8SJohn Marino.Cm \&::= 171701e196c8SJohn Marinobut only if the variable does not already have a value. 171801e196c8SJohn Marino.It Cm \&::+= Ns Ar str 171901e196c8SJohn MarinoAppend 172001e196c8SJohn Marino.Ar str 172101e196c8SJohn Marinoto the variable. 172201e196c8SJohn Marino.It Cm \&::!= Ns Ar cmd 172301e196c8SJohn MarinoAssign the output of 172401e196c8SJohn Marino.Ar cmd 172501e196c8SJohn Marinoto the variable. 172601e196c8SJohn Marino.It Cm \&:\&[ Ns Ar range Ns Cm \&] 172701e196c8SJohn MarinoSelects one or more words from the value, 172801e196c8SJohn Marinoor performs other operations related to the way in which the 1729*6eef5f0cSAntonio Huete Jimenezvalue is split into words. 173001e196c8SJohn Marino.Pp 173101e196c8SJohn MarinoAn empty value, or a value that consists entirely of white-space, 173201e196c8SJohn Marinois treated as a single word. 173301e196c8SJohn MarinoFor the purposes of the 1734*6eef5f0cSAntonio Huete Jimenez.Sq Cm \&:[] 173501e196c8SJohn Marinomodifier, the words are indexed both forwards using positive integers 173601e196c8SJohn Marino(where index 1 represents the first word), 173701e196c8SJohn Marinoand backwards using negative integers 173801e196c8SJohn Marino(where index \-1 represents the last word). 173901e196c8SJohn Marino.Pp 174001e196c8SJohn MarinoThe 174101e196c8SJohn Marino.Ar range 174201e196c8SJohn Marinois subjected to variable expansion, and the expanded result is 174301e196c8SJohn Marinothen interpreted as follows: 174401e196c8SJohn Marino.Bl -tag -width index 174501e196c8SJohn Marino.\" :[n] 174601e196c8SJohn Marino.It Ar index 174701e196c8SJohn MarinoSelects a single word from the value. 174801e196c8SJohn Marino.\" :[start..end] 174901e196c8SJohn Marino.It Ar start Ns Cm \&.. Ns Ar end 175001e196c8SJohn MarinoSelects all words from 175101e196c8SJohn Marino.Ar start 175201e196c8SJohn Marinoto 175301e196c8SJohn Marino.Ar end , 175401e196c8SJohn Marinoinclusive. 175501e196c8SJohn MarinoFor example, 1756*6eef5f0cSAntonio Huete Jimenez.Sq Cm \&:[2..-1] 175701e196c8SJohn Marinoselects all words from the second word to the last word. 175801e196c8SJohn MarinoIf 175901e196c8SJohn Marino.Ar start 176001e196c8SJohn Marinois greater than 176101e196c8SJohn Marino.Ar end , 1762*6eef5f0cSAntonio Huete Jimenezthe words are output in reverse order. 176301e196c8SJohn MarinoFor example, 1764*6eef5f0cSAntonio Huete Jimenez.Sq Cm \&:[-1..1] 176501e196c8SJohn Marinoselects all the words from last to first. 1766*6eef5f0cSAntonio Huete JimenezIf the list is already ordered, 1767*6eef5f0cSAntonio Huete Jimenezthis effectively reverses the list, 1768*6eef5f0cSAntonio Huete Jimenezbut it is more efficient to use 1769*6eef5f0cSAntonio Huete Jimenez.Sq Cm \&:Or 1770ca58f742SDaniel Fojtinstead of 1771*6eef5f0cSAntonio Huete Jimenez.Sq Cm \&:O:[-1..1] . 177201e196c8SJohn Marino.\" :[*] 177301e196c8SJohn Marino.It Cm \&* 177401e196c8SJohn MarinoCauses subsequent modifiers to treat the value as a single word 177501e196c8SJohn Marino(possibly containing embedded whitespace). 177601e196c8SJohn MarinoAnalogous to the effect of 1777*6eef5f0cSAntonio Huete Jimenez.Li \&$* 177801e196c8SJohn Marinoin Bourne shell. 177901e196c8SJohn Marino.\" :[0] 178001e196c8SJohn Marino.It 0 178101e196c8SJohn MarinoMeans the same as 1782*6eef5f0cSAntonio Huete Jimenez.Sq Cm \&:[*] . 178301e196c8SJohn Marino.\" :[*] 178401e196c8SJohn Marino.It Cm \&@ 178501e196c8SJohn MarinoCauses subsequent modifiers to treat the value as a sequence of words 178601e196c8SJohn Marinodelimited by whitespace. 178701e196c8SJohn MarinoAnalogous to the effect of 1788*6eef5f0cSAntonio Huete Jimenez.Li \&$@ 178901e196c8SJohn Marinoin Bourne shell. 179001e196c8SJohn Marino.\" :[#] 179101e196c8SJohn Marino.It Cm \&# 179201e196c8SJohn MarinoReturns the number of words in the value. 179301e196c8SJohn Marino.El \" :[range] 179401e196c8SJohn Marino.El 1795*6eef5f0cSAntonio Huete Jimenez.Sh DIRECTIVES 1796*6eef5f0cSAntonio Huete JimenezMakefile inclusion, conditional structures and for loops are provided in 179701e196c8SJohn Marino.Nm . 179801e196c8SJohn MarinoAll such structures are identified by a line beginning with a single 179901e196c8SJohn Marinodot 180001e196c8SJohn Marino.Pq Ql \&. 1801*6eef5f0cSAntonio Huete Jimenezcharacter, followed by the keyword of the directive, such as 1802*6eef5f0cSAntonio Huete Jimenez.Cm include 1803*6eef5f0cSAntonio Huete Jimenezor 1804*6eef5f0cSAntonio Huete Jimenez.Cm if . 1805*6eef5f0cSAntonio Huete Jimenez.Ss File inclusion 180601e196c8SJohn MarinoFiles are included with either 1807ca58f742SDaniel Fojt.Cm \&.include \&< Ns Ar file Ns Cm \&> 180801e196c8SJohn Marinoor 1809ca58f742SDaniel Fojt.Cm \&.include \&\*q Ns Ar file Ns Cm \&\*q . 181001e196c8SJohn MarinoVariables between the angle brackets or double quotes are expanded 181101e196c8SJohn Marinoto form the file name. 181201e196c8SJohn MarinoIf angle brackets are used, the included makefile is expected to be in 181301e196c8SJohn Marinothe system makefile directory. 181401e196c8SJohn MarinoIf double quotes are used, the including makefile's directory and any 181501e196c8SJohn Marinodirectories specified using the 181601e196c8SJohn Marino.Fl I 1817*6eef5f0cSAntonio Huete Jimenezoption are searched before the system makefile directory. 1818*6eef5f0cSAntonio Huete Jimenez.Pp 1819*6eef5f0cSAntonio Huete JimenezFor compatibility with other make variants, 1820*6eef5f0cSAntonio Huete Jimenez.Sq Cm include Ar file No ... 1821*6eef5f0cSAntonio Huete Jimenez(without leading dot) 182201e196c8SJohn Marinois also accepted. 1823f445c897SJohn Marino.Pp 182401e196c8SJohn MarinoIf the include statement is written as 182501e196c8SJohn Marino.Cm .-include 182601e196c8SJohn Marinoor as 1827*6eef5f0cSAntonio Huete Jimenez.Cm .sinclude , 1828*6eef5f0cSAntonio Huete Jimenezerrors locating and/or opening include files are ignored. 182901e196c8SJohn Marino.Pp 1830f445c897SJohn MarinoIf the include statement is written as 1831*6eef5f0cSAntonio Huete Jimenez.Cm .dinclude , 1832f445c897SJohn Marinonot only are errors locating and/or opening include files ignored, 1833*6eef5f0cSAntonio Huete Jimenezbut stale dependencies within the included file are ignored just like in 1834f445c897SJohn Marino.Va .MAKE.DEPENDFILE . 1835*6eef5f0cSAntonio Huete Jimenez.Ss Exporting variables 1836*6eef5f0cSAntonio Huete JimenezThe directives for exporting and unexporting variables are: 183701e196c8SJohn Marino.Bl -tag -width Ds 1838*6eef5f0cSAntonio Huete Jimenez.It Ic .export Ar variable No ... 183901e196c8SJohn MarinoExport the specified global variable. 184001e196c8SJohn MarinoIf no variable list is provided, all globals are exported 184101e196c8SJohn Marinoexcept for internal variables (those that start with 184201e196c8SJohn Marino.Ql \&. ) . 184301e196c8SJohn MarinoThis is not affected by the 184401e196c8SJohn Marino.Fl X 184501e196c8SJohn Marinoflag, so should be used with caution. 1846*6eef5f0cSAntonio Huete JimenezFor compatibility with other make programs, 1847*6eef5f0cSAntonio Huete Jimenez.Cm export Ar variable\| Ns Cm \&= Ns Ar value 1848*6eef5f0cSAntonio Huete Jimenez(without leading dot) is also accepted. 184901e196c8SJohn Marino.Pp 185001e196c8SJohn MarinoAppending a variable name to 185101e196c8SJohn Marino.Va .MAKE.EXPORTED 185201e196c8SJohn Marinois equivalent to exporting a variable. 1853*6eef5f0cSAntonio Huete Jimenez.It Ic .export-env Ar variable No ... 185401e196c8SJohn MarinoThe same as 185501e196c8SJohn Marino.Ql .export , 185601e196c8SJohn Marinoexcept that the variable is not appended to 185701e196c8SJohn Marino.Va .MAKE.EXPORTED . 185801e196c8SJohn MarinoThis allows exporting a value to the environment which is different from that 185901e196c8SJohn Marinoused by 186001e196c8SJohn Marino.Nm 186101e196c8SJohn Marinointernally. 1862*6eef5f0cSAntonio Huete Jimenez.It Ic .export-literal Ar variable No ... 1863f445c897SJohn MarinoThe same as 1864f445c897SJohn Marino.Ql .export-env , 1865f445c897SJohn Marinoexcept that variables in the value are not expanded. 1866*6eef5f0cSAntonio Huete Jimenez.It Ic .unexport Ar variable No ... 186701e196c8SJohn MarinoThe opposite of 186801e196c8SJohn Marino.Ql .export . 186901e196c8SJohn MarinoThe specified global 1870*6eef5f0cSAntonio Huete Jimenez.Ar variable 1871*6eef5f0cSAntonio Huete Jimenezis removed from 187201e196c8SJohn Marino.Va .MAKE.EXPORTED . 187301e196c8SJohn MarinoIf no variable list is provided, all globals are unexported, 187401e196c8SJohn Marinoand 187501e196c8SJohn Marino.Va .MAKE.EXPORTED 187601e196c8SJohn Marinodeleted. 187701e196c8SJohn Marino.It Ic .unexport-env 187801e196c8SJohn MarinoUnexport all globals previously exported and 187901e196c8SJohn Marinoclear the environment inherited from the parent. 1880*6eef5f0cSAntonio Huete JimenezThis operation causes a memory leak of the original environment, 188101e196c8SJohn Marinoso should be used sparingly. 188201e196c8SJohn MarinoTesting for 188301e196c8SJohn Marino.Va .MAKE.LEVEL 1884*6eef5f0cSAntonio Huete Jimenezbeing 0 would make sense. 188501e196c8SJohn MarinoAlso note that any variables which originated in the parent environment 188601e196c8SJohn Marinoshould be explicitly preserved if desired. 188701e196c8SJohn MarinoFor example: 188801e196c8SJohn Marino.Bd -literal -offset indent 188901e196c8SJohn Marino.Li .if ${.MAKE.LEVEL} == 0 189001e196c8SJohn MarinoPATH := ${PATH} 189101e196c8SJohn Marino.Li .unexport-env 189201e196c8SJohn Marino.Li .export PATH 189301e196c8SJohn Marino.Li .endif 189401e196c8SJohn Marino.Ed 1895c9ed6119SAntonio Huete Jimenez.Pp 189601e196c8SJohn MarinoWould result in an environment containing only 1897*6eef5f0cSAntonio Huete Jimenez.Sq Ev PATH , 189801e196c8SJohn Marinowhich is the minimal useful environment. 1899*6eef5f0cSAntonio Huete Jimenez.\" TODO: Check the below sentence, environment variables don't start with '.'. 190001e196c8SJohn MarinoActually 1901*6eef5f0cSAntonio Huete Jimenez.Sq Va .MAKE.LEVEL 1902*6eef5f0cSAntonio Huete Jimenezis also pushed into the new environment. 1903*6eef5f0cSAntonio Huete Jimenez.El 1904*6eef5f0cSAntonio Huete Jimenez.Ss Messages 1905*6eef5f0cSAntonio Huete JimenezThe directives for printing messages to the output are: 1906*6eef5f0cSAntonio Huete Jimenez.Bl -tag -width Ds 1907*6eef5f0cSAntonio Huete Jimenez.It Ic .info Ar message 1908*6eef5f0cSAntonio Huete JimenezThe message is printed along with the name of the makefile and line number. 190901e196c8SJohn Marino.It Ic .warning Ar message 191001e196c8SJohn MarinoThe message prefixed by 1911*6eef5f0cSAntonio Huete Jimenez.Sq Li warning: 191201e196c8SJohn Marinois printed along with the name of the makefile and line number. 1913*6eef5f0cSAntonio Huete Jimenez.It Ic .error Ar message 1914*6eef5f0cSAntonio Huete JimenezThe message is printed along with the name of the makefile and line number, 1915*6eef5f0cSAntonio Huete Jimenez.Nm 1916*6eef5f0cSAntonio Huete Jimenezexits immediately. 1917*6eef5f0cSAntonio Huete Jimenez.El 1918*6eef5f0cSAntonio Huete Jimenez.Ss Conditionals 1919*6eef5f0cSAntonio Huete JimenezThe directives for conditionals are: 1920*6eef5f0cSAntonio Huete Jimenez.ds maybenot Oo Ic \&! Oc Ns 1921*6eef5f0cSAntonio Huete Jimenez.Bl -tag -width Ds 1922*6eef5f0cSAntonio Huete Jimenez.It Ic .if \*[maybenot] Ar expression Op Ar operator expression No ... 192301e196c8SJohn MarinoTest the value of an expression. 1924*6eef5f0cSAntonio Huete Jimenez.It Ic .ifdef \*[maybenot] Ar variable Op Ar operator variable No ... 192501e196c8SJohn MarinoTest the value of a variable. 1926*6eef5f0cSAntonio Huete Jimenez.It Ic .ifndef \*[maybenot] Ar variable Op Ar operator variable No ... 192701e196c8SJohn MarinoTest the value of a variable. 1928*6eef5f0cSAntonio Huete Jimenez.It Ic .ifmake \*[maybenot] Ar target Op Ar operator target No ... 1929*6eef5f0cSAntonio Huete JimenezTest the target being requested. 1930*6eef5f0cSAntonio Huete Jimenez.It Ic .ifnmake \*[maybenot] Ar target Op Ar operator target No ... 1931*6eef5f0cSAntonio Huete JimenezTest the target being requested. 193201e196c8SJohn Marino.It Ic .else 193301e196c8SJohn MarinoReverse the sense of the last conditional. 1934*6eef5f0cSAntonio Huete Jimenez.It Ic .elif \*[maybenot] Ar expression Op Ar operator expression No ... 193501e196c8SJohn MarinoA combination of 1936*6eef5f0cSAntonio Huete Jimenez.Sq Ic .else 193701e196c8SJohn Marinofollowed by 1938*6eef5f0cSAntonio Huete Jimenez.Sq Ic .if . 1939*6eef5f0cSAntonio Huete Jimenez.It Ic .elifdef \*[maybenot] Ar variable Op Ar operator variable No ... 194001e196c8SJohn MarinoA combination of 1941*6eef5f0cSAntonio Huete Jimenez.Sq Ic .else 194201e196c8SJohn Marinofollowed by 1943*6eef5f0cSAntonio Huete Jimenez.Sq Ic .ifdef . 1944*6eef5f0cSAntonio Huete Jimenez.It Ic .elifndef \*[maybenot] Ar variable Op Ar operator variable No ... 194501e196c8SJohn MarinoA combination of 1946*6eef5f0cSAntonio Huete Jimenez.Sq Ic .else 194701e196c8SJohn Marinofollowed by 1948*6eef5f0cSAntonio Huete Jimenez.Sq Ic .ifndef . 1949*6eef5f0cSAntonio Huete Jimenez.It Ic .elifmake \*[maybenot] Ar target Op Ar operator target No ... 195001e196c8SJohn MarinoA combination of 1951*6eef5f0cSAntonio Huete Jimenez.Sq Ic .else 195201e196c8SJohn Marinofollowed by 1953*6eef5f0cSAntonio Huete Jimenez.Sq Ic .ifmake . 1954*6eef5f0cSAntonio Huete Jimenez.It Ic .elifnmake \*[maybenot] Ar target Op Ar operator target No ... 195501e196c8SJohn MarinoA combination of 1956*6eef5f0cSAntonio Huete Jimenez.Sq Ic .else 195701e196c8SJohn Marinofollowed by 1958*6eef5f0cSAntonio Huete Jimenez.Sq Ic .ifnmake . 195901e196c8SJohn Marino.It Ic .endif 196001e196c8SJohn MarinoEnd the body of the conditional. 196101e196c8SJohn Marino.El 196201e196c8SJohn Marino.Pp 196301e196c8SJohn MarinoThe 196401e196c8SJohn Marino.Ar operator 196501e196c8SJohn Marinomay be any one of the following: 196601e196c8SJohn Marino.Bl -tag -width "Cm XX" 1967*6eef5f0cSAntonio Huete Jimenez.It Ic \&|\&| 196801e196c8SJohn MarinoLogical OR. 1969*6eef5f0cSAntonio Huete Jimenez.It Ic \&&& 1970*6eef5f0cSAntonio Huete JimenezLogical AND; of higher precedence than 1971*6eef5f0cSAntonio Huete Jimenez.Sq Ic \&|\&| . 197201e196c8SJohn Marino.El 197301e196c8SJohn Marino.Pp 197401e196c8SJohn Marino.Nm 1975*6eef5f0cSAntonio Huete Jimenezonly evaluates a conditional as far as is necessary to determine its value. 1976*6eef5f0cSAntonio Huete JimenezParentheses can be used to override the operator precedence. 197701e196c8SJohn MarinoThe boolean operator 1978*6eef5f0cSAntonio Huete Jimenez.Sq Ic \&! 1979*6eef5f0cSAntonio Huete Jimenezmay be used to logically negate an entire conditional. 198001e196c8SJohn MarinoIt is of higher precedence than 1981*6eef5f0cSAntonio Huete Jimenez.Sq Ic \&&& . 198201e196c8SJohn Marino.Pp 198301e196c8SJohn MarinoThe value of 198401e196c8SJohn Marino.Ar expression 198501e196c8SJohn Marinomay be any of the following: 198601e196c8SJohn Marino.Bl -tag -width defined 198701e196c8SJohn Marino.It Ic defined 198801e196c8SJohn MarinoTakes a variable name as an argument and evaluates to true if the variable 198901e196c8SJohn Marinohas been defined. 199001e196c8SJohn Marino.It Ic make 199101e196c8SJohn MarinoTakes a target name as an argument and evaluates to true if the target 199201e196c8SJohn Marinowas specified as part of 199301e196c8SJohn Marino.Nm Ns 's 199401e196c8SJohn Marinocommand line or was declared the default target (either implicitly or 199501e196c8SJohn Marinoexplicitly, see 199601e196c8SJohn Marino.Va .MAIN ) 199701e196c8SJohn Marinobefore the line containing the conditional. 199801e196c8SJohn Marino.It Ic empty 1999*6eef5f0cSAntonio Huete JimenezTakes a variable name, with possible modifiers, and evaluates to true if 2000*6eef5f0cSAntonio Huete Jimenezthe expansion of the variable results in an empty string. 200101e196c8SJohn Marino.It Ic exists 200201e196c8SJohn MarinoTakes a file name as an argument and evaluates to true if the file exists. 200301e196c8SJohn MarinoThe file is searched for on the system search path (see 200401e196c8SJohn Marino.Va .PATH ) . 200501e196c8SJohn Marino.It Ic target 200601e196c8SJohn MarinoTakes a target name as an argument and evaluates to true if the target 200701e196c8SJohn Marinohas been defined. 200801e196c8SJohn Marino.It Ic commands 200901e196c8SJohn MarinoTakes a target name as an argument and evaluates to true if the target 201001e196c8SJohn Marinohas been defined and has commands associated with it. 201101e196c8SJohn Marino.El 201201e196c8SJohn Marino.Pp 201301e196c8SJohn Marino.Ar Expression 201401e196c8SJohn Marinomay also be an arithmetic or string comparison. 2015*6eef5f0cSAntonio Huete JimenezVariable expansion is performed on both sides of the comparison. 2016*6eef5f0cSAntonio Huete JimenezIf both sides are numeric and neither is enclosed in quotes, 2017*6eef5f0cSAntonio Huete Jimenezthe comparison is done numerically, otherwise lexicographically. 2018*6eef5f0cSAntonio Huete JimenezA string is interpreted as hexadecimal integer if it is preceded by 2019*6eef5f0cSAntonio Huete Jimenez.Li 0x , 2020*6eef5f0cSAntonio Huete Jimenezotherwise it is a decimal floating-point number; 2021*6eef5f0cSAntonio Huete Jimenezoctal numbers are not supported. 2022*6eef5f0cSAntonio Huete Jimenez.Pp 2023*6eef5f0cSAntonio Huete JimenezAll comparisons may use the operators 2024*6eef5f0cSAntonio Huete Jimenez.Sq Ic \&== 2025*6eef5f0cSAntonio Huete Jimenezand 2026*6eef5f0cSAntonio Huete Jimenez.Sq Ic \&!= . 2027*6eef5f0cSAntonio Huete JimenezNumeric comparisons may also use the operators 2028*6eef5f0cSAntonio Huete Jimenez.Sq Ic \&< , 2029*6eef5f0cSAntonio Huete Jimenez.Sq Ic \&<= , 2030*6eef5f0cSAntonio Huete Jimenez.Sq Ic \&> 2031*6eef5f0cSAntonio Huete Jimenezand 2032*6eef5f0cSAntonio Huete Jimenez.Sq Ic \&>= . 2033*6eef5f0cSAntonio Huete Jimenez.Pp 2034*6eef5f0cSAntonio Huete JimenezIf the comparison has neither a comparison operator nor a right side, 2035*6eef5f0cSAntonio Huete Jimenezthe expression evaluates to true if it is nonempty 2036*6eef5f0cSAntonio Huete Jimenezand its numeric value (if any) is not zero. 203701e196c8SJohn Marino.Pp 203801e196c8SJohn MarinoWhen 203901e196c8SJohn Marino.Nm 204001e196c8SJohn Marinois evaluating one of these conditional expressions, and it encounters 2041*6eef5f0cSAntonio Huete Jimeneza (whitespace separated) word it doesn't recognize, either the 204201e196c8SJohn Marino.Dq make 204301e196c8SJohn Marinoor 204401e196c8SJohn Marino.Dq defined 2045*6eef5f0cSAntonio Huete Jimenezfunction is applied to it, depending on the form of the conditional. 204601e196c8SJohn MarinoIf the form is 2047*6eef5f0cSAntonio Huete Jimenez.Sq Ic .ifdef , 2048*6eef5f0cSAntonio Huete Jimenez.Sq Ic .ifndef 204901e196c8SJohn Marinoor 2050*6eef5f0cSAntonio Huete Jimenez.Sq Ic .if , 205101e196c8SJohn Marinothe 205201e196c8SJohn Marino.Dq defined 2053*6eef5f0cSAntonio Huete Jimenezfunction is applied. 205401e196c8SJohn MarinoSimilarly, if the form is 2055*6eef5f0cSAntonio Huete Jimenez.Sq Ic .ifmake 205601e196c8SJohn Marinoor 2057*6eef5f0cSAntonio Huete Jimenez.Sq Ic .ifnmake , 2058ca58f742SDaniel Fojtthe 205901e196c8SJohn Marino.Dq make 2060*6eef5f0cSAntonio Huete Jimenezfunction is applied. 206101e196c8SJohn Marino.Pp 2062*6eef5f0cSAntonio Huete JimenezIf the conditional evaluates to true, 2063*6eef5f0cSAntonio Huete Jimenezparsing of the makefile continues as before. 206401e196c8SJohn MarinoIf it evaluates to false, the following lines are skipped. 2065*6eef5f0cSAntonio Huete JimenezIn both cases, this continues until the corresponding 2066*6eef5f0cSAntonio Huete Jimenez.Sq Ic .else 206701e196c8SJohn Marinoor 2068*6eef5f0cSAntonio Huete Jimenez.Sq Ic .endif 206901e196c8SJohn Marinois found. 2070*6eef5f0cSAntonio Huete Jimenez.Ss For loops 207101e196c8SJohn MarinoFor loops are typically used to apply a set of rules to a list of files. 207201e196c8SJohn MarinoThe syntax of a for loop is: 207301e196c8SJohn Marino.Pp 207401e196c8SJohn Marino.Bl -tag -compact -width Ds 2075*6eef5f0cSAntonio Huete Jimenez.It Ic \&.for Ar variable Oo Ar variable No ... Oc Ic in Ar expression 2076a34d5fb1SAntonio Huete Jimenez.It Aq make-lines 207701e196c8SJohn Marino.It Ic \&.endfor 207801e196c8SJohn Marino.El 207901e196c8SJohn Marino.Pp 2080*6eef5f0cSAntonio Huete JimenezThe 208101e196c8SJohn Marino.Ic expression 2082*6eef5f0cSAntonio Huete Jimenezis expanded and then split into words. 208301e196c8SJohn MarinoOn each iteration of the loop, one word is taken and assigned to each 208401e196c8SJohn Marino.Ic variable , 208501e196c8SJohn Marinoin order, and these 208601e196c8SJohn Marino.Ic variables 208701e196c8SJohn Marinoare substituted into the 2088a34d5fb1SAntonio Huete Jimenez.Ic make-lines 208901e196c8SJohn Marinoinside the body of the for loop. 209001e196c8SJohn MarinoThe number of words must come out even; that is, if there are three 209101e196c8SJohn Marinoiteration variables, the number of words provided must be a multiple 209201e196c8SJohn Marinoof three. 2093*6eef5f0cSAntonio Huete Jimenez.Pp 2094*6eef5f0cSAntonio Huete JimenezIf 2095*6eef5f0cSAntonio Huete Jimenez.Sq Ic .break 2096*6eef5f0cSAntonio Huete Jimenezis encountered within a 2097*6eef5f0cSAntonio Huete Jimenez.Cm \&.for 2098*6eef5f0cSAntonio Huete Jimenezloop, it causes early termination of the loop, otherwise a parse error. 2099*6eef5f0cSAntonio Huete Jimenez.\" TODO: Describe limitations with defined/empty. 2100*6eef5f0cSAntonio Huete Jimenez.Ss Other directives 2101*6eef5f0cSAntonio Huete Jimenez.Bl -tag -width Ds 2102*6eef5f0cSAntonio Huete Jimenez.It Ic .undef Ar variable No ... 2103*6eef5f0cSAntonio Huete JimenezUn-define the specified global variables. 2104*6eef5f0cSAntonio Huete JimenezOnly global variables can be un-defined. 2105*6eef5f0cSAntonio Huete Jimenez.El 210601e196c8SJohn Marino.Sh COMMENTS 210701e196c8SJohn MarinoComments begin with a hash 210801e196c8SJohn Marino.Pq Ql \&# 210901e196c8SJohn Marinocharacter, anywhere but in a shell 211001e196c8SJohn Marinocommand line, and continue to the end of an unescaped new line. 211101e196c8SJohn Marino.Sh SPECIAL SOURCES (ATTRIBUTES) 211201e196c8SJohn Marino.Bl -tag -width .IGNOREx 211301e196c8SJohn Marino.It Ic .EXEC 211401e196c8SJohn MarinoTarget is never out of date, but always execute commands anyway. 211501e196c8SJohn Marino.It Ic .IGNORE 211601e196c8SJohn MarinoIgnore any errors from the commands associated with this target, exactly 211701e196c8SJohn Marinoas if they all were preceded by a dash 211801e196c8SJohn Marino.Pq Ql \- . 211901e196c8SJohn Marino.\" .It Ic .INVISIBLE 212001e196c8SJohn Marino.\" XXX 212101e196c8SJohn Marino.\" .It Ic .JOIN 212201e196c8SJohn Marino.\" XXX 212301e196c8SJohn Marino.It Ic .MADE 2124*6eef5f0cSAntonio Huete JimenezMark all sources of this target as being up to date. 212501e196c8SJohn Marino.It Ic .MAKE 212601e196c8SJohn MarinoExecute the commands associated with this target even if the 212701e196c8SJohn Marino.Fl n 212801e196c8SJohn Marinoor 212901e196c8SJohn Marino.Fl t 213001e196c8SJohn Marinooptions were specified. 213101e196c8SJohn MarinoNormally used to mark recursive 21326a91b982SJohn Marino.Nm Ns s . 213301e196c8SJohn Marino.It Ic .META 213401e196c8SJohn MarinoCreate a meta file for the target, even if it is flagged as 213501e196c8SJohn Marino.Ic .PHONY , 213601e196c8SJohn Marino.Ic .MAKE , 213701e196c8SJohn Marinoor 213801e196c8SJohn Marino.Ic .SPECIAL . 213901e196c8SJohn MarinoUsage in conjunction with 214001e196c8SJohn Marino.Ic .MAKE 214101e196c8SJohn Marinois the most likely case. 2142*6eef5f0cSAntonio Huete JimenezIn 2143*6eef5f0cSAntonio Huete Jimenez.Dq meta 2144*6eef5f0cSAntonio Huete Jimenezmode, the target is out-of-date if the meta file is missing. 214501e196c8SJohn Marino.It Ic .NOMETA 214601e196c8SJohn MarinoDo not create a meta file for the target. 214701e196c8SJohn MarinoMeta files are also not created for 214801e196c8SJohn Marino.Ic .PHONY , 214901e196c8SJohn Marino.Ic .MAKE , 215001e196c8SJohn Marinoor 215101e196c8SJohn Marino.Ic .SPECIAL 215201e196c8SJohn Marinotargets. 215301e196c8SJohn Marino.It Ic .NOMETA_CMP 215401e196c8SJohn MarinoIgnore differences in commands when deciding if target is out of date. 215501e196c8SJohn MarinoThis is useful if the command contains a value which always changes. 2156*6eef5f0cSAntonio Huete JimenezIf the number of commands change, though, 2157*6eef5f0cSAntonio Huete Jimenezthe target is still considered out of date. 21585f1e34d9SAlexandre PerrinThe same effect applies to any command line that uses the variable 21595f1e34d9SAlexandre Perrin.Va .OODATE , 21605f1e34d9SAlexandre Perrinwhich can be used for that purpose even when not otherwise needed or desired: 21615f1e34d9SAlexandre Perrin.Bd -literal -offset indent 21625f1e34d9SAlexandre Perrin 21635f1e34d9SAlexandre Perrinskip-compare-for-some: 2164*6eef5f0cSAntonio Huete Jimenez @echo this is compared 2165*6eef5f0cSAntonio Huete Jimenez @echo this is not ${.OODATE:M.NOMETA_CMP} 2166*6eef5f0cSAntonio Huete Jimenez @echo this is also compared 21675f1e34d9SAlexandre Perrin 21685f1e34d9SAlexandre Perrin.Ed 21695f1e34d9SAlexandre PerrinThe 21705f1e34d9SAlexandre Perrin.Cm \&:M 21715f1e34d9SAlexandre Perrinpattern suppresses any expansion of the unwanted variable. 217201e196c8SJohn Marino.It Ic .NOPATH 217301e196c8SJohn MarinoDo not search for the target in the directories specified by 2174*6eef5f0cSAntonio Huete Jimenez.Va .PATH . 217501e196c8SJohn Marino.It Ic .NOTMAIN 217601e196c8SJohn MarinoNormally 217701e196c8SJohn Marino.Nm 217801e196c8SJohn Marinoselects the first target it encounters as the default target to be built 217901e196c8SJohn Marinoif no target was specified. 218001e196c8SJohn MarinoThis source prevents this target from being selected. 218101e196c8SJohn Marino.It Ic .OPTIONAL 218201e196c8SJohn MarinoIf a target is marked with this attribute and 218301e196c8SJohn Marino.Nm 2184*6eef5f0cSAntonio Huete Jimenezcan't figure out how to create it, it ignores this fact and assumes 218501e196c8SJohn Marinothe file isn't needed or already exists. 218601e196c8SJohn Marino.It Ic .PHONY 2187*6eef5f0cSAntonio Huete JimenezThe target does not correspond to an actual file; 2188*6eef5f0cSAntonio Huete Jimenezit is always considered to be out of date, 2189*6eef5f0cSAntonio Huete Jimenezand is not created with the 219001e196c8SJohn Marino.Fl t 219101e196c8SJohn Marinooption. 219201e196c8SJohn MarinoSuffix-transformation rules are not applied to 219301e196c8SJohn Marino.Ic .PHONY 219401e196c8SJohn Marinotargets. 219501e196c8SJohn Marino.It Ic .PRECIOUS 219601e196c8SJohn MarinoWhen 219701e196c8SJohn Marino.Nm 219801e196c8SJohn Marinois interrupted, it normally removes any partially made targets. 219901e196c8SJohn MarinoThis source prevents the target from being removed. 220001e196c8SJohn Marino.It Ic .RECURSIVE 220101e196c8SJohn MarinoSynonym for 220201e196c8SJohn Marino.Ic .MAKE . 220301e196c8SJohn Marino.It Ic .SILENT 220401e196c8SJohn MarinoDo not echo any of the commands associated with this target, exactly 220501e196c8SJohn Marinoas if they all were preceded by an at sign 220601e196c8SJohn Marino.Pq Ql @ . 220701e196c8SJohn Marino.It Ic .USE 220801e196c8SJohn MarinoTurn the target into 220901e196c8SJohn Marino.Nm Ns 's 221001e196c8SJohn Marinoversion of a macro. 221101e196c8SJohn MarinoWhen the target is used as a source for another target, the other target 221201e196c8SJohn Marinoacquires the commands, sources, and attributes (except for 221301e196c8SJohn Marino.Ic .USE ) 221401e196c8SJohn Marinoof the 221501e196c8SJohn Marinosource. 221601e196c8SJohn MarinoIf the target already has commands, the 221701e196c8SJohn Marino.Ic .USE 221801e196c8SJohn Marinotarget's commands are appended 221901e196c8SJohn Marinoto them. 222001e196c8SJohn Marino.It Ic .USEBEFORE 2221*6eef5f0cSAntonio Huete JimenezLike 222201e196c8SJohn Marino.Ic .USE , 2223*6eef5f0cSAntonio Huete Jimenezbut instead of appending, prepend the 222401e196c8SJohn Marino.Ic .USEBEFORE 222501e196c8SJohn Marinotarget commands to the target. 222601e196c8SJohn Marino.It Ic .WAIT 222701e196c8SJohn MarinoIf 222801e196c8SJohn Marino.Ic .WAIT 222901e196c8SJohn Marinoappears in a dependency line, the sources that precede it are 223001e196c8SJohn Marinomade before the sources that succeed it in the line. 223101e196c8SJohn MarinoSince the dependents of files are not made until the file itself 223201e196c8SJohn Marinocould be made, this also stops the dependents being built unless they 223301e196c8SJohn Marinoare needed for another branch of the dependency tree. 223401e196c8SJohn MarinoSo given: 223501e196c8SJohn Marino.Bd -literal 223601e196c8SJohn Marinox: a .WAIT b 223701e196c8SJohn Marino echo x 223801e196c8SJohn Marinoa: 223901e196c8SJohn Marino echo a 224001e196c8SJohn Marinob: b1 224101e196c8SJohn Marino echo b 224201e196c8SJohn Marinob1: 224301e196c8SJohn Marino echo b1 224401e196c8SJohn Marino 224501e196c8SJohn Marino.Ed 224601e196c8SJohn Marinothe output is always 224701e196c8SJohn Marino.Ql a , 224801e196c8SJohn Marino.Ql b1 , 224901e196c8SJohn Marino.Ql b , 225001e196c8SJohn Marino.Ql x . 2251*6eef5f0cSAntonio Huete Jimenez.Pp 225201e196c8SJohn MarinoThe ordering imposed by 225301e196c8SJohn Marino.Ic .WAIT 225401e196c8SJohn Marinois only relevant for parallel makes. 225501e196c8SJohn Marino.El 225601e196c8SJohn Marino.Sh SPECIAL TARGETS 225701e196c8SJohn MarinoSpecial targets may not be included with other targets, i.e. they must be 225801e196c8SJohn Marinothe only target specified. 225901e196c8SJohn Marino.Bl -tag -width .BEGINx 226001e196c8SJohn Marino.It Ic .BEGIN 226101e196c8SJohn MarinoAny command lines attached to this target are executed before anything 226201e196c8SJohn Marinoelse is done. 226301e196c8SJohn Marino.It Ic .DEFAULT 226401e196c8SJohn MarinoThis is sort of a 226501e196c8SJohn Marino.Ic .USE 2266*6eef5f0cSAntonio Huete Jimenezrule for any target (that was used only as a source) that 226701e196c8SJohn Marino.Nm 226801e196c8SJohn Marinocan't figure out any other way to create. 226901e196c8SJohn MarinoOnly the shell script is used. 227001e196c8SJohn MarinoThe 2271*6eef5f0cSAntonio Huete Jimenez.Va .IMPSRC 227201e196c8SJohn Marinovariable of a target that inherits 227301e196c8SJohn Marino.Ic .DEFAULT Ns 's 2274*6eef5f0cSAntonio Huete Jimenezcommands is set to the target's own name. 2275ca58f742SDaniel Fojt.It Ic .DELETE_ON_ERROR 2276ca58f742SDaniel FojtIf this target is present in the makefile, it globally causes make to 2277ca58f742SDaniel Fojtdelete targets whose commands fail. 2278ca58f742SDaniel Fojt(By default, only targets whose commands are interrupted during 2279ca58f742SDaniel Fojtexecution are deleted. 2280ca58f742SDaniel FojtThis is the historical behavior.) 2281ca58f742SDaniel FojtThis setting can be used to help prevent half-finished or malformed 2282ca58f742SDaniel Fojttargets from being left around and corrupting future rebuilds. 228301e196c8SJohn Marino.It Ic .END 228401e196c8SJohn MarinoAny command lines attached to this target are executed after everything 2285*6eef5f0cSAntonio Huete Jimenezelse is done successfully. 228601e196c8SJohn Marino.It Ic .ERROR 228701e196c8SJohn MarinoAny command lines attached to this target are executed when another target fails. 228801e196c8SJohn MarinoThe 2289*6eef5f0cSAntonio Huete Jimenez.Va .ERROR_TARGET 229001e196c8SJohn Marinovariable is set to the target that failed. 229101e196c8SJohn MarinoSee also 2292*6eef5f0cSAntonio Huete Jimenez.Va MAKE_PRINT_VAR_ON_ERROR . 229301e196c8SJohn Marino.It Ic .IGNORE 229401e196c8SJohn MarinoMark each of the sources with the 229501e196c8SJohn Marino.Ic .IGNORE 229601e196c8SJohn Marinoattribute. 229701e196c8SJohn MarinoIf no sources are specified, this is the equivalent of specifying the 229801e196c8SJohn Marino.Fl i 229901e196c8SJohn Marinooption. 230001e196c8SJohn Marino.It Ic .INTERRUPT 230101e196c8SJohn MarinoIf 230201e196c8SJohn Marino.Nm 2303*6eef5f0cSAntonio Huete Jimenezis interrupted, the commands for this target are executed. 230401e196c8SJohn Marino.It Ic .MAIN 230501e196c8SJohn MarinoIf no target is specified when 230601e196c8SJohn Marino.Nm 2307*6eef5f0cSAntonio Huete Jimenezis invoked, this target is built. 230801e196c8SJohn Marino.It Ic .MAKEFLAGS 230901e196c8SJohn MarinoThis target provides a way to specify flags for 231001e196c8SJohn Marino.Nm 2311*6eef5f0cSAntonio Huete Jimenezat the time when the makefiles are read. 231201e196c8SJohn MarinoThe flags are as if typed to the shell, though the 231301e196c8SJohn Marino.Fl f 2314*6eef5f0cSAntonio Huete Jimenezoption has 231501e196c8SJohn Marinono effect. 231601e196c8SJohn Marino.\" XXX: NOT YET!!!! 231701e196c8SJohn Marino.\" .It Ic .NOTPARALLEL 231801e196c8SJohn Marino.\" The named targets are executed in non parallel mode. 231901e196c8SJohn Marino.\" If no targets are 2320*6eef5f0cSAntonio Huete Jimenez.\" specified, all targets are executed in non parallel mode. 232101e196c8SJohn Marino.It Ic .NOPATH 232201e196c8SJohn MarinoApply the 232301e196c8SJohn Marino.Ic .NOPATH 232401e196c8SJohn Marinoattribute to any specified sources. 232501e196c8SJohn Marino.It Ic .NOTPARALLEL 232601e196c8SJohn MarinoDisable parallel mode. 232701e196c8SJohn Marino.It Ic .NO_PARALLEL 232801e196c8SJohn MarinoSynonym for 232901e196c8SJohn Marino.Ic .NOTPARALLEL , 233001e196c8SJohn Marinofor compatibility with other pmake variants. 2331f445c897SJohn Marino.It Ic .OBJDIR 2332f445c897SJohn MarinoThe source is a new value for 2333*6eef5f0cSAntonio Huete Jimenez.Sq Va .OBJDIR . 2334f445c897SJohn MarinoIf it exists, 2335f445c897SJohn Marino.Nm 2336*6eef5f0cSAntonio Huete Jimenezchanges the current working directory to it and updates the value of 2337*6eef5f0cSAntonio Huete Jimenez.Sq Va .OBJDIR . 233801e196c8SJohn Marino.It Ic .ORDER 2339*6eef5f0cSAntonio Huete JimenezIn parallel mode, the named targets are made in sequence. 234001e196c8SJohn MarinoThis ordering does not add targets to the list of targets to be made. 2341*6eef5f0cSAntonio Huete Jimenez.Pp 234201e196c8SJohn MarinoSince the dependents of a target do not get built until the target itself 234301e196c8SJohn Marinocould be built, unless 234401e196c8SJohn Marino.Ql a 234501e196c8SJohn Marinois built by another part of the dependency graph, 234601e196c8SJohn Marinothe following is a dependency loop: 234701e196c8SJohn Marino.Bd -literal 234801e196c8SJohn Marino\&.ORDER: b a 234901e196c8SJohn Marinob: a 235001e196c8SJohn Marino.Ed 235101e196c8SJohn Marino.Pp 235201e196c8SJohn Marino.\" XXX: NOT YET!!!! 235301e196c8SJohn Marino.\" .It Ic .PARALLEL 235401e196c8SJohn Marino.\" The named targets are executed in parallel mode. 235501e196c8SJohn Marino.\" If no targets are 2356*6eef5f0cSAntonio Huete Jimenez.\" specified, all targets are executed in parallel mode. 235701e196c8SJohn Marino.It Ic .PATH 235801e196c8SJohn MarinoThe sources are directories which are to be searched for files not 235901e196c8SJohn Marinofound in the current directory. 2360*6eef5f0cSAntonio Huete JimenezIf no sources are specified, 2361*6eef5f0cSAntonio Huete Jimenezany previously specified directories are removed from the search path. 236201e196c8SJohn MarinoIf the source is the special 236301e196c8SJohn Marino.Ic .DOTLAST 2364*6eef5f0cSAntonio Huete Jimeneztarget, the current working directory is searched last. 2365*6eef5f0cSAntonio Huete Jimenez.It Ic .PATH. Ns Ar suffix 23665f1e34d9SAlexandre PerrinLike 23675f1e34d9SAlexandre Perrin.Ic .PATH 23685f1e34d9SAlexandre Perrinbut applies only to files with a particular suffix. 23695f1e34d9SAlexandre PerrinThe suffix must have been previously declared with 23705f1e34d9SAlexandre Perrin.Ic .SUFFIXES . 237101e196c8SJohn Marino.It Ic .PHONY 237201e196c8SJohn MarinoApply the 237301e196c8SJohn Marino.Ic .PHONY 237401e196c8SJohn Marinoattribute to any specified sources. 2375*6eef5f0cSAntonio Huete Jimenez.It Ic .POSIX 2376*6eef5f0cSAntonio Huete JimenezIf this is the first non-comment line in the main makefile, 2377*6eef5f0cSAntonio Huete Jimenezthe variable 2378*6eef5f0cSAntonio Huete Jimenez.Va %POSIX 2379*6eef5f0cSAntonio Huete Jimenezis set to the value 2380*6eef5f0cSAntonio Huete Jimenez.Ql 1003.2 2381*6eef5f0cSAntonio Huete Jimenezand the makefile 2382*6eef5f0cSAntonio Huete Jimenez.Ql <posix.mk> 2383*6eef5f0cSAntonio Huete Jimenezis included if it exists, 2384*6eef5f0cSAntonio Huete Jimenezto provide POSIX-compatible default rules. 2385*6eef5f0cSAntonio Huete JimenezIf 2386*6eef5f0cSAntonio Huete Jimenez.Nm 2387*6eef5f0cSAntonio Huete Jimenezis run with the 2388*6eef5f0cSAntonio Huete Jimenez.Fl r 2389*6eef5f0cSAntonio Huete Jimenezflag, only 2390*6eef5f0cSAntonio Huete Jimenez.Ql posix.mk 2391*6eef5f0cSAntonio Huete Jimenezcontributes to the default rules. 239201e196c8SJohn Marino.It Ic .PRECIOUS 239301e196c8SJohn MarinoApply the 239401e196c8SJohn Marino.Ic .PRECIOUS 239501e196c8SJohn Marinoattribute to any specified sources. 239601e196c8SJohn MarinoIf no sources are specified, the 239701e196c8SJohn Marino.Ic .PRECIOUS 2398*6eef5f0cSAntonio Huete Jimenezattribute is applied to every target in the file. 239901e196c8SJohn Marino.It Ic .SHELL 240001e196c8SJohn MarinoSets the shell that 240101e196c8SJohn Marino.Nm 2402*6eef5f0cSAntonio Huete Jimenezuses to execute commands. 240301e196c8SJohn MarinoThe sources are a set of 2404*6eef5f0cSAntonio Huete Jimenez.Ar field\| Ns Cm \&= Ns Ar value 240501e196c8SJohn Marinopairs. 2406*6eef5f0cSAntonio Huete Jimenez.Bl -tag -width ".Li hasErrCtls" 2407*6eef5f0cSAntonio Huete Jimenez.It Li name 2408f445c897SJohn MarinoThis is the minimal specification, used to select one of the built-in 240901e196c8SJohn Marinoshell specs; 2410*6eef5f0cSAntonio Huete Jimenez.Li sh , 2411*6eef5f0cSAntonio Huete Jimenez.Li ksh , 241201e196c8SJohn Marinoand 2413*6eef5f0cSAntonio Huete Jimenez.Li csh . 2414*6eef5f0cSAntonio Huete Jimenez.It Li path 2415*6eef5f0cSAntonio Huete JimenezSpecifies the absolute path to the shell. 2416*6eef5f0cSAntonio Huete Jimenez.It Li hasErrCtl 241701e196c8SJohn MarinoIndicates whether the shell supports exit on error. 2418*6eef5f0cSAntonio Huete Jimenez.It Li check 241901e196c8SJohn MarinoThe command to turn on error checking. 2420*6eef5f0cSAntonio Huete Jimenez.It Li ignore 242101e196c8SJohn MarinoThe command to disable error checking. 2422*6eef5f0cSAntonio Huete Jimenez.It Li echo 242301e196c8SJohn MarinoThe command to turn on echoing of commands executed. 2424*6eef5f0cSAntonio Huete Jimenez.It Li quiet 242501e196c8SJohn MarinoThe command to turn off echoing of commands executed. 2426*6eef5f0cSAntonio Huete Jimenez.It Li filter 242701e196c8SJohn MarinoThe output to filter after issuing the 2428*6eef5f0cSAntonio Huete Jimenez.Li quiet 242901e196c8SJohn Marinocommand. 243001e196c8SJohn MarinoIt is typically identical to 2431*6eef5f0cSAntonio Huete Jimenez.Li quiet . 2432*6eef5f0cSAntonio Huete Jimenez.It Li errFlag 243301e196c8SJohn MarinoThe flag to pass the shell to enable error checking. 2434*6eef5f0cSAntonio Huete Jimenez.It Li echoFlag 243501e196c8SJohn MarinoThe flag to pass the shell to enable command echoing. 2436*6eef5f0cSAntonio Huete Jimenez.It Li newline 243701e196c8SJohn MarinoThe string literal to pass the shell that results in a single newline 243801e196c8SJohn Marinocharacter when used outside of any quoting characters. 243901e196c8SJohn Marino.El 244001e196c8SJohn MarinoExample: 244101e196c8SJohn Marino.Bd -literal 244201e196c8SJohn Marino\&.SHELL: name=ksh path=/bin/ksh hasErrCtl=true \e 244301e196c8SJohn Marino check="set \-e" ignore="set +e" \e 244401e196c8SJohn Marino echo="set \-v" quiet="set +v" filter="set +v" \e 244501e196c8SJohn Marino echoFlag=v errFlag=e newline="'\en'" 244601e196c8SJohn Marino.Ed 244701e196c8SJohn Marino.It Ic .SILENT 244801e196c8SJohn MarinoApply the 244901e196c8SJohn Marino.Ic .SILENT 245001e196c8SJohn Marinoattribute to any specified sources. 245101e196c8SJohn MarinoIf no sources are specified, the 245201e196c8SJohn Marino.Ic .SILENT 245301e196c8SJohn Marinoattribute is applied to every 245401e196c8SJohn Marinocommand in the file. 24555f1e34d9SAlexandre Perrin.It Ic .STALE 24565f1e34d9SAlexandre PerrinThis target gets run when a dependency file contains stale entries, having 24575f1e34d9SAlexandre Perrin.Va .ALLSRC 24585f1e34d9SAlexandre Perrinset to the name of that dependency file. 245901e196c8SJohn Marino.It Ic .SUFFIXES 246001e196c8SJohn MarinoEach source specifies a suffix to 246101e196c8SJohn Marino.Nm . 246201e196c8SJohn MarinoIf no sources are specified, any previously specified suffixes are deleted. 246301e196c8SJohn MarinoIt allows the creation of suffix-transformation rules. 246401e196c8SJohn Marino.Pp 246501e196c8SJohn MarinoExample: 246601e196c8SJohn Marino.Bd -literal 246701e196c8SJohn Marino\&.SUFFIXES: .o 246801e196c8SJohn Marino\&.c.o: 246901e196c8SJohn Marino cc \-o ${.TARGET} \-c ${.IMPSRC} 247001e196c8SJohn Marino.Ed 247101e196c8SJohn Marino.El 247201e196c8SJohn Marino.Sh ENVIRONMENT 247301e196c8SJohn Marino.Nm 247401e196c8SJohn Marinouses the following environment variables, if they exist: 247501e196c8SJohn Marino.Ev MACHINE , 247601e196c8SJohn Marino.Ev MACHINE_ARCH , 247701e196c8SJohn Marino.Ev MAKE , 247801e196c8SJohn Marino.Ev MAKEFLAGS , 247901e196c8SJohn Marino.Ev MAKEOBJDIR , 248001e196c8SJohn Marino.Ev MAKEOBJDIRPREFIX , 248101e196c8SJohn Marino.Ev MAKESYSPATH , 248201e196c8SJohn Marino.Ev PWD , 248301e196c8SJohn Marinoand 248401e196c8SJohn Marino.Ev TMPDIR . 248501e196c8SJohn Marino.Pp 248601e196c8SJohn Marino.Ev MAKEOBJDIRPREFIX 248701e196c8SJohn Marinoand 248801e196c8SJohn Marino.Ev MAKEOBJDIR 248901e196c8SJohn Marinomay only be set in the environment or on the command line to 249001e196c8SJohn Marino.Nm 249101e196c8SJohn Marinoand not as makefile variables; 249201e196c8SJohn Marinosee the description of 2493*6eef5f0cSAntonio Huete Jimenez.Sq Va .OBJDIR 249401e196c8SJohn Marinofor more details. 249501e196c8SJohn Marino.Sh FILES 249601e196c8SJohn Marino.Bl -tag -width /usr/share/mk -compact 249701e196c8SJohn Marino.It .depend 249801e196c8SJohn Marinolist of dependencies 249901e196c8SJohn Marino.It Makefile 250001e196c8SJohn Marinolist of dependencies 250101e196c8SJohn Marino.It makefile 250201e196c8SJohn Marinolist of dependencies 250301e196c8SJohn Marino.It sys.mk 250401e196c8SJohn Marinosystem makefile 250501e196c8SJohn Marino.It /usr/share/mk 250601e196c8SJohn Marinosystem makefile directory 250701e196c8SJohn Marino.El 250801e196c8SJohn Marino.Sh COMPATIBILITY 2509*6eef5f0cSAntonio Huete JimenezThe basic make syntax is compatible between different make variants; 251001e196c8SJohn Marinohowever the special variables, variable modifiers and conditionals are not. 25116a91b982SJohn Marino.Ss Older versions 25126a91b982SJohn MarinoAn incomplete list of changes in older versions of 25136a91b982SJohn Marino.Nm : 251401e196c8SJohn Marino.Pp 251501e196c8SJohn MarinoThe way that .for loop variables are substituted changed after 25165f1e34d9SAlexandre Perrin.Nx 5.0 251701e196c8SJohn Marinoso that they still appear to be variable expansions. 251801e196c8SJohn MarinoIn particular this stops them being treated as syntax, and removes some 251901e196c8SJohn Marinoobscure problems using them in .if statements. 25206a91b982SJohn Marino.Pp 25216a91b982SJohn MarinoThe way that parallel makes are scheduled changed in 25226a91b982SJohn Marino.Nx 4.0 25236a91b982SJohn Marinoso that .ORDER and .WAIT apply recursively to the dependent nodes. 25246a91b982SJohn MarinoThe algorithms used may change again in the future. 25256a91b982SJohn Marino.Ss Other make dialects 25266a91b982SJohn MarinoOther make dialects (GNU make, SVR4 make, POSIX make, etc.) do not 25276a91b982SJohn Marinosupport most of the features of 25286a91b982SJohn Marino.Nm 25296a91b982SJohn Marinoas described in this manual. 25306a91b982SJohn MarinoMost notably: 25316a91b982SJohn Marino.Bl -bullet -offset indent 25326a91b982SJohn Marino.It 25336a91b982SJohn MarinoThe 25346a91b982SJohn Marino.Ic .WAIT 25356a91b982SJohn Marinoand 25366a91b982SJohn Marino.Ic .ORDER 25376a91b982SJohn Marinodeclarations and most functionality pertaining to parallelization. 25386a91b982SJohn Marino(GNU make supports parallelization but lacks these features needed to 25396a91b982SJohn Marinocontrol it effectively.) 25406a91b982SJohn Marino.It 25416a91b982SJohn MarinoDirectives, including for loops and conditionals and most of the 25426a91b982SJohn Marinoforms of include files. 25436a91b982SJohn Marino(GNU make has its own incompatible and less powerful syntax for 25446a91b982SJohn Marinoconditionals.) 25456a91b982SJohn Marino.It 25466a91b982SJohn MarinoAll built-in variables that begin with a dot. 25476a91b982SJohn Marino.It 25486a91b982SJohn MarinoMost of the special sources and targets that begin with a dot, 25496a91b982SJohn Marinowith the notable exception of 25506a91b982SJohn Marino.Ic .PHONY , 25516a91b982SJohn Marino.Ic .PRECIOUS , 25526a91b982SJohn Marinoand 25536a91b982SJohn Marino.Ic .SUFFIXES . 25546a91b982SJohn Marino.It 25556a91b982SJohn MarinoVariable modifiers, except for the 25566a91b982SJohn Marino.Dl :old=new 25576a91b982SJohn Marinostring substitution, which does not portably support globbing with 25586a91b982SJohn Marino.Ql % 25596a91b982SJohn Marinoand historically only works on declared suffixes. 25606a91b982SJohn Marino.It 25616a91b982SJohn MarinoThe 25626a91b982SJohn Marino.Ic $> 25636a91b982SJohn Marinovariable even in its short form; most makes support this functionality 25646a91b982SJohn Marinobut its name varies. 25656a91b982SJohn Marino.El 25666a91b982SJohn Marino.Pp 25676a91b982SJohn MarinoSome features are somewhat more portable, such as assignment with 25686a91b982SJohn Marino.Ic += , 25696a91b982SJohn Marino.Ic ?= , 25706a91b982SJohn Marinoand 25716a91b982SJohn Marino.Ic != . 25726a91b982SJohn MarinoThe 2573*6eef5f0cSAntonio Huete Jimenez.Va .PATH 25746a91b982SJohn Marinofunctionality is based on an older feature 25756a91b982SJohn Marino.Ic VPATH 25766a91b982SJohn Marinofound in GNU make and many versions of SVR4 make; however, 25776a91b982SJohn Marinohistorically its behavior is too ill-defined (and too buggy) to rely 25786a91b982SJohn Marinoupon. 25796a91b982SJohn Marino.Pp 25806a91b982SJohn MarinoThe 25816a91b982SJohn Marino.Ic $@ 25826a91b982SJohn Marinoand 25836a91b982SJohn Marino.Ic $< 25846a91b982SJohn Marinovariables are more or less universally portable, as is the 25856a91b982SJohn Marino.Ic $(MAKE) 25866a91b982SJohn Marinovariable. 25876a91b982SJohn MarinoBasic use of suffix rules (for files only in the current directory, 25886a91b982SJohn Marinonot trying to chain transformations together, etc.) is also reasonably 25896a91b982SJohn Marinoportable. 259001e196c8SJohn Marino.Sh SEE ALSO 259101e196c8SJohn Marino.Xr mkdep 1 259201e196c8SJohn Marino.Sh HISTORY 259301e196c8SJohn MarinoA 25945f1e34d9SAlexandre Perrin.Nm 259501e196c8SJohn Marinocommand appeared in 259601e196c8SJohn Marino.At v7 . 259701e196c8SJohn MarinoThis 25985f1e34d9SAlexandre Perrin.Nm 2599*6eef5f0cSAntonio Huete Jimenezimplementation is based on Adam de Boor's pmake program, 2600*6eef5f0cSAntonio Huete Jimenezwhich was written for Sprite at Berkeley. 260101e196c8SJohn MarinoIt was designed to be a parallel distributed make running jobs on different 260201e196c8SJohn Marinomachines using a daemon called 260301e196c8SJohn Marino.Dq customs . 26045f1e34d9SAlexandre Perrin.Pp 26055f1e34d9SAlexandre PerrinHistorically the target/dependency 2606*6eef5f0cSAntonio Huete Jimenez.Ic FRC 26075f1e34d9SAlexandre Perrinhas been used to FoRCe rebuilding (since the target/dependency 26085f1e34d9SAlexandre Perrindoes not exist... unless someone creates an 2609*6eef5f0cSAntonio Huete Jimenez.Pa FRC 26105f1e34d9SAlexandre Perrinfile). 261101e196c8SJohn Marino.Sh BUGS 261201e196c8SJohn MarinoThe 26135f1e34d9SAlexandre Perrin.Nm 2614ca58f742SDaniel Fojtsyntax is difficult to parse without actually acting on the data. 2615ca58f742SDaniel FojtFor instance, finding the end of a variable's use should involve scanning 2616ca58f742SDaniel Fojteach of the modifiers, using the correct terminator for each field. 261701e196c8SJohn MarinoIn many places 26185f1e34d9SAlexandre Perrin.Nm 261901e196c8SJohn Marinojust counts {} and () in order to find the end of a variable expansion. 262001e196c8SJohn Marino.Pp 262101e196c8SJohn MarinoThere is no way of escaping a space character in a filename. 2622