1*c59c3bf3SSimon J. Gerraty.\" $NetBSD: make.1,v 1.375 2024/03/10 02:53:37 sjg Exp $ 23955d011SMarcel Moolenaar.\" 33955d011SMarcel Moolenaar.\" Copyright (c) 1990, 1993 43955d011SMarcel Moolenaar.\" The Regents of the University of California. All rights reserved. 53955d011SMarcel Moolenaar.\" 63955d011SMarcel Moolenaar.\" Redistribution and use in source and binary forms, with or without 73955d011SMarcel Moolenaar.\" modification, are permitted provided that the following conditions 83955d011SMarcel Moolenaar.\" are met: 93955d011SMarcel Moolenaar.\" 1. Redistributions of source code must retain the above copyright 103955d011SMarcel Moolenaar.\" notice, this list of conditions and the following disclaimer. 113955d011SMarcel Moolenaar.\" 2. Redistributions in binary form must reproduce the above copyright 123955d011SMarcel Moolenaar.\" notice, this list of conditions and the following disclaimer in the 133955d011SMarcel Moolenaar.\" documentation and/or other materials provided with the distribution. 143955d011SMarcel Moolenaar.\" 3. Neither the name of the University nor the names of its contributors 153955d011SMarcel Moolenaar.\" may be used to endorse or promote products derived from this software 163955d011SMarcel Moolenaar.\" without specific prior written permission. 173955d011SMarcel Moolenaar.\" 183955d011SMarcel Moolenaar.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 193955d011SMarcel Moolenaar.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 203955d011SMarcel Moolenaar.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 213955d011SMarcel Moolenaar.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 223955d011SMarcel Moolenaar.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 233955d011SMarcel Moolenaar.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 243955d011SMarcel Moolenaar.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 253955d011SMarcel Moolenaar.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 263955d011SMarcel Moolenaar.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 273955d011SMarcel Moolenaar.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 283955d011SMarcel Moolenaar.\" SUCH DAMAGE. 293955d011SMarcel Moolenaar.\" 303955d011SMarcel Moolenaar.\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 313955d011SMarcel Moolenaar.\" 32*c59c3bf3SSimon J. Gerraty.Dd March 9, 2024 3345447996SSimon J. Gerraty.Dt BMAKE 1 343955d011SMarcel Moolenaar.Os 353955d011SMarcel Moolenaar.Sh NAME 363955d011SMarcel Moolenaar.Nm bmake 373955d011SMarcel Moolenaar.Nd maintain program dependencies 383955d011SMarcel Moolenaar.Sh SYNOPSIS 393955d011SMarcel Moolenaar.Nm 40e2eeea75SSimon J. Gerraty.Op Fl BeikNnqrSstWwX 413955d011SMarcel Moolenaar.Op Fl C Ar directory 423955d011SMarcel Moolenaar.Op Fl D Ar variable 433955d011SMarcel Moolenaar.Op Fl d Ar flags 443955d011SMarcel Moolenaar.Op Fl f Ar makefile 453955d011SMarcel Moolenaar.Op Fl I Ar directory 463955d011SMarcel Moolenaar.Op Fl J Ar private 473955d011SMarcel Moolenaar.Op Fl j Ar max_jobs 483955d011SMarcel Moolenaar.Op Fl m Ar directory 493955d011SMarcel Moolenaar.Op Fl T Ar file 503955d011SMarcel Moolenaar.Op Fl V Ar variable 518695518cSSimon J. Gerraty.Op Fl v Ar variable 524fde40d9SSimon J. Gerraty.Op Ar variable\| Ns Cm \&= Ns Ar value 534fde40d9SSimon J. Gerraty.Op Ar target No ... 543955d011SMarcel Moolenaar.Sh DESCRIPTION 553955d011SMarcel Moolenaar.Nm 563955d011SMarcel Moolenaaris a program designed to simplify the maintenance of other programs. 573955d011SMarcel MoolenaarIts input is a list of specifications as to the files upon which programs 583955d011SMarcel Moolenaarand other files depend. 593955d011SMarcel MoolenaarIf no 603955d011SMarcel Moolenaar.Fl f Ar makefile 614fde40d9SSimon J. Gerratyoption is given, 623955d011SMarcel Moolenaar.Nm 634fde40d9SSimon J. Gerratytries to open 64954401e6SSimon J. Gerraty.Sq Pa makefile 653955d011SMarcel Moolenaarthen 66954401e6SSimon J. Gerraty.Sq Pa Makefile 673955d011SMarcel Moolenaarin order to find the specifications. 683955d011SMarcel MoolenaarIf the file 69954401e6SSimon J. Gerraty.Sq Pa .depend 704fde40d9SSimon J. Gerratyexists, it is read, see 714fde40d9SSimon J. Gerraty.Xr mkdep 1 . 723955d011SMarcel Moolenaar.Pp 733955d011SMarcel MoolenaarThis manual page is intended as a reference document only. 743955d011SMarcel MoolenaarFor a more thorough description of 753955d011SMarcel Moolenaar.Nm 763955d011SMarcel Moolenaarand makefiles, please refer to 774fde40d9SSimon J. Gerraty.%T "PMake \- A Tutorial" 784fde40d9SSimon J. Gerraty(from 1993). 793955d011SMarcel Moolenaar.Pp 803955d011SMarcel Moolenaar.Nm 814fde40d9SSimon J. Gerratyprepends the contents of the 824fde40d9SSimon J. Gerraty.Ev MAKEFLAGS 833955d011SMarcel Moolenaarenvironment variable to the command line arguments before parsing them. 843955d011SMarcel Moolenaar.Pp 853955d011SMarcel MoolenaarThe options are as follows: 863955d011SMarcel Moolenaar.Bl -tag -width Ds 873955d011SMarcel Moolenaar.It Fl B 883955d011SMarcel MoolenaarTry to be backwards compatible by executing a single shell per command and 894fde40d9SSimon J. Gerratyby making the sources of a dependency line in sequence. 903955d011SMarcel Moolenaar.It Fl C Ar directory 913955d011SMarcel MoolenaarChange to 923955d011SMarcel Moolenaar.Ar directory 933955d011SMarcel Moolenaarbefore reading the makefiles or doing anything else. 943955d011SMarcel MoolenaarIf multiple 953955d011SMarcel Moolenaar.Fl C 963955d011SMarcel Moolenaaroptions are specified, each is interpreted relative to the previous one: 973955d011SMarcel Moolenaar.Fl C Pa / Fl C Pa etc 983955d011SMarcel Moolenaaris equivalent to 993955d011SMarcel Moolenaar.Fl C Pa /etc . 1003955d011SMarcel Moolenaar.It Fl D Ar variable 1013955d011SMarcel MoolenaarDefine 1023955d011SMarcel Moolenaar.Ar variable 103dba7b0efSSimon J. Gerratyto be 1, in the global scope. 1044fde40d9SSimon J. Gerraty.It Fl d Oo Cm \- Oc Ns Ar flags 1053955d011SMarcel MoolenaarTurn on debugging, and specify which portions of 1063955d011SMarcel Moolenaar.Nm 1073955d011SMarcel Moolenaarare to print debugging information. 1083955d011SMarcel MoolenaarUnless the flags are preceded by 1094fde40d9SSimon J. Gerraty.Ql \- , 1103955d011SMarcel Moolenaarthey are added to the 1114fde40d9SSimon J. Gerraty.Ev MAKEFLAGS 1124fde40d9SSimon J. Gerratyenvironment variable and are passed on to any child make processes. 1133955d011SMarcel MoolenaarBy default, debugging information is printed to standard error, 1143955d011SMarcel Moolenaarbut this can be changed using the 1154fde40d9SSimon J. Gerraty.Cm F 1163955d011SMarcel Moolenaardebugging flag. 1173955d011SMarcel MoolenaarThe debugging output is always unbuffered; in addition, if debugging 1183955d011SMarcel Moolenaaris enabled but debugging output is not directed to standard output, 1194fde40d9SSimon J. Gerratythe standard output is line buffered. 1204fde40d9SSimon J. GerratyThe available 1214fde40d9SSimon J. Gerraty.Ar flags 1224fde40d9SSimon J. Gerratyare: 1233955d011SMarcel Moolenaar.Bl -tag -width Ds 1244fde40d9SSimon J. Gerraty.It Cm A 1253955d011SMarcel MoolenaarPrint all possible debugging information; 1263955d011SMarcel Moolenaarequivalent to specifying all of the debugging flags. 1274fde40d9SSimon J. Gerraty.It Cm a 1283955d011SMarcel MoolenaarPrint debugging information about archive searching and caching. 1294fde40d9SSimon J. Gerraty.It Cm C 1304fde40d9SSimon J. GerratyPrint debugging information about the current working directory. 1314fde40d9SSimon J. Gerraty.It Cm c 1323955d011SMarcel MoolenaarPrint debugging information about conditional evaluation. 1334fde40d9SSimon J. Gerraty.It Cm d 1343955d011SMarcel MoolenaarPrint debugging information about directory searching and caching. 1354fde40d9SSimon J. Gerraty.It Cm e 1363955d011SMarcel MoolenaarPrint debugging information about failed commands and targets. 1374fde40d9SSimon J. Gerraty.It Cm F Ns Oo Cm \&+ Oc Ns Ar filename 1383955d011SMarcel MoolenaarSpecify where debugging output is written. 1393955d011SMarcel MoolenaarThis must be the last flag, because it consumes the remainder of 1403955d011SMarcel Moolenaarthe argument. 1413955d011SMarcel MoolenaarIf the character immediately after the 1424fde40d9SSimon J. Gerraty.Cm F 1433955d011SMarcel Moolenaarflag is 1443955d011SMarcel Moolenaar.Ql \&+ , 1454fde40d9SSimon J. Gerratythe file is opened in append mode; 1464fde40d9SSimon J. Gerratyotherwise the file is overwritten. 1473955d011SMarcel MoolenaarIf the file name is 1483955d011SMarcel Moolenaar.Ql stdout 1493955d011SMarcel Moolenaaror 1504fde40d9SSimon J. Gerraty.Ql stderr , 1514fde40d9SSimon J. Gerratydebugging output is written to the standard output or standard error output 1524fde40d9SSimon J. Gerratyrespectively (and the 1533955d011SMarcel Moolenaar.Ql \&+ 1543955d011SMarcel Moolenaaroption has no effect). 1554fde40d9SSimon J. GerratyOtherwise, the output is written to the named file. 1564fde40d9SSimon J. GerratyIf the file name ends with 1574fde40d9SSimon J. Gerraty.Ql .%d , 1584fde40d9SSimon J. Gerratythe 1593955d011SMarcel Moolenaar.Ql %d 1603955d011SMarcel Moolenaaris replaced by the pid. 1614fde40d9SSimon J. Gerraty.It Cm f 1623955d011SMarcel MoolenaarPrint debugging information about loop evaluation. 1634fde40d9SSimon J. Gerraty.It Cm g1 1643955d011SMarcel MoolenaarPrint the input graph before making anything. 1654fde40d9SSimon J. Gerraty.It Cm g2 1663955d011SMarcel MoolenaarPrint the input graph after making everything, or before exiting 1673955d011SMarcel Moolenaaron error. 1684fde40d9SSimon J. Gerraty.It Cm g3 1693955d011SMarcel MoolenaarPrint the input graph before exiting on error. 1704fde40d9SSimon J. Gerraty.It Cm h 1712c3632d1SSimon J. GerratyPrint debugging information about hash table operations. 1724fde40d9SSimon J. Gerraty.It Cm j 1733955d011SMarcel MoolenaarPrint debugging information about running multiple shells. 1744fde40d9SSimon J. Gerraty.It Cm L 1752c3632d1SSimon J. GerratyTurn on lint checks. 1764fde40d9SSimon J. GerratyThis throws errors for variable assignments that do not parse correctly, 1774fde40d9SSimon J. Gerratyat the time of assignment, so the file and line number are available. 1784fde40d9SSimon J. Gerraty.It Cm l 1793955d011SMarcel MoolenaarPrint commands in Makefiles regardless of whether or not they are prefixed by 1803955d011SMarcel Moolenaar.Ql @ 1814fde40d9SSimon J. Gerratyor other 1824fde40d9SSimon J. Gerraty.Dq quiet 1834fde40d9SSimon J. Gerratyflags. 1844fde40d9SSimon J. GerratyAlso known as 1854fde40d9SSimon J. Gerraty.Dq loud 1864fde40d9SSimon J. Gerratybehavior. 1874fde40d9SSimon J. Gerraty.It Cm M 1884fde40d9SSimon J. GerratyPrint debugging information about 1894fde40d9SSimon J. Gerraty.Dq meta 1904fde40d9SSimon J. Gerratymode decisions about targets. 1914fde40d9SSimon J. Gerraty.It Cm m 1923955d011SMarcel MoolenaarPrint debugging information about making targets, including modification 1933955d011SMarcel Moolenaardates. 1944fde40d9SSimon J. Gerraty.It Cm n 1953955d011SMarcel MoolenaarDon't delete the temporary command scripts created when running commands. 1963955d011SMarcel MoolenaarThese temporary scripts are created in the directory 1973955d011SMarcel Moolenaarreferred to by the 1983955d011SMarcel Moolenaar.Ev TMPDIR 1993955d011SMarcel Moolenaarenvironment variable, or in 2003955d011SMarcel Moolenaar.Pa /tmp 2013955d011SMarcel Moolenaarif 2023955d011SMarcel Moolenaar.Ev TMPDIR 2033955d011SMarcel Moolenaaris unset or set to the empty string. 2043955d011SMarcel MoolenaarThe temporary scripts are created by 2053955d011SMarcel Moolenaar.Xr mkstemp 3 , 2063955d011SMarcel Moolenaarand have names of the form 2073955d011SMarcel Moolenaar.Pa makeXXXXXX . 2083955d011SMarcel Moolenaar.Em NOTE : 2093955d011SMarcel MoolenaarThis can create many files in 2103955d011SMarcel Moolenaar.Ev TMPDIR 2113955d011SMarcel Moolenaaror 2123955d011SMarcel Moolenaar.Pa /tmp , 2133955d011SMarcel Moolenaarso use with care. 2144fde40d9SSimon J. Gerraty.It Cm p 2153955d011SMarcel MoolenaarPrint debugging information about makefile parsing. 2164fde40d9SSimon J. Gerraty.It Cm s 2173955d011SMarcel MoolenaarPrint debugging information about suffix-transformation rules. 2184fde40d9SSimon J. Gerraty.It Cm t 2193955d011SMarcel MoolenaarPrint debugging information about target list maintenance. 2204fde40d9SSimon J. Gerraty.It Cm V 2213955d011SMarcel MoolenaarForce the 2223955d011SMarcel Moolenaar.Fl V 2234fde40d9SSimon J. Gerratyoption to print raw values of variables, 2244fde40d9SSimon J. Gerratyoverriding the default behavior set via 2258695518cSSimon J. Gerraty.Va .MAKE.EXPAND_VARIABLES . 2264fde40d9SSimon J. Gerraty.It Cm v 2274fde40d9SSimon J. GerratyPrint debugging information about variable assignment and expansion. 2284fde40d9SSimon J. Gerraty.It Cm x 2293955d011SMarcel MoolenaarRun shell commands with 2303955d011SMarcel Moolenaar.Fl x 2313955d011SMarcel Moolenaarso the actual commands are printed as they are executed. 2323955d011SMarcel Moolenaar.El 2333955d011SMarcel Moolenaar.It Fl e 2344fde40d9SSimon J. GerratyLet environment variables override global variables within makefiles. 2353955d011SMarcel Moolenaar.It Fl f Ar makefile 2363955d011SMarcel MoolenaarSpecify a makefile to read instead of the default 2374fde40d9SSimon J. Gerraty.Pa makefile 2384fde40d9SSimon J. Gerratyor 2394fde40d9SSimon J. Gerraty.Pa Makefile . 2403955d011SMarcel MoolenaarIf 2413955d011SMarcel Moolenaar.Ar makefile 2423955d011SMarcel Moolenaaris 2434fde40d9SSimon J. Gerraty.Ql \&- , 2443955d011SMarcel Moolenaarstandard input is read. 2453955d011SMarcel MoolenaarMultiple makefiles may be specified, and are read in the order specified. 2463955d011SMarcel Moolenaar.It Fl I Ar directory 2473955d011SMarcel MoolenaarSpecify a directory in which to search for makefiles and included makefiles. 2483955d011SMarcel MoolenaarThe system makefile directory (or directories, see the 2493955d011SMarcel Moolenaar.Fl m 2503955d011SMarcel Moolenaaroption) is automatically included as part of this list. 2513955d011SMarcel Moolenaar.It Fl i 2523955d011SMarcel MoolenaarIgnore non-zero exit of shell commands in the makefile. 2533955d011SMarcel MoolenaarEquivalent to specifying 2544fde40d9SSimon J. Gerraty.Ql \&- 2553955d011SMarcel Moolenaarbefore each command line in the makefile. 2563955d011SMarcel Moolenaar.It Fl J Ar private 2573955d011SMarcel MoolenaarThis option should 2583955d011SMarcel Moolenaar.Em not 2593955d011SMarcel Moolenaarbe specified by the user. 2603955d011SMarcel Moolenaar.Pp 2613955d011SMarcel MoolenaarWhen the 262954401e6SSimon J. Gerraty.Fl j 2633955d011SMarcel Moolenaaroption is in use in a recursive build, this option is passed by a make 2643955d011SMarcel Moolenaarto child makes to allow all the make processes in the build to 2653955d011SMarcel Moolenaarcooperate to avoid overloading the system. 2663955d011SMarcel Moolenaar.It Fl j Ar max_jobs 2673955d011SMarcel MoolenaarSpecify the maximum number of jobs that 2683955d011SMarcel Moolenaar.Nm 2693955d011SMarcel Moolenaarmay have running at any one time. 27098875883SSimon J. GerratyIf 27198875883SSimon J. Gerraty.Ar max_jobs 27298875883SSimon J. Gerratyis a floating point number, or ends with 27398875883SSimon J. Gerraty.Ql C , 27498875883SSimon J. Gerratythen the value is multiplied by the number of CPUs reported online by 27598875883SSimon J. Gerraty.Xr sysconf 3 . 2768c973ee2SSimon J. GerratyThe value of 2778c973ee2SSimon J. Gerraty.Ar max_jobs 2788c973ee2SSimon J. Gerratyis saved in 2793955d011SMarcel Moolenaar.Va .MAKE.JOBS . 2803955d011SMarcel MoolenaarTurns compatibility mode off, unless the 281954401e6SSimon J. Gerraty.Fl B 282954401e6SSimon J. Gerratyoption is also specified. 2833955d011SMarcel MoolenaarWhen compatibility mode is off, all commands associated with a 2843955d011SMarcel Moolenaartarget are executed in a single shell invocation as opposed to the 2853955d011SMarcel Moolenaartraditional one shell invocation per line. 2863955d011SMarcel MoolenaarThis can break traditional scripts which change directories on each 2873955d011SMarcel Moolenaarcommand invocation and then expect to start with a fresh environment 2883955d011SMarcel Moolenaaron the next line. 2893955d011SMarcel MoolenaarIt is more efficient to correct the scripts rather than turn backwards 2903955d011SMarcel Moolenaarcompatibility on. 2918c973ee2SSimon J. Gerraty.Pp 2928c973ee2SSimon J. GerratyA job token pool with 2938c973ee2SSimon J. Gerraty.Ar max_jobs 2948c973ee2SSimon J. Gerratytokens is used to control the total number of jobs running. 2958c973ee2SSimon J. GerratyEach instance of 2968c973ee2SSimon J. Gerraty.Nm 2978c973ee2SSimon J. Gerratywill wait for a token from the pool before running a new job. 2983955d011SMarcel Moolenaar.It Fl k 2993955d011SMarcel MoolenaarContinue processing after errors are encountered, but only on those targets 3003955d011SMarcel Moolenaarthat do not depend on the target whose creation caused the error. 3013955d011SMarcel Moolenaar.It Fl m Ar directory 3024fde40d9SSimon J. GerratySpecify a directory in which to search for 3034fde40d9SSimon J. Gerraty.Pa sys.mk 3044fde40d9SSimon J. Gerratyand makefiles included via the 305ef0b2538SSimon J. Gerraty.Li \&< Ns Ar file Ns Li \&> Ns -style 3063955d011SMarcel Moolenaarinclude statement. 3073955d011SMarcel MoolenaarThe 3083955d011SMarcel Moolenaar.Fl m 3093955d011SMarcel Moolenaaroption can be used multiple times to form a search path. 3104fde40d9SSimon J. GerratyThis path overrides the default system include path 3114fde40d9SSimon J. Gerraty.Pa /usr/share/mk . 3124fde40d9SSimon J. GerratyFurthermore, the system include path is appended to the search path used for 313ef0b2538SSimon J. Gerraty.Li \*q Ns Ar file Ns Li \*q Ns -style 3143955d011SMarcel Moolenaarinclude statements (see the 3153955d011SMarcel Moolenaar.Fl I 3163955d011SMarcel Moolenaaroption). 3174fde40d9SSimon J. GerratyThe system include path can be referenced via the read-only variable 3184fde40d9SSimon J. Gerraty.Va .SYSPATH . 3193955d011SMarcel Moolenaar.Pp 3204fde40d9SSimon J. GerratyIf a directory name in the 3213955d011SMarcel Moolenaar.Fl m 3223955d011SMarcel Moolenaarargument (or the 3233955d011SMarcel Moolenaar.Ev MAKESYSPATH 3243955d011SMarcel Moolenaarenvironment variable) starts with the string 3254fde40d9SSimon J. Gerraty.Ql \&.../ , 3263955d011SMarcel Moolenaar.Nm 3274fde40d9SSimon J. Gerratysearches for the specified file or directory named in the remaining part 3283955d011SMarcel Moolenaarof the argument string. 3294fde40d9SSimon J. GerratyThe search starts with the current directory 3304fde40d9SSimon J. Gerratyand then works upward towards the root of the file system. 3314fde40d9SSimon J. GerratyIf the search is successful, the resulting directory replaces the 3324fde40d9SSimon J. Gerraty.Ql \&.../ 3333955d011SMarcel Moolenaarspecification in the 3343955d011SMarcel Moolenaar.Fl m 3353955d011SMarcel Moolenaarargument. 3364fde40d9SSimon J. GerratyThis feature allows 3373955d011SMarcel Moolenaar.Nm 3384fde40d9SSimon J. Gerratyto easily search in the current source tree for customized 3394fde40d9SSimon J. Gerraty.Pa sys.mk 3404fde40d9SSimon J. Gerratyfiles (e.g., by using 3414fde40d9SSimon J. Gerraty.Ql \&.../mk/sys.mk 3423955d011SMarcel Moolenaaras an argument). 3433955d011SMarcel Moolenaar.It Fl n 3443955d011SMarcel MoolenaarDisplay the commands that would have been executed, but do not 3454fde40d9SSimon J. Gerratyactually execute them unless the target depends on the 3464fde40d9SSimon J. Gerraty.Va .MAKE 3474fde40d9SSimon J. Gerratyspecial source (see below) or the command is prefixed with 3484fde40d9SSimon J. Gerraty.Sq Cm + . 3493955d011SMarcel Moolenaar.It Fl N 3504fde40d9SSimon J. GerratyDisplay the commands that would have been executed, 3514fde40d9SSimon J. Gerratybut do not actually execute any of them; 3524fde40d9SSimon J. Gerratyuseful for debugging top-level makefiles 3533955d011SMarcel Moolenaarwithout descending into subdirectories. 3543955d011SMarcel Moolenaar.It Fl q 3554fde40d9SSimon J. GerratyDo not execute any commands, 3564fde40d9SSimon J. Gerratyinstead exit 0 if the specified targets are up to date, and 1 otherwise. 3573955d011SMarcel Moolenaar.It Fl r 3583955d011SMarcel MoolenaarDo not use the built-in rules specified in the system makefile. 359e2eeea75SSimon J. Gerraty.It Fl S 360e2eeea75SSimon J. GerratyStop processing if an error is encountered. 361e2eeea75SSimon J. GerratyThis is the default behavior and the opposite of 362e2eeea75SSimon J. Gerraty.Fl k . 3633955d011SMarcel Moolenaar.It Fl s 3643955d011SMarcel MoolenaarDo not echo any commands as they are executed. 3653955d011SMarcel MoolenaarEquivalent to specifying 366954401e6SSimon J. Gerraty.Sq Ic @ 3673955d011SMarcel Moolenaarbefore each command line in the makefile. 3683955d011SMarcel Moolenaar.It Fl T Ar tracefile 3693955d011SMarcel MoolenaarWhen used with the 3703955d011SMarcel Moolenaar.Fl j 3713955d011SMarcel Moolenaarflag, 3723955d011SMarcel Moolenaarappend a trace record to 3733955d011SMarcel Moolenaar.Ar tracefile 3743955d011SMarcel Moolenaarfor each job started and completed. 3753955d011SMarcel Moolenaar.It Fl t 3763955d011SMarcel MoolenaarRather than re-building a target as specified in the makefile, create it 3773955d011SMarcel Moolenaaror update its modification time to make it appear up-to-date. 3783955d011SMarcel Moolenaar.It Fl V Ar variable 3798695518cSSimon J. GerratyPrint the value of 3808695518cSSimon J. Gerraty.Ar variable . 3813955d011SMarcel MoolenaarDo not build any targets. 3823955d011SMarcel MoolenaarMultiple instances of this option may be specified; 3834fde40d9SSimon J. Gerratythe variables are printed one per line, 3843955d011SMarcel Moolenaarwith a blank line for each null or undefined variable. 385dba7b0efSSimon J. GerratyThe value printed is extracted from the global scope after all 3868695518cSSimon J. Gerratymakefiles have been read. 3874fde40d9SSimon J. Gerraty.Pp 3888695518cSSimon J. GerratyBy default, the raw variable contents (which may 3898695518cSSimon J. Gerratyinclude additional unexpanded variable references) are shown. 3903955d011SMarcel MoolenaarIf 3913955d011SMarcel Moolenaar.Ar variable 3923955d011SMarcel Moolenaarcontains a 3934fde40d9SSimon J. Gerraty.Ql \&$ , 3944fde40d9SSimon J. Gerratyit is not interpreted as a variable name but rather as an expression. 3954fde40d9SSimon J. GerratyIts value is expanded before printing. 3964fde40d9SSimon J. GerratyThe value is also expanded before printing if 3978695518cSSimon J. Gerraty.Va .MAKE.EXPAND_VARIABLES 3984fde40d9SSimon J. Gerratyis set to true and the 3998695518cSSimon J. Gerraty.Fl dV 4008695518cSSimon J. Gerratyoption has not been used to override it. 4014fde40d9SSimon J. Gerraty.Pp 4028695518cSSimon J. GerratyNote that loop-local and target-local variables, as well as values 4038695518cSSimon J. Gerratytaken temporarily by global variables during makefile processing, are 4048695518cSSimon J. Gerratynot accessible via this option. 4058695518cSSimon J. GerratyThe 4068695518cSSimon J. Gerraty.Fl dv 4078695518cSSimon J. Gerratydebug mode can be used to see these at the cost of generating 4088695518cSSimon J. Gerratysubstantial extraneous output. 4098695518cSSimon J. Gerraty.It Fl v Ar variable 4108695518cSSimon J. GerratyLike 4114fde40d9SSimon J. Gerraty.Fl V , 4124fde40d9SSimon J. Gerratybut all printed variables are always expanded to their complete value. 4134fde40d9SSimon J. GerratyThe last occurrence of 4148695518cSSimon J. Gerraty.Fl V 4154fde40d9SSimon J. Gerratyor 4164fde40d9SSimon J. Gerraty.Fl v 4174fde40d9SSimon J. Gerratydecides whether all variables are expanded or not. 4183955d011SMarcel Moolenaar.It Fl W 4193955d011SMarcel MoolenaarTreat any warnings during makefile parsing as errors. 420db29cad8SSimon J. Gerraty.It Fl w 421db29cad8SSimon J. GerratyPrint entering and leaving directory messages, pre and post processing. 4223955d011SMarcel Moolenaar.It Fl X 4233955d011SMarcel MoolenaarDon't export variables passed on the command line to the environment 4243955d011SMarcel Moolenaarindividually. 4254fde40d9SSimon J. GerratyVariables passed on the command line are still exported via the 4264fde40d9SSimon J. Gerraty.Ev MAKEFLAGS 4273955d011SMarcel Moolenaarenvironment variable. 4283955d011SMarcel MoolenaarThis option may be useful on systems which have a small limit on the 4293955d011SMarcel Moolenaarsize of command arguments. 4304fde40d9SSimon J. Gerraty.It Ar variable\| Ns Cm \&= Ns Ar value 4313955d011SMarcel MoolenaarSet the value of the variable 4323955d011SMarcel Moolenaar.Ar variable 4333955d011SMarcel Moolenaarto 4343955d011SMarcel Moolenaar.Ar value . 4353955d011SMarcel MoolenaarNormally, all values passed on the command line are also exported to 4363955d011SMarcel Moolenaarsub-makes in the environment. 4373955d011SMarcel MoolenaarThe 4383955d011SMarcel Moolenaar.Fl X 4393955d011SMarcel Moolenaarflag disables this behavior. 4403955d011SMarcel MoolenaarVariable assignments should follow options for POSIX compatibility 4413955d011SMarcel Moolenaarbut no ordering is enforced. 4423955d011SMarcel Moolenaar.El 4433955d011SMarcel Moolenaar.Pp 4444fde40d9SSimon J. GerratyThere are several different types of lines in a makefile: dependency 4453955d011SMarcel Moolenaarspecifications, shell commands, variable assignments, include statements, 4464fde40d9SSimon J. Gerratyconditional directives, for loops, other directives, and comments. 4473955d011SMarcel Moolenaar.Pp 4484fde40d9SSimon J. GerratyLines may be continued from one line to the next 4494fde40d9SSimon J. Gerratyby ending them with a backslash 4503955d011SMarcel Moolenaar.Pq Ql \e . 4513955d011SMarcel MoolenaarThe trailing newline character and initial whitespace on the following 4523955d011SMarcel Moolenaarline are compressed into a single space. 4533955d011SMarcel Moolenaar.Sh FILE DEPENDENCY SPECIFICATIONS 4543955d011SMarcel MoolenaarDependency lines consist of one or more targets, an operator, and zero 4553955d011SMarcel Moolenaaror more sources. 4563955d011SMarcel MoolenaarThis creates a relationship where the targets 4573955d011SMarcel Moolenaar.Dq depend 4584fde40d9SSimon J. Gerratyon the sources and are customarily created from them. 4594fde40d9SSimon J. GerratyA target is considered out of date if it does not exist, 4604fde40d9SSimon J. Gerratyor if its modification time is less than that of any of its sources. 4614fde40d9SSimon J. GerratyAn out-of-date target is re-created, but not until all sources 4622c3632d1SSimon J. Gerratyhave been examined and themselves re-created as needed. 4632c3632d1SSimon J. GerratyThree operators may be used: 4643955d011SMarcel Moolenaar.Bl -tag -width flag 4653955d011SMarcel Moolenaar.It Ic \&: 4662c3632d1SSimon J. GerratyMany dependency lines may name this target but only one may have 4672c3632d1SSimon J. Gerratyattached shell commands. 4682c3632d1SSimon J. GerratyAll sources named in all dependency lines are considered together, 4692c3632d1SSimon J. Gerratyand if needed the attached shell commands are run to create or 4702c3632d1SSimon J. Gerratyre-create the target. 4712c3632d1SSimon J. GerratyIf 4723955d011SMarcel Moolenaar.Nm 4732c3632d1SSimon J. Gerratyis interrupted, the target is removed. 4743955d011SMarcel Moolenaar.It Ic \&! 4752c3632d1SSimon J. GerratyThe same, but the target is always re-created whether or not it is out 4762c3632d1SSimon J. Gerratyof date. 4773955d011SMarcel Moolenaar.It Ic \&:: 4782c3632d1SSimon J. GerratyAny dependency line may have attached shell commands, but each one 4792c3632d1SSimon J. Gerratyis handled independently: its sources are considered and the attached 4802c3632d1SSimon J. Gerratyshell commands are run if the target is out of date with respect to 4812c3632d1SSimon J. Gerraty(only) those sources. 4822c3632d1SSimon J. GerratyThus, different groups of the attached shell commands may be run 4832c3632d1SSimon J. Gerratydepending on the circumstances. 4842c3632d1SSimon J. GerratyFurthermore, unlike 4852c3632d1SSimon J. Gerraty.Ic \&: , 4862c3632d1SSimon J. Gerratyfor dependency lines with no sources, the attached shell 4872c3632d1SSimon J. Gerratycommands are always run. 4882c3632d1SSimon J. GerratyAlso unlike 4892c3632d1SSimon J. Gerraty.Ic \&: , 4904fde40d9SSimon J. Gerratythe target is not removed if 4913955d011SMarcel Moolenaar.Nm 4923955d011SMarcel Moolenaaris interrupted. 4933955d011SMarcel Moolenaar.El 4944fde40d9SSimon J. Gerraty.Pp 4952c3632d1SSimon J. GerratyAll dependency lines mentioning a particular target must use the same 4962c3632d1SSimon J. Gerratyoperator. 4973955d011SMarcel Moolenaar.Pp 4983955d011SMarcel MoolenaarTargets and sources may contain the shell wildcard values 4993955d011SMarcel Moolenaar.Ql \&? , 5003955d011SMarcel Moolenaar.Ql * , 5013955d011SMarcel Moolenaar.Ql [] , 5023955d011SMarcel Moolenaarand 5033955d011SMarcel Moolenaar.Ql {} . 5043955d011SMarcel MoolenaarThe values 5053955d011SMarcel Moolenaar.Ql \&? , 5063955d011SMarcel Moolenaar.Ql * , 5073955d011SMarcel Moolenaarand 5083955d011SMarcel Moolenaar.Ql [] 5094fde40d9SSimon J. Gerratymay only be used as part of the final component of the target or source, 5104fde40d9SSimon J. Gerratyand only match existing files. 5113955d011SMarcel MoolenaarThe value 5123955d011SMarcel Moolenaar.Ql {} 5133955d011SMarcel Moolenaarneed not necessarily be used to describe existing files. 5143955d011SMarcel MoolenaarExpansion is in directory order, not alphabetically as done in the shell. 5153955d011SMarcel Moolenaar.Sh SHELL COMMANDS 5164fde40d9SSimon J. GerratyEach target may have associated with it one or more lines of shell commands, 5174fde40d9SSimon J. Gerratynormally used to create the target. 518db29cad8SSimon J. GerratyEach of the lines in this script 5193955d011SMarcel Moolenaar.Em must 5203955d011SMarcel Moolenaarbe preceded by a tab. 521db29cad8SSimon J. Gerraty(For historical reasons, spaces are not accepted.) 5224fde40d9SSimon J. GerratyWhile targets can occur in many dependency lines if desired, 5234fde40d9SSimon J. Gerratyby default only one of these rules may be followed by a creation script. 524db29cad8SSimon J. GerratyIf the 525954401e6SSimon J. Gerraty.Sq Ic \&:: 5264fde40d9SSimon J. Gerratyoperator is used, however, all rules may include scripts, 5274fde40d9SSimon J. Gerratyand the respective scripts are executed in the order found. 5283955d011SMarcel Moolenaar.Pp 5294fde40d9SSimon J. GerratyEach line is treated as a separate shell command, 5304fde40d9SSimon J. Gerratyunless the end of line is escaped with a backslash 5314fde40d9SSimon J. Gerraty.Ql \e , 532db29cad8SSimon J. Gerratyin which case that line and the next are combined. 533db29cad8SSimon J. GerratyIf the first characters of the command are any combination of 534954401e6SSimon J. Gerraty.Sq Ic @ , 535954401e6SSimon J. Gerraty.Sq Ic + , 5363955d011SMarcel Moolenaaror 537954401e6SSimon J. Gerraty.Sq Ic \- , 5383955d011SMarcel Moolenaarthe command is treated specially. 5394fde40d9SSimon J. Gerraty.Bl -tag -offset indent -width indent 5404fde40d9SSimon J. Gerraty.It Ic @ 5413955d011SMarcel Moolenaarcauses the command not to be echoed before it is executed. 5424fde40d9SSimon J. Gerraty.It Ic + 5433955d011SMarcel Moolenaarcauses the command to be executed even when 5443955d011SMarcel Moolenaar.Fl n 5453955d011SMarcel Moolenaaris given. 5464fde40d9SSimon J. GerratyThis is similar to the effect of the 5474fde40d9SSimon J. Gerraty.Va .MAKE 5484fde40d9SSimon J. Gerratyspecial source, 5493955d011SMarcel Moolenaarexcept that the effect can be limited to a single line of a script. 5504fde40d9SSimon J. Gerraty.It Ic \- 551db29cad8SSimon J. Gerratyin compatibility mode 5523955d011SMarcel Moolenaarcauses any non-zero exit status of the command line to be ignored. 5534fde40d9SSimon J. Gerraty.El 5543cbdda60SSimon J. Gerraty.Pp 5553cbdda60SSimon J. GerratyWhen 5563cbdda60SSimon J. Gerraty.Nm 5573cbdda60SSimon J. Gerratyis run in jobs mode with 5583cbdda60SSimon J. Gerraty.Fl j Ar max_jobs , 5594fde40d9SSimon J. Gerratythe entire script for the target is fed to a single instance of the shell. 5603cbdda60SSimon J. GerratyIn compatibility (non-jobs) mode, each command is run in a separate process. 5613cbdda60SSimon J. GerratyIf the command contains any shell meta characters 5624fde40d9SSimon J. Gerraty.Pq Ql #=|^(){};&<>*?[]:$`\e\en , 5634fde40d9SSimon J. Gerratyit is passed to the shell; otherwise 5643cbdda60SSimon J. Gerraty.Nm 5654fde40d9SSimon J. Gerratyattempts direct execution. 566db29cad8SSimon J. GerratyIf a line starts with 567954401e6SSimon J. Gerraty.Sq Ic \- 5684fde40d9SSimon J. Gerratyand the shell has ErrCtl enabled, 5694fde40d9SSimon J. Gerratyfailure of the command line is ignored as in compatibility mode. 570db29cad8SSimon J. GerratyOtherwise 571954401e6SSimon J. Gerraty.Sq Ic \- 572db29cad8SSimon J. Gerratyaffects the entire job; 5734fde40d9SSimon J. Gerratythe script stops at the first command line that fails, 5744fde40d9SSimon J. Gerratybut the target is not deemed to have failed. 575db29cad8SSimon J. Gerraty.Pp 576db29cad8SSimon J. GerratyMakefiles should be written so that the mode of 577db29cad8SSimon J. Gerraty.Nm 578db29cad8SSimon J. Gerratyoperation does not change their behavior. 5794fde40d9SSimon J. GerratyFor example, any command which uses 580db29cad8SSimon J. Gerraty.Dq cd 581db29cad8SSimon J. Gerratyor 582db29cad8SSimon J. Gerraty.Dq chdir 5834fde40d9SSimon J. Gerratywithout the intention of changing the directory for subsequent commands 584db29cad8SSimon J. Gerratyshould be put in parentheses so it executes in a subshell. 5854fde40d9SSimon J. GerratyTo force the use of a single shell, escape the line breaks so as to make 586db29cad8SSimon J. Gerratythe whole script one command. 587db29cad8SSimon J. GerratyFor example: 588db29cad8SSimon J. Gerraty.Bd -literal -offset indent 589db29cad8SSimon J. Gerratyavoid-chdir-side-effects: 5904fde40d9SSimon J. Gerraty @echo "Building $@ in $$(pwd)" 591db29cad8SSimon J. Gerraty @(cd ${.CURDIR} && ${MAKE} $@) 5924fde40d9SSimon J. Gerraty @echo "Back in $$(pwd)" 593db29cad8SSimon J. Gerraty 594db29cad8SSimon J. Gerratyensure-one-shell-regardless-of-mode: 5954fde40d9SSimon J. Gerraty @echo "Building $@ in $$(pwd)"; \e 596db29cad8SSimon J. Gerraty (cd ${.CURDIR} && ${MAKE} $@); \e 5974fde40d9SSimon J. Gerraty echo "Back in $$(pwd)" 598db29cad8SSimon J. Gerraty.Ed 5993cbdda60SSimon J. Gerraty.Pp 6003cbdda60SSimon J. GerratySince 6013cbdda60SSimon J. Gerraty.Nm 6024fde40d9SSimon J. Gerratychanges the current working directory to 603954401e6SSimon J. Gerraty.Sq Va .OBJDIR 6044fde40d9SSimon J. Gerratybefore executing any targets, 6054fde40d9SSimon J. Gerratyeach child process starts with that as its current working directory. 6063955d011SMarcel Moolenaar.Sh VARIABLE ASSIGNMENTS 607954401e6SSimon J. GerratyVariables in make behave much like macros in the C preprocessor. 608954401e6SSimon J. Gerraty.Pp 609954401e6SSimon J. GerratyVariable assignments have the form 610954401e6SSimon J. Gerraty.Sq Ar NAME Ar op Ar value , 611954401e6SSimon J. Gerratywhere: 6124fde40d9SSimon J. Gerraty.Bl -tag -offset Ds -width Ds 613954401e6SSimon J. Gerraty.It Ar NAME 614954401e6SSimon J. Gerratyis a single-word variable name, 615954401e6SSimon J. Gerratyconsisting, by tradition, of all upper-case letters, 616954401e6SSimon J. Gerraty.It Ar op 6174fde40d9SSimon J. Gerratyis one of the variable assignment operators described below, and 618954401e6SSimon J. Gerraty.It Ar value 619954401e6SSimon J. Gerratyis interpreted according to the variable assignment operator. 620954401e6SSimon J. Gerraty.El 621954401e6SSimon J. Gerraty.Pp 622954401e6SSimon J. GerratyWhitespace around 623954401e6SSimon J. Gerraty.Ar NAME , 624954401e6SSimon J. Gerraty.Ar op 625954401e6SSimon J. Gerratyand 626954401e6SSimon J. Gerraty.Ar value 627954401e6SSimon J. Gerratyis discarded. 628954401e6SSimon J. Gerraty.Ss Variable assignment operators 6294fde40d9SSimon J. GerratyThe five operators that assign values to variables are: 6303955d011SMarcel Moolenaar.Bl -tag -width Ds 6313955d011SMarcel Moolenaar.It Ic \&= 6323955d011SMarcel MoolenaarAssign the value to the variable. 633954401e6SSimon J. GerratyAny previous value is overwritten. 6343955d011SMarcel Moolenaar.It Ic \&+= 635954401e6SSimon J. GerratyAppend the value to the current value of the variable, 636954401e6SSimon J. Gerratyseparating them by a single space. 6373955d011SMarcel Moolenaar.It Ic \&?= 6383955d011SMarcel MoolenaarAssign the value to the variable if it is not already defined. 6393955d011SMarcel Moolenaar.It Ic \&:= 6404fde40d9SSimon J. GerratyExpand the value, then assign it to the variable. 641954401e6SSimon J. Gerraty.Pp 6423955d011SMarcel Moolenaar.Em NOTE : 6433955d011SMarcel MoolenaarReferences to undefined variables are 6443955d011SMarcel Moolenaar.Em not 6453955d011SMarcel Moolenaarexpanded. 6463955d011SMarcel MoolenaarThis can cause problems when variable modifiers are used. 6474fde40d9SSimon J. Gerraty.\" See var-op-expand.mk, the section with LATER and INDIRECT. 6483955d011SMarcel Moolenaar.It Ic \&!= 6494fde40d9SSimon J. GerratyExpand the value and pass it to the shell for execution, 6504fde40d9SSimon J. Gerratythen assign the output from the child's standard output to the variable. 6513955d011SMarcel MoolenaarAny newlines in the result are replaced with spaces. 6523955d011SMarcel Moolenaar.El 653954401e6SSimon J. Gerraty.Ss Expansion of variables 6544fde40d9SSimon J. GerratyIn most contexts where variables are expanded, 655954401e6SSimon J. Gerraty.Ql \&$$ 656954401e6SSimon J. Gerratyexpands to a single dollar sign. 6574fde40d9SSimon J. GerratyIn other contexts (most variable modifiers, string literals in conditions), 6584fde40d9SSimon J. Gerraty.Ql \&\e$ 6594fde40d9SSimon J. Gerratyexpands to a single dollar sign. 6604fde40d9SSimon J. Gerraty.Pp 661954401e6SSimon J. GerratyReferences to variables have the form 6624fde40d9SSimon J. Gerraty.Cm \&${ Ns Ar name Ns Oo Ns Cm \&: Ns Ar modifiers Oc Ns Cm \&} 663954401e6SSimon J. Gerratyor 6644fde40d9SSimon J. Gerraty.Cm \&$( Ns Ar name Ns Oo Ns Cm \&: Ns Ar modifiers Oc Ns Cm \&) . 6654fde40d9SSimon J. GerratyIf the variable name consists of only a single character 6664fde40d9SSimon J. Gerratyand the expression contains no modifiers, 667954401e6SSimon J. Gerratythe surrounding curly braces or parentheses are not required. 6683955d011SMarcel MoolenaarThis shorter form is not recommended. 6693955d011SMarcel Moolenaar.Pp 6704fde40d9SSimon J. GerratyIf the variable name contains a dollar, the name itself is expanded first. 6713955d011SMarcel MoolenaarThis allows almost arbitrary variable names, however names containing dollar, 6724fde40d9SSimon J. Gerratybraces, parentheses or whitespace are really best avoided. 6733955d011SMarcel Moolenaar.Pp 6744fde40d9SSimon J. GerratyIf the result of expanding a nested variable expression contains a dollar sign 675954401e6SSimon J. Gerraty.Pq Ql \&$ , 6764fde40d9SSimon J. Gerratythe result is subject to further expansion. 6773955d011SMarcel Moolenaar.Pp 678954401e6SSimon J. GerratyVariable substitution occurs at four distinct times, depending on where 6793955d011SMarcel Moolenaarthe variable is being used. 6803955d011SMarcel Moolenaar.Bl -enum 6813955d011SMarcel Moolenaar.It 6823955d011SMarcel MoolenaarVariables in dependency lines are expanded as the line is read. 6833955d011SMarcel Moolenaar.It 684954401e6SSimon J. GerratyVariables in conditionals are expanded individually, 685954401e6SSimon J. Gerratybut only as far as necessary to determine the result of the conditional. 686954401e6SSimon J. Gerraty.It 6873955d011SMarcel MoolenaarVariables in shell commands are expanded when the shell command is 6883955d011SMarcel Moolenaarexecuted. 6893955d011SMarcel Moolenaar.It 6904fde40d9SSimon J. Gerraty.Ic .for 6913955d011SMarcel Moolenaarloop index variables are expanded on each loop iteration. 692954401e6SSimon J. GerratyNote that other variables are not expanded when composing the body of a loop, 693954401e6SSimon J. Gerratyso the following example code: 6943955d011SMarcel Moolenaar.Bd -literal -offset indent 6954fde40d9SSimon J. Gerraty\&.for i in 1 2 3 6963955d011SMarcel Moolenaara+= ${i} 6973955d011SMarcel Moolenaarj= ${i} 6983955d011SMarcel Moolenaarb+= ${j} 6994fde40d9SSimon J. Gerraty\&.endfor 7003955d011SMarcel Moolenaar 7013955d011SMarcel Moolenaarall: 7023955d011SMarcel Moolenaar @echo ${a} 7033955d011SMarcel Moolenaar @echo ${b} 7043955d011SMarcel Moolenaar.Ed 7054fde40d9SSimon J. Gerraty.Pp 7064fde40d9SSimon J. Gerratyprints: 7073955d011SMarcel Moolenaar.Bd -literal -offset indent 7083955d011SMarcel Moolenaar1 2 3 7093955d011SMarcel Moolenaar3 3 3 7103955d011SMarcel Moolenaar.Ed 7114fde40d9SSimon J. Gerraty.Pp 7124fde40d9SSimon J. GerratyAfter the loop is executed: 7134fde40d9SSimon J. Gerraty.Bl -tag -offset indent -width indent 7144fde40d9SSimon J. Gerraty.It Va a 7153955d011SMarcel Moolenaarcontains 7164fde40d9SSimon J. Gerraty.Ql ${:U1} ${:U2} ${:U3} , 7173955d011SMarcel Moolenaarwhich expands to 7184fde40d9SSimon J. Gerraty.Ql 1 2 3 . 7194fde40d9SSimon J. Gerraty.It Va j 7204fde40d9SSimon J. Gerratycontains 7214fde40d9SSimon J. Gerraty.Ql ${:U3} , 7224fde40d9SSimon J. Gerratywhich expands to 7234fde40d9SSimon J. Gerraty.Ql 3 . 7244fde40d9SSimon J. Gerraty.It Va b 7254fde40d9SSimon J. Gerratycontains 7264fde40d9SSimon J. Gerraty.Ql ${j} ${j} ${j} , 7274fde40d9SSimon J. Gerratywhich expands to 7284fde40d9SSimon J. Gerraty.Ql ${:U3} ${:U3} ${:U3} 7294fde40d9SSimon J. Gerratyand further to 7304fde40d9SSimon J. Gerraty.Ql 3 3 3 . 7314fde40d9SSimon J. Gerraty.El 7323955d011SMarcel Moolenaar.El 7333955d011SMarcel Moolenaar.Ss Variable classes 7343955d011SMarcel MoolenaarThe four different classes of variables (in order of increasing precedence) 7353955d011SMarcel Moolenaarare: 7363955d011SMarcel Moolenaar.Bl -tag -width Ds 7373955d011SMarcel Moolenaar.It Environment variables 7383955d011SMarcel MoolenaarVariables defined as part of 7393955d011SMarcel Moolenaar.Nm Ns 's 7403955d011SMarcel Moolenaarenvironment. 7413955d011SMarcel Moolenaar.It Global variables 7423955d011SMarcel MoolenaarVariables defined in the makefile or in included makefiles. 7433955d011SMarcel Moolenaar.It Command line variables 7443955d011SMarcel MoolenaarVariables defined as part of the command line. 7453955d011SMarcel Moolenaar.It Local variables 7463955d011SMarcel MoolenaarVariables that are defined specific to a certain target. 747db29cad8SSimon J. Gerraty.El 748db29cad8SSimon J. Gerraty.Pp 7494fde40d9SSimon J. GerratyLocal variables can be set on a dependency line, unless 7501d3f2ddcSSimon J. Gerraty.Va .MAKE.TARGET_LOCAL_VARIABLES 7514fde40d9SSimon J. Gerratyis set to 7529f45a3c8SSimon J. Gerraty.Ql false . 7539f45a3c8SSimon J. GerratyThe rest of the line 7544fde40d9SSimon J. Gerraty(which already has had global variables expanded) 7559f45a3c8SSimon J. Gerratyis the variable value. 7569f45a3c8SSimon J. GerratyFor example: 7579f45a3c8SSimon J. Gerraty.Bd -literal -offset indent 7581d3f2ddcSSimon J. GerratyCOMPILER_WRAPPERS= ccache distcc icecc 7599f45a3c8SSimon J. Gerraty 7609f45a3c8SSimon J. Gerraty${OBJS}: .MAKE.META.CMP_FILTER=${COMPILER_WRAPPERS:S,^,N,} 7619f45a3c8SSimon J. Gerraty.Ed 7629f45a3c8SSimon J. Gerraty.Pp 7639f45a3c8SSimon J. GerratyOnly the targets 7649f45a3c8SSimon J. Gerraty.Ql ${OBJS} 7654fde40d9SSimon J. Gerratyare impacted by that filter (in 7664fde40d9SSimon J. Gerraty.Dq meta 7674fde40d9SSimon J. Gerratymode) and 7684fde40d9SSimon J. Gerratysimply enabling/disabling any of the compiler wrappers does not render all 7699f45a3c8SSimon J. Gerratyof those targets out-of-date. 7709f45a3c8SSimon J. Gerraty.Pp 7719f45a3c8SSimon J. Gerraty.Em NOTE : 7721d3f2ddcSSimon J. Gerratytarget-local variable assignments behave differently in that; 7739f45a3c8SSimon J. Gerraty.Bl -tag -width Ds -offset indent 7749f45a3c8SSimon J. Gerraty.It Ic \&+= 7759f45a3c8SSimon J. GerratyOnly appends to a previous local assignment 7769f45a3c8SSimon J. Gerratyfor the same target and variable. 7779f45a3c8SSimon J. Gerraty.It Ic \&:= 7781d3f2ddcSSimon J. GerratyIs redundant with respect to global variables, 7799f45a3c8SSimon J. Gerratywhich have already been expanded. 7809f45a3c8SSimon J. Gerraty.El 7819f45a3c8SSimon J. Gerraty.Pp 7824fde40d9SSimon J. GerratyThe seven built-in local variables are: 7834fde40d9SSimon J. Gerraty.Bl -tag -width ".Va .ARCHIVE" -offset indent 7843955d011SMarcel Moolenaar.It Va .ALLSRC 7853955d011SMarcel MoolenaarThe list of all sources for this target; also known as 786954401e6SSimon J. Gerraty.Sq Va \&> . 7873955d011SMarcel Moolenaar.It Va .ARCHIVE 788db29cad8SSimon J. GerratyThe name of the archive file; also known as 789954401e6SSimon J. Gerraty.Sq Va \&! . 7903955d011SMarcel Moolenaar.It Va .IMPSRC 7913955d011SMarcel MoolenaarIn suffix-transformation rules, the name/path of the source from which the 7923955d011SMarcel Moolenaartarget is to be transformed (the 7933955d011SMarcel Moolenaar.Dq implied 7943955d011SMarcel Moolenaarsource); also known as 795954401e6SSimon J. Gerraty.Sq Va \&< . 7963955d011SMarcel MoolenaarIt is not defined in explicit rules. 7973955d011SMarcel Moolenaar.It Va .MEMBER 798db29cad8SSimon J. GerratyThe name of the archive member; also known as 799954401e6SSimon J. Gerraty.Sq Va % . 8003955d011SMarcel Moolenaar.It Va .OODATE 8013955d011SMarcel MoolenaarThe list of sources for this target that were deemed out-of-date; also 8023955d011SMarcel Moolenaarknown as 803954401e6SSimon J. Gerraty.Sq Va \&? . 8043955d011SMarcel Moolenaar.It Va .PREFIX 805c1d01b5fSSimon J. GerratyThe name of the target with suffix (if declared in 806c1d01b5fSSimon J. Gerraty.Ic .SUFFIXES ) 807c1d01b5fSSimon J. Gerratyremoved; also known as 808954401e6SSimon J. Gerraty.Sq Va * . 8093955d011SMarcel Moolenaar.It Va .TARGET 8103955d011SMarcel MoolenaarThe name of the target; also known as 811954401e6SSimon J. Gerraty.Sq Va @ . 8123bebe729SSimon J. GerratyFor compatibility with other makes this is an alias for 8134fde40d9SSimon J. Gerraty.Va .ARCHIVE 8143bebe729SSimon J. Gerratyin archive member rules. 8153955d011SMarcel Moolenaar.El 8163955d011SMarcel Moolenaar.Pp 8173955d011SMarcel MoolenaarThe shorter forms 8184fde40d9SSimon J. Gerraty.Po 8194fde40d9SSimon J. Gerraty.Sq Va \&> , 820954401e6SSimon J. Gerraty.Sq Va \&! , 8214fde40d9SSimon J. Gerraty.Sq Va \&< , 8224fde40d9SSimon J. Gerraty.Sq Va \&% , 823954401e6SSimon J. Gerraty.Sq Va \&? , 8244fde40d9SSimon J. Gerraty.Sq Va \&* , 8253955d011SMarcel Moolenaarand 8264fde40d9SSimon J. Gerraty.Sq Va \&@ 8274fde40d9SSimon J. Gerraty.Pc 8283955d011SMarcel Moolenaarare permitted for backward 829db29cad8SSimon J. Gerratycompatibility with historical makefiles and legacy POSIX make and are 830db29cad8SSimon J. Gerratynot recommended. 831db29cad8SSimon J. Gerraty.Pp 832db29cad8SSimon J. GerratyVariants of these variables with the punctuation followed immediately by 833db29cad8SSimon J. Gerraty.Ql D 834db29cad8SSimon J. Gerratyor 835db29cad8SSimon J. Gerraty.Ql F , 836954401e6SSimon J. Gerratye.g.\& 8374fde40d9SSimon J. Gerraty.Ql $(@D) , 838db29cad8SSimon J. Gerratyare legacy forms equivalent to using the 839db29cad8SSimon J. Gerraty.Ql :H 8403955d011SMarcel Moolenaarand 841db29cad8SSimon J. Gerraty.Ql :T 842db29cad8SSimon J. Gerratymodifiers. 843db29cad8SSimon J. GerratyThese forms are accepted for compatibility with 8443955d011SMarcel Moolenaar.At V 845db29cad8SSimon J. Gerratymakefiles and POSIX but are not recommended. 8463955d011SMarcel Moolenaar.Pp 8473955d011SMarcel MoolenaarFour of the local variables may be used in sources on dependency lines 8483955d011SMarcel Moolenaarbecause they expand to the proper value for each target on the line. 8493955d011SMarcel MoolenaarThese variables are 850954401e6SSimon J. Gerraty.Sq Va .TARGET , 851954401e6SSimon J. Gerraty.Sq Va .PREFIX , 852954401e6SSimon J. Gerraty.Sq Va .ARCHIVE , 8533955d011SMarcel Moolenaarand 854954401e6SSimon J. Gerraty.Sq Va .MEMBER . 8553955d011SMarcel Moolenaar.Ss Additional built-in variables 8563955d011SMarcel MoolenaarIn addition, 8573955d011SMarcel Moolenaar.Nm 8583955d011SMarcel Moolenaarsets or knows about the following variables: 8594fde40d9SSimon J. Gerraty.Bl -tag 8604fde40d9SSimon J. Gerraty.\" NB: This list is sorted case-insensitive, ignoring punctuation. 8614fde40d9SSimon J. Gerraty.\" NB: To find all built-in variables in make's source code, 8624fde40d9SSimon J. Gerraty.\" NB: search for Var_*, Global_*, SetVarObjdir, GetBooleanExpr, 8634fde40d9SSimon J. Gerraty.\" NB: and the implementation of Var_SetWithFlags. 8644fde40d9SSimon J. Gerraty.\" NB: Last synced on 2023-01-01. 8653955d011SMarcel Moolenaar.It Va .ALLTARGETS 8664fde40d9SSimon J. GerratyThe list of all targets encountered in the makefiles. 8674fde40d9SSimon J. GerratyIf evaluated during makefile parsing, 8684fde40d9SSimon J. Gerratylists only those targets encountered thus far. 8693955d011SMarcel Moolenaar.It Va .CURDIR 8703955d011SMarcel MoolenaarA path to the directory where 8713955d011SMarcel Moolenaar.Nm 8723955d011SMarcel Moolenaarwas executed. 8733955d011SMarcel MoolenaarRefer to the description of 8744fde40d9SSimon J. Gerraty.Sq Va PWD 8753955d011SMarcel Moolenaarfor more details. 8764fde40d9SSimon J. Gerraty.It Va .ERROR_CMD 8774fde40d9SSimon J. GerratyIs used in error handling, see 8784fde40d9SSimon J. Gerraty.Va MAKE_PRINT_VAR_ON_ERROR . 8794fde40d9SSimon J. Gerraty.It Va .ERROR_CWD 8804fde40d9SSimon J. GerratyIs used in error handling, see 8814fde40d9SSimon J. Gerraty.Va MAKE_PRINT_VAR_ON_ERROR . 882*c59c3bf3SSimon J. Gerraty.It Va .ERROR_EXIT 883*c59c3bf3SSimon J. GerratyIs used in error handling, see 884*c59c3bf3SSimon J. Gerraty.Va MAKE_PRINT_VAR_ON_ERROR . 8854fde40d9SSimon J. Gerraty.It Va .ERROR_META_FILE 8864fde40d9SSimon J. GerratyIs used in error handling in 8874fde40d9SSimon J. Gerraty.Dq meta 8884fde40d9SSimon J. Gerratymode, see 8894fde40d9SSimon J. Gerraty.Va MAKE_PRINT_VAR_ON_ERROR . 8904fde40d9SSimon J. Gerraty.It Va .ERROR_TARGET 8914fde40d9SSimon J. GerratyIs used in error handling, see 8924fde40d9SSimon J. Gerraty.Va MAKE_PRINT_VAR_ON_ERROR . 8935bcb7424SSimon J. Gerraty.It Va .INCLUDEDFROMDIR 8944fde40d9SSimon J. GerratyThe directory of the file this makefile was included from. 8955bcb7424SSimon J. Gerraty.It Va .INCLUDEDFROMFILE 8964fde40d9SSimon J. GerratyThe filename of the file this makefile was included from. 8974fde40d9SSimon J. Gerraty.\" .INCLUDES is intentionally undocumented, as it is obsolete. 8984fde40d9SSimon J. Gerraty.\" .LIBS is intentionally undocumented, as it is obsolete. 8994fde40d9SSimon J. Gerraty.It Va MACHINE 9004fde40d9SSimon J. GerratyThe machine hardware name, see 9014fde40d9SSimon J. Gerraty.Xr uname 1 . 9024fde40d9SSimon J. Gerraty.It Va MACHINE_ARCH 9034fde40d9SSimon J. GerratyThe machine processor architecture name, see 9044fde40d9SSimon J. Gerraty.Xr uname 1 . 9054fde40d9SSimon J. Gerraty.It Va MAKE 9063955d011SMarcel MoolenaarThe name that 9073955d011SMarcel Moolenaar.Nm 9083955d011SMarcel Moolenaarwas executed with 9093955d011SMarcel Moolenaar.Pq Va argv[0] . 9104fde40d9SSimon J. Gerraty.It Va .MAKE 9114fde40d9SSimon J. GerratyThe same as 9124fde40d9SSimon J. Gerraty.Va MAKE , 9134fde40d9SSimon J. Gerratyfor compatibility. 9143955d011SMarcel MoolenaarThe preferred variable to use is the environment variable 9153955d011SMarcel Moolenaar.Ev MAKE 9164fde40d9SSimon J. Gerratybecause it is more compatible with other make variants 9173955d011SMarcel Moolenaarand cannot be confused with the special target with the same name. 9184fde40d9SSimon J. Gerraty.\" '.MAKE.cmd_filtered' is intentionally undocumented, 9194fde40d9SSimon J. Gerraty.\" as it is an internal implementation detail. 9203955d011SMarcel Moolenaar.It Va .MAKE.DEPENDFILE 9213955d011SMarcel MoolenaarNames the makefile (default 922954401e6SSimon J. Gerraty.Sq Pa .depend ) 9233955d011SMarcel Moolenaarfrom which generated dependencies are read. 9244fde40d9SSimon J. Gerraty.It Va .MAKE.DIE_QUIETLY 9254fde40d9SSimon J. GerratyIf set to 9264fde40d9SSimon J. Gerraty.Ql true , 9274fde40d9SSimon J. Gerratydo not print error information at the end. 9283955d011SMarcel Moolenaar.It Va .MAKE.EXPAND_VARIABLES 9293955d011SMarcel MoolenaarA boolean that controls the default behavior of the 9303955d011SMarcel Moolenaar.Fl V 9313955d011SMarcel Moolenaaroption. 9328695518cSSimon J. GerratyIf true, variable values printed with 9338695518cSSimon J. Gerraty.Fl V 9348695518cSSimon J. Gerratyare fully expanded; if false, the raw variable contents (which may 9358695518cSSimon J. Gerratyinclude additional unexpanded variable references) are shown. 9363955d011SMarcel Moolenaar.It Va .MAKE.EXPORTED 9373955d011SMarcel MoolenaarThe list of variables exported by 9383955d011SMarcel Moolenaar.Nm . 9394fde40d9SSimon J. Gerraty.It Va MAKEFILE 9404fde40d9SSimon J. GerratyThe top-level makefile that is currently read, 9414fde40d9SSimon J. Gerratyas given in the command line. 9424fde40d9SSimon J. Gerraty.It Va .MAKEFLAGS 9433955d011SMarcel MoolenaarThe environment variable 944954401e6SSimon J. Gerraty.Sq Ev MAKEFLAGS 9453955d011SMarcel Moolenaarmay contain anything that 9463955d011SMarcel Moolenaarmay be specified on 9473955d011SMarcel Moolenaar.Nm Ns 's 9483955d011SMarcel Moolenaarcommand line. 9493955d011SMarcel MoolenaarAnything specified on 9503955d011SMarcel Moolenaar.Nm Ns 's 9513955d011SMarcel Moolenaarcommand line is appended to the 9524fde40d9SSimon J. Gerraty.Va .MAKEFLAGS 9534fde40d9SSimon J. Gerratyvariable, which is then added to the environment for all programs that 9543955d011SMarcel Moolenaar.Nm 9553955d011SMarcel Moolenaarexecutes. 9564fde40d9SSimon J. Gerraty.It Va .MAKE.GID 9574fde40d9SSimon J. GerratyThe numeric group ID of the user running 9584fde40d9SSimon J. Gerraty.Nm . 9594fde40d9SSimon J. GerratyIt is read-only. 9604fde40d9SSimon J. Gerraty.It Va .MAKE.JOB.PREFIX 9614fde40d9SSimon J. GerratyIf 9624fde40d9SSimon J. Gerraty.Nm 9634fde40d9SSimon J. Gerratyis run with 9644fde40d9SSimon J. Gerraty.Fl j , 9654fde40d9SSimon J. Gerratythe output for each target is prefixed with a token 9664fde40d9SSimon J. Gerraty.Dl --- Ar target Li --- 9674fde40d9SSimon J. Gerratythe first part of which can be controlled via 9684fde40d9SSimon J. Gerraty.Va .MAKE.JOB.PREFIX . 9694fde40d9SSimon J. GerratyIf 9704fde40d9SSimon J. Gerraty.Va .MAKE.JOB.PREFIX 9714fde40d9SSimon J. Gerratyis empty, no token is printed. 9724fde40d9SSimon J. GerratyFor example, setting 9734fde40d9SSimon J. Gerraty.Va .MAKE.JOB.PREFIX 9744fde40d9SSimon J. Gerratyto 9754fde40d9SSimon J. Gerraty.Ql ${.newline}---${.MAKE:T}[${.MAKE.PID}] 9764fde40d9SSimon J. Gerratywould produce tokens like 9774fde40d9SSimon J. Gerraty.Dl ---make[1234] Ar target Li --- 9784fde40d9SSimon J. Gerratymaking it easier to track the degree of parallelism being achieved. 9794fde40d9SSimon J. Gerraty.It Va .MAKE.JOBS 9804fde40d9SSimon J. GerratyThe argument to the 9814fde40d9SSimon J. Gerraty.Fl j 9824fde40d9SSimon J. Gerratyoption. 98398875883SSimon J. Gerraty.It Va .MAKE.JOBS.C 98498875883SSimon J. GerratyA read-only boolean that indicates whether the 98598875883SSimon J. Gerraty.Fl j 98698875883SSimon J. Gerratyoption supports use of 98798875883SSimon J. Gerraty.Ql C . 9883955d011SMarcel Moolenaar.It Va .MAKE.LEVEL 9893955d011SMarcel MoolenaarThe recursion depth of 9903955d011SMarcel Moolenaar.Nm . 9914fde40d9SSimon J. GerratyThe top-level instance of 9923955d011SMarcel Moolenaar.Nm 9934fde40d9SSimon J. Gerratyhas level 0, and each child make has its parent level plus 1. 9943955d011SMarcel MoolenaarThis allows tests like: 9953955d011SMarcel Moolenaar.Li .if ${.MAKE.LEVEL} == 0 9964fde40d9SSimon J. Gerratyto protect things which should only be evaluated in the top-level instance of 9974fde40d9SSimon J. Gerraty.Nm . 9984fde40d9SSimon J. Gerraty.It Va .MAKE.LEVEL.ENV 9994fde40d9SSimon J. GerratyThe name of the environment variable that stores the level of nested calls to 10003955d011SMarcel Moolenaar.Nm . 10013955d011SMarcel Moolenaar.It Va .MAKE.MAKEFILE_PREFERENCE 10023955d011SMarcel MoolenaarThe ordered list of makefile names 10033955d011SMarcel Moolenaar(default 1004954401e6SSimon J. Gerraty.Sq Pa makefile , 1005954401e6SSimon J. Gerraty.Sq Pa Makefile ) 10063955d011SMarcel Moolenaarthat 10073955d011SMarcel Moolenaar.Nm 10084fde40d9SSimon J. Gerratylooks for. 10093955d011SMarcel Moolenaar.It Va .MAKE.MAKEFILES 10103955d011SMarcel MoolenaarThe list of makefiles read by 10113955d011SMarcel Moolenaar.Nm , 10123955d011SMarcel Moolenaarwhich is useful for tracking dependencies. 10133955d011SMarcel MoolenaarEach makefile is recorded only once, regardless of the number of times read. 10143955d011SMarcel Moolenaar.It Va .MAKE.META.BAILIWICK 10154fde40d9SSimon J. GerratyIn 10164fde40d9SSimon J. Gerraty.Dq meta 10174fde40d9SSimon J. Gerratymode, provides a list of prefixes which 10183955d011SMarcel Moolenaarmatch the directories controlled by 10193955d011SMarcel Moolenaar.Nm . 10203955d011SMarcel MoolenaarIf a file that was generated outside of 10213955d011SMarcel Moolenaar.Va .OBJDIR 10223955d011SMarcel Moolenaarbut within said bailiwick is missing, 10233955d011SMarcel Moolenaarthe current target is considered out-of-date. 10249f45a3c8SSimon J. Gerraty.It Va .MAKE.META.CMP_FILTER 10254fde40d9SSimon J. GerratyIn 10264fde40d9SSimon J. Gerraty.Dq meta 10274fde40d9SSimon J. Gerratymode, it can (very rarely!) be useful to filter command 10289f45a3c8SSimon J. Gerratylines before comparison. 10294fde40d9SSimon J. GerratyThis variable can be set to a set of modifiers that are applied to 10309f45a3c8SSimon J. Gerratyeach line of the old and new command that differ, if the filtered 10319f45a3c8SSimon J. Gerratycommands still differ, the target is considered out-of-date. 10323955d011SMarcel Moolenaar.It Va .MAKE.META.CREATED 10334fde40d9SSimon J. GerratyIn 10344fde40d9SSimon J. Gerraty.Dq meta 10354fde40d9SSimon J. Gerratymode, this variable contains a list of all the meta files 10363955d011SMarcel Moolenaarupdated. 10373955d011SMarcel MoolenaarIf not empty, it can be used to trigger processing of 10383955d011SMarcel Moolenaar.Va .MAKE.META.FILES . 10393955d011SMarcel Moolenaar.It Va .MAKE.META.FILES 10404fde40d9SSimon J. GerratyIn 10414fde40d9SSimon J. Gerraty.Dq meta 10424fde40d9SSimon J. Gerratymode, this variable contains a list of all the meta files 10433955d011SMarcel Moolenaarused (updated or not). 10443955d011SMarcel MoolenaarThis list can be used to process the meta files to extract dependency 10453955d011SMarcel Moolenaarinformation. 10464fde40d9SSimon J. Gerraty.It Va .MAKE.META.IGNORE_FILTER 10474fde40d9SSimon J. GerratyProvides a list of variable modifiers to apply to each pathname. 10484fde40d9SSimon J. GerratyIgnore if the expansion is an empty string. 104951ee2c1cSSimon J. Gerraty.It Va .MAKE.META.IGNORE_PATHS 105051ee2c1cSSimon J. GerratyProvides a list of path prefixes that should be ignored; 105151ee2c1cSSimon J. Gerratybecause the contents are expected to change over time. 105251ee2c1cSSimon J. GerratyThe default list includes: 1053954401e6SSimon J. Gerraty.Sq Pa /dev /etc /proc /tmp /var/run /var/tmp 1054e48f47ddSSimon J. Gerraty.It Va .MAKE.META.IGNORE_PATTERNS 1055e48f47ddSSimon J. GerratyProvides a list of patterns to match against pathnames. 1056e48f47ddSSimon J. GerratyIgnore any that match. 10573955d011SMarcel Moolenaar.It Va .MAKE.META.PREFIX 10584fde40d9SSimon J. GerratyDefines the message printed for each meta file updated in 10594fde40d9SSimon J. Gerraty.Dq meta verbose 10604fde40d9SSimon J. Gerratymode. 10613955d011SMarcel MoolenaarThe default value is: 10623955d011SMarcel Moolenaar.Dl Building ${.TARGET:H:tA}/${.TARGET:T} 10634fde40d9SSimon J. Gerraty.It Va .MAKE.MODE 10644fde40d9SSimon J. GerratyProcessed after reading all makefiles. 10654fde40d9SSimon J. GerratyAffects the mode that 10664fde40d9SSimon J. Gerraty.Nm 10674fde40d9SSimon J. Gerratyruns in. 10684fde40d9SSimon J. GerratyIt can contain these keywords: 10694fde40d9SSimon J. Gerraty.Bl -tag -width indent 10704fde40d9SSimon J. Gerraty.It Cm compat 10714fde40d9SSimon J. GerratyLike 10724fde40d9SSimon J. Gerraty.Fl B , 10734fde40d9SSimon J. Gerratyputs 10744fde40d9SSimon J. Gerraty.Nm 10754fde40d9SSimon J. Gerratyinto 10764fde40d9SSimon J. Gerraty.Dq compat 10774fde40d9SSimon J. Gerratymode. 10784fde40d9SSimon J. Gerraty.It Cm meta 10794fde40d9SSimon J. GerratyPuts 10804fde40d9SSimon J. Gerraty.Nm 10814fde40d9SSimon J. Gerratyinto 10824fde40d9SSimon J. Gerraty.Dq meta 10834fde40d9SSimon J. Gerratymode, where meta files are created for each target 10844fde40d9SSimon J. Gerratyto capture the command run, the output generated, and if 10854fde40d9SSimon J. Gerraty.Xr filemon 4 10864fde40d9SSimon J. Gerratyis available, the system calls which are of interest to 10874fde40d9SSimon J. Gerraty.Nm . 10884fde40d9SSimon J. GerratyThe captured output can be useful when diagnosing errors. 10894fde40d9SSimon J. Gerraty.It Cm curdirOk= Ns Ar bf 10904fde40d9SSimon J. GerratyBy default, 10914fde40d9SSimon J. Gerraty.Nm 10924fde40d9SSimon J. Gerratydoes not create 10934fde40d9SSimon J. Gerraty.Pa .meta 10944fde40d9SSimon J. Gerratyfiles in 10954fde40d9SSimon J. Gerraty.Sq Va .CURDIR . 10964fde40d9SSimon J. GerratyThis can be overridden by setting 10974fde40d9SSimon J. Gerraty.Ar bf 10984fde40d9SSimon J. Gerratyto a value which represents true. 10994fde40d9SSimon J. Gerraty.It Cm missing-meta= Ns Ar bf 11004fde40d9SSimon J. GerratyIf 11014fde40d9SSimon J. Gerraty.Ar bf 11024fde40d9SSimon J. Gerratyis true, a missing 11034fde40d9SSimon J. Gerraty.Pa .meta 11044fde40d9SSimon J. Gerratyfile makes the target out-of-date. 11054fde40d9SSimon J. Gerraty.It Cm missing-filemon= Ns Ar bf 11064fde40d9SSimon J. GerratyIf 11074fde40d9SSimon J. Gerraty.Ar bf 11084fde40d9SSimon J. Gerratyis true, missing filemon data makes the target out-of-date. 11094fde40d9SSimon J. Gerraty.It Cm nofilemon 11104fde40d9SSimon J. GerratyDo not use 11114fde40d9SSimon J. Gerraty.Xr filemon 4 . 11124fde40d9SSimon J. Gerraty.It Cm env 11134fde40d9SSimon J. GerratyFor debugging, it can be useful to include the environment 11144fde40d9SSimon J. Gerratyin the 11154fde40d9SSimon J. Gerraty.Pa .meta 11164fde40d9SSimon J. Gerratyfile. 11174fde40d9SSimon J. Gerraty.It Cm verbose 11184fde40d9SSimon J. GerratyIf in 11194fde40d9SSimon J. Gerraty.Dq meta 11204fde40d9SSimon J. Gerratymode, print a clue about the target being built. 11214fde40d9SSimon J. GerratyThis is useful if the build is otherwise running silently. 11224fde40d9SSimon J. GerratyThe message printed is the expanded value of 11234fde40d9SSimon J. Gerraty.Va .MAKE.META.PREFIX . 11244fde40d9SSimon J. Gerraty.It Cm ignore-cmd 11254fde40d9SSimon J. GerratySome makefiles have commands which are simply not stable. 11264fde40d9SSimon J. GerratyThis keyword causes them to be ignored for 11274fde40d9SSimon J. Gerratydetermining whether a target is out of date in 11284fde40d9SSimon J. Gerraty.Dq meta 11294fde40d9SSimon J. Gerratymode. 11304fde40d9SSimon J. GerratySee also 11314fde40d9SSimon J. Gerraty.Ic .NOMETA_CMP . 11324fde40d9SSimon J. Gerraty.It Cm silent= Ns Ar bf 11334fde40d9SSimon J. GerratyIf 11344fde40d9SSimon J. Gerraty.Ar bf 11354fde40d9SSimon J. Gerratyis true, when a .meta file is created, mark the target 11364fde40d9SSimon J. Gerraty.Ic .SILENT . 11374fde40d9SSimon J. Gerraty.It Cm randomize-targets 11384fde40d9SSimon J. GerratyIn both compat and parallel mode, do not make the targets in the usual order, 11394fde40d9SSimon J. Gerratybut instead randomize their order. 11404fde40d9SSimon J. GerratyThis mode can be used to detect undeclared dependencies between files. 11414fde40d9SSimon J. Gerraty.El 11424fde40d9SSimon J. Gerraty.It Va MAKEOBJDIR 11434fde40d9SSimon J. GerratyUsed to create files in a separate directory, see 11444fde40d9SSimon J. Gerraty.Va .OBJDIR . 11454fde40d9SSimon J. Gerraty.It Va MAKE_OBJDIR_CHECK_WRITABLE 11464fde40d9SSimon J. GerratyUsed to force a separate directory for the created files, 11474fde40d9SSimon J. Gerratyeven if that directory is not writable, see 11484fde40d9SSimon J. Gerraty.Va .OBJDIR . 11494fde40d9SSimon J. Gerraty.It Va MAKEOBJDIRPREFIX 11504fde40d9SSimon J. GerratyUsed to create files in a separate directory, see 11514fde40d9SSimon J. Gerraty.Va .OBJDIR . 11524fde40d9SSimon J. Gerraty.It Va .MAKE.OS 11534fde40d9SSimon J. GerratyThe name of the operating system, see 11544fde40d9SSimon J. Gerraty.Xr uname 1 . 11554fde40d9SSimon J. GerratyIt is read-only. 11563955d011SMarcel Moolenaar.It Va .MAKEOVERRIDES 11573955d011SMarcel MoolenaarThis variable is used to record the names of variables assigned to 11583955d011SMarcel Moolenaaron the command line, so that they may be exported as part of 1159954401e6SSimon J. Gerraty.Sq Ev MAKEFLAGS . 1160be19d90bSSimon J. GerratyThis behavior can be disabled by assigning an empty value to 1161954401e6SSimon J. Gerraty.Sq Va .MAKEOVERRIDES 11623955d011SMarcel Moolenaarwithin a makefile. 11633955d011SMarcel MoolenaarExtra variables can be exported from a makefile 11643955d011SMarcel Moolenaarby appending their names to 1165954401e6SSimon J. Gerraty.Sq Va .MAKEOVERRIDES . 1166954401e6SSimon J. Gerraty.Sq Ev MAKEFLAGS 11673955d011SMarcel Moolenaaris re-exported whenever 1168954401e6SSimon J. Gerraty.Sq Va .MAKEOVERRIDES 11693955d011SMarcel Moolenaaris modified. 11701748de26SSimon J. Gerraty.It Va .MAKE.PATH_FILEMON 11711748de26SSimon J. GerratyIf 11721748de26SSimon J. Gerraty.Nm 11731748de26SSimon J. Gerratywas built with 11741748de26SSimon J. Gerraty.Xr filemon 4 11751748de26SSimon J. Gerratysupport, this is set to the path of the device node. 11761748de26SSimon J. GerratyThis allows makefiles to test for this support. 11773955d011SMarcel Moolenaar.It Va .MAKE.PID 11784fde40d9SSimon J. GerratyThe process ID of 11793955d011SMarcel Moolenaar.Nm . 11804fde40d9SSimon J. GerratyIt is read-only. 11813955d011SMarcel Moolenaar.It Va .MAKE.PPID 11824fde40d9SSimon J. GerratyThe parent process ID of 11833955d011SMarcel Moolenaar.Nm . 11844fde40d9SSimon J. GerratyIt is read-only. 11854fde40d9SSimon J. Gerraty.It Va MAKE_PRINT_VAR_ON_ERROR 11864fde40d9SSimon J. GerratyWhen 11874fde40d9SSimon J. Gerraty.Nm 11884fde40d9SSimon J. Gerratystops due to an error, it sets 11894fde40d9SSimon J. Gerraty.Sq Va .ERROR_TARGET 11904fde40d9SSimon J. Gerratyto the name of the target that failed, 1191*c59c3bf3SSimon J. Gerraty.Sq Va .ERROR_EXIT 1192*c59c3bf3SSimon J. Gerratyto the exit status of the failed target, 11934fde40d9SSimon J. Gerraty.Sq Va .ERROR_CMD 11944fde40d9SSimon J. Gerratyto the commands of the failed target, 11954fde40d9SSimon J. Gerratyand in 11964fde40d9SSimon J. Gerraty.Dq meta 11974fde40d9SSimon J. Gerratymode, it also sets 11984fde40d9SSimon J. Gerraty.Sq Va .ERROR_CWD 11994fde40d9SSimon J. Gerratyto the 12004fde40d9SSimon J. Gerraty.Xr getcwd 3 , 12014fde40d9SSimon J. Gerratyand 12024fde40d9SSimon J. Gerraty.Sq Va .ERROR_META_FILE 12034fde40d9SSimon J. Gerratyto the path of the meta file (if any) describing the failed target. 12044fde40d9SSimon J. GerratyIt then prints its name and the value of 12054fde40d9SSimon J. Gerraty.Sq Va .CURDIR 12064fde40d9SSimon J. Gerratyas well as the value of any variables named in 12074fde40d9SSimon J. Gerraty.Sq Va MAKE_PRINT_VAR_ON_ERROR . 1208be19d90bSSimon J. Gerraty.It Va .MAKE.SAVE_DOLLARS 12094fde40d9SSimon J. GerratyIf true, 1210be19d90bSSimon J. Gerraty.Ql $$ 1211be19d90bSSimon J. Gerratyare preserved when doing 1212be19d90bSSimon J. Gerraty.Ql := 1213be19d90bSSimon J. Gerratyassignments. 1214be19d90bSSimon J. GerratyThe default is false, for backwards compatibility. 1215be19d90bSSimon J. GerratySet to true for compatability with other makes. 1216be19d90bSSimon J. GerratyIf set to false, 1217be19d90bSSimon J. Gerraty.Ql $$ 1218be19d90bSSimon J. Gerratybecomes 1219be19d90bSSimon J. Gerraty.Ql $ 1220be19d90bSSimon J. Gerratyper normal evaluation rules. 12214fde40d9SSimon J. Gerraty.It Va .MAKE.TARGET_LOCAL_VARIABLES 12224fde40d9SSimon J. GerratyIf set to 12234fde40d9SSimon J. Gerraty.Ql false , 12244fde40d9SSimon J. Gerratyapparent variable assignments in dependency lines are 12254fde40d9SSimon J. Gerratytreated as normal sources. 122606b9b3e0SSimon J. Gerraty.It Va .MAKE.UID 12274fde40d9SSimon J. GerratyThe numeric ID of the user running 122806b9b3e0SSimon J. Gerraty.Nm . 12294fde40d9SSimon J. GerratyIt is read-only. 12304fde40d9SSimon J. Gerraty.\" 'MAKE_VERSION' is intentionally undocumented 12314fde40d9SSimon J. Gerraty.\" since it is only defined in the bmake distribution, 12324fde40d9SSimon J. Gerraty.\" but not in NetBSD's native make. 12334fde40d9SSimon J. Gerraty.\" '.meta.%d.lcwd' is intentionally undocumented 12344fde40d9SSimon J. Gerraty.\" since it is an internal implementation detail. 12354fde40d9SSimon J. Gerraty.\" '.meta.%d.ldir' is intentionally undocumented 12364fde40d9SSimon J. Gerraty.\" since it is an internal implementation detail. 12374fde40d9SSimon J. Gerraty.\" 'MFLAGS' is intentionally undocumented 12384fde40d9SSimon J. Gerraty.\" since it is obsolete. 12393955d011SMarcel Moolenaar.It Va .newline 12403955d011SMarcel MoolenaarThis variable is simply assigned a newline character as its value. 12414fde40d9SSimon J. GerratyIt is read-only. 12423955d011SMarcel MoolenaarThis allows expansions using the 12433955d011SMarcel Moolenaar.Cm \&:@ 12443955d011SMarcel Moolenaarmodifier to put a newline between 12453955d011SMarcel Moolenaariterations of the loop rather than a space. 12464fde40d9SSimon J. GerratyFor example, in case of an error, 12474fde40d9SSimon J. Gerraty.Nm 12484fde40d9SSimon J. Gerratyprints the variable names and their values using: 12494fde40d9SSimon J. Gerraty.Dl ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@} 12503955d011SMarcel Moolenaar.It Va .OBJDIR 12513955d011SMarcel MoolenaarA path to the directory where the targets are built. 12523955d011SMarcel MoolenaarIts value is determined by trying to 12533955d011SMarcel Moolenaar.Xr chdir 2 12543955d011SMarcel Moolenaarto the following directories in order and using the first match: 12553955d011SMarcel Moolenaar.Bl -enum 12563955d011SMarcel Moolenaar.It 12574fde40d9SSimon J. Gerraty.Cm ${MAKEOBJDIRPREFIX} Ns Cm ${.CURDIR} 12583955d011SMarcel Moolenaar.Pp 12593955d011SMarcel Moolenaar(Only if 1260954401e6SSimon J. Gerraty.Sq Ev MAKEOBJDIRPREFIX 12613955d011SMarcel Moolenaaris set in the environment or on the command line.) 12623955d011SMarcel Moolenaar.It 12634fde40d9SSimon J. Gerraty.Cm ${MAKEOBJDIR} 12643955d011SMarcel Moolenaar.Pp 12653955d011SMarcel Moolenaar(Only if 1266954401e6SSimon J. Gerraty.Sq Ev MAKEOBJDIR 12673955d011SMarcel Moolenaaris set in the environment or on the command line.) 12683955d011SMarcel Moolenaar.It 12694fde40d9SSimon J. Gerraty.Cm ${.CURDIR} Ns Pa /obj. Ns Cm ${MACHINE} 12703955d011SMarcel Moolenaar.It 12714fde40d9SSimon J. Gerraty.Cm ${.CURDIR} Ns Pa /obj 12723955d011SMarcel Moolenaar.It 12734fde40d9SSimon J. Gerraty.Pa /usr/obj/ Ns Cm ${.CURDIR} 12743955d011SMarcel Moolenaar.It 12754fde40d9SSimon J. Gerraty.Cm ${.CURDIR} 12763955d011SMarcel Moolenaar.El 12773955d011SMarcel Moolenaar.Pp 12784fde40d9SSimon J. GerratyVariable expansion is performed on the value before it is used, 12793955d011SMarcel Moolenaarso expressions such as 12804fde40d9SSimon J. Gerraty.Cm ${.CURDIR:S,^/usr/src,/var/obj,} 12813955d011SMarcel Moolenaarmay be used. 12823955d011SMarcel MoolenaarThis is especially useful with 1283954401e6SSimon J. Gerraty.Sq Ev MAKEOBJDIR . 12843955d011SMarcel Moolenaar.Pp 1285954401e6SSimon J. Gerraty.Sq Va .OBJDIR 1286128a4105SSimon J. Gerratymay be modified in the makefile via the special target 1287954401e6SSimon J. Gerraty.Sq Ic .OBJDIR . 12883955d011SMarcel MoolenaarIn all cases, 12893955d011SMarcel Moolenaar.Nm 12904fde40d9SSimon J. Gerratychanges to the specified directory if it exists, and sets 1291954401e6SSimon J. Gerraty.Sq Va .OBJDIR 1292128a4105SSimon J. Gerratyand 12934fde40d9SSimon J. Gerraty.Sq Va PWD 12943955d011SMarcel Moolenaarto that directory before executing any targets. 1295e2eeea75SSimon J. Gerraty.Pp 1296e2eeea75SSimon J. GerratyExcept in the case of an explicit 1297954401e6SSimon J. Gerraty.Sq Ic .OBJDIR 1298e2eeea75SSimon J. Gerratytarget, 1299e2eeea75SSimon J. Gerraty.Nm 13004fde40d9SSimon J. Gerratychecks that the specified directory is writable and ignores it if not. 1301e2eeea75SSimon J. GerratyThis check can be skipped by setting the environment variable 1302954401e6SSimon J. Gerraty.Sq Ev MAKE_OBJDIR_CHECK_WRITABLE 13034fde40d9SSimon J. Gerratyto 13044fde40d9SSimon J. Gerraty.Dq no . 13053955d011SMarcel Moolenaar.It Va .PARSEDIR 13064fde40d9SSimon J. GerratyThe directory name of the current makefile being parsed. 13073955d011SMarcel Moolenaar.It Va .PARSEFILE 13084fde40d9SSimon J. GerratyThe basename of the current makefile being parsed. 13093955d011SMarcel MoolenaarThis variable and 1310954401e6SSimon J. Gerraty.Sq Va .PARSEDIR 13114fde40d9SSimon J. Gerratyare both set only while the makefiles are being parsed. 13124fde40d9SSimon J. GerratyTo retain their current values, 13134fde40d9SSimon J. Gerratyassign them to a variable using assignment with expansion 1314954401e6SSimon J. Gerraty.Sq Cm \&:= . 13153955d011SMarcel Moolenaar.It Va .PATH 13164fde40d9SSimon J. GerratyThe space-separated list of directories that 13173955d011SMarcel Moolenaar.Nm 13184fde40d9SSimon J. Gerratysearches for files. 13194fde40d9SSimon J. GerratyTo update this search list, use the special target 13204fde40d9SSimon J. Gerraty.Sq Ic .PATH 13214fde40d9SSimon J. Gerratyrather than modifying the variable directly. 13224fde40d9SSimon J. Gerraty.It Va %POSIX 13234fde40d9SSimon J. GerratyIs set in POSIX mode, see the special 13244fde40d9SSimon J. Gerraty.Ql Va .POSIX 13254fde40d9SSimon J. Gerratytarget. 13264fde40d9SSimon J. Gerraty.\" XXX: There is no make variable named 'PWD', 13274fde40d9SSimon J. Gerraty.\" XXX: make only reads and writes the environment variable 'PWD'. 13284fde40d9SSimon J. Gerraty.It Va PWD 13293955d011SMarcel MoolenaarAlternate path to the current directory. 13303955d011SMarcel Moolenaar.Nm 13313955d011SMarcel Moolenaarnormally sets 1332954401e6SSimon J. Gerraty.Sq Va .CURDIR 13333955d011SMarcel Moolenaarto the canonical path given by 13343955d011SMarcel Moolenaar.Xr getcwd 3 . 13353955d011SMarcel MoolenaarHowever, if the environment variable 1336954401e6SSimon J. Gerraty.Sq Ev PWD 13374fde40d9SSimon J. Gerratyis set and gives a path to the current directory, 13383955d011SMarcel Moolenaar.Nm 13393955d011SMarcel Moolenaarsets 1340954401e6SSimon J. Gerraty.Sq Va .CURDIR 13413955d011SMarcel Moolenaarto the value of 1342954401e6SSimon J. Gerraty.Sq Ev PWD 13433955d011SMarcel Moolenaarinstead. 1344be19d90bSSimon J. GerratyThis behavior is disabled if 1345954401e6SSimon J. Gerraty.Sq Ev MAKEOBJDIRPREFIX 13463955d011SMarcel Moolenaaris set or 1347954401e6SSimon J. Gerraty.Sq Ev MAKEOBJDIR 13483955d011SMarcel Moolenaarcontains a variable transform. 13494fde40d9SSimon J. Gerraty.Sq Va PWD 13503955d011SMarcel Moolenaaris set to the value of 1351954401e6SSimon J. Gerraty.Sq Va .OBJDIR 13523955d011SMarcel Moolenaarfor all programs which 13533955d011SMarcel Moolenaar.Nm 13543955d011SMarcel Moolenaarexecutes. 13554fde40d9SSimon J. Gerraty.It Va .SHELL 13562c3632d1SSimon J. GerratyThe pathname of the shell used to run target scripts. 13572c3632d1SSimon J. GerratyIt is read-only. 13584fde40d9SSimon J. Gerraty.It Va .SUFFIXES 135912904384SSimon J. GerratyThe list of known suffixes. 136012904384SSimon J. GerratyIt is read-only. 13614fde40d9SSimon J. Gerraty.It Va .SYSPATH 13624fde40d9SSimon J. GerratyThe space-separated list of directories that 13633955d011SMarcel Moolenaar.Nm 13644fde40d9SSimon J. Gerratysearches for makefiles, referred to as the system include path. 13654fde40d9SSimon J. GerratyTo update this search list, use the special target 13664fde40d9SSimon J. Gerraty.Sq Ic .SYSPATH 13674fde40d9SSimon J. Gerratyrather than modifying the variable which is read-only. 13684fde40d9SSimon J. Gerraty.It Va .TARGETS 13694fde40d9SSimon J. GerratyThe list of targets explicitly specified on the command line, if any. 13704fde40d9SSimon J. Gerraty.It Va VPATH 13714fde40d9SSimon J. GerratyThe colon-separated 13724fde40d9SSimon J. Gerraty.Pq Dq \&: 13734fde40d9SSimon J. Gerratylist of directories that 13744fde40d9SSimon J. Gerraty.Nm 13754fde40d9SSimon J. Gerratysearches for files. 13764fde40d9SSimon J. GerratyThis variable is supported for compatibility with old make programs only, use 1377954401e6SSimon J. Gerraty.Sq Va .PATH 13783955d011SMarcel Moolenaarinstead. 13793955d011SMarcel Moolenaar.El 13803955d011SMarcel Moolenaar.Ss Variable modifiers 13814fde40d9SSimon J. GerratyThe general format of a variable expansion is: 13823955d011SMarcel Moolenaar.Pp 13834fde40d9SSimon J. Gerraty.Sm off 13844fde40d9SSimon J. Gerraty.D1 Ic \&${ Ar variable\| Oo Ic \&: Ar modifier\| Oo Ic \&: No ... Oc Oc Ic \&} 13854fde40d9SSimon J. Gerraty.Sm on 13863955d011SMarcel Moolenaar.Pp 13874fde40d9SSimon J. GerratyEach modifier begins with a colon. 13884fde40d9SSimon J. GerratyTo escape a colon, precede it with a backslash 13894fde40d9SSimon J. Gerraty.Ql \e . 13903955d011SMarcel Moolenaar.Pp 13914fde40d9SSimon J. GerratyA list of indirect modifiers can be specified via a variable, as follows: 13923955d011SMarcel Moolenaar.Pp 13934fde40d9SSimon J. Gerraty.Bd -literal -offset indent 13944fde40d9SSimon J. Gerraty.Ar modifier_variable\^ Li \&= Ar modifier Ns Oo Ic \&: Ns No ... Oc 13954fde40d9SSimon J. Gerraty 13964fde40d9SSimon J. Gerraty.Sm off 13974fde40d9SSimon J. Gerraty.Ic \&${ Ar variable Ic \&:${ Ar modifier_variable Ic \&} Oo Ic \&: No ... Oc Ic \&} 13984fde40d9SSimon J. Gerraty.Sm on 13994fde40d9SSimon J. Gerraty.Ed 14003955d011SMarcel Moolenaar.Pp 14014fde40d9SSimon J. GerratyIn this case, the first modifier in the 14024fde40d9SSimon J. Gerraty.Ar modifier_variable 14034fde40d9SSimon J. Gerratydoes not start with a colon, 14044fde40d9SSimon J. Gerratysince that colon already occurs in the referencing variable. 14054fde40d9SSimon J. GerratyIf any of the modifiers in the 14064fde40d9SSimon J. Gerraty.Ar modifier_variable 14074fde40d9SSimon J. Gerratycontains a dollar sign 14083955d011SMarcel Moolenaar.Pq Ql $ , 14093955d011SMarcel Moolenaarthese must be doubled to avoid early expansion. 14103955d011SMarcel Moolenaar.Pp 14114fde40d9SSimon J. GerratySome modifiers interpret the expression value as a single string, 14124fde40d9SSimon J. Gerratyothers treat the expression value as a whitespace-separated list of words. 14134fde40d9SSimon J. GerratyWhen splitting a string into words, 14144fde40d9SSimon J. Gerratywhitespace can be escaped using double quotes, single quotes and backslashes, 14154fde40d9SSimon J. Gerratylike in the shell. 14164fde40d9SSimon J. GerratyThe quotes and backslashes are retained in the words. 14174fde40d9SSimon J. Gerraty.Pp 14183955d011SMarcel MoolenaarThe supported modifiers are: 14193955d011SMarcel Moolenaar.Bl -tag -width EEE 14203955d011SMarcel Moolenaar.It Cm \&:E 14214fde40d9SSimon J. GerratyReplaces each word with its suffix. 14223955d011SMarcel Moolenaar.It Cm \&:H 14234fde40d9SSimon J. GerratyReplaces each word with its dirname. 1424954401e6SSimon J. Gerraty.It Cm \&:M\| Ns Ar pattern 14252c3632d1SSimon J. GerratySelects only those words that match 14263955d011SMarcel Moolenaar.Ar pattern . 14273955d011SMarcel MoolenaarThe standard shell wildcard characters 14283955d011SMarcel Moolenaar.Pf ( Ql * , 14293955d011SMarcel Moolenaar.Ql \&? , 14303955d011SMarcel Moolenaarand 1431954401e6SSimon J. Gerraty.Ql \&[] ) 14323955d011SMarcel Moolenaarmay 14333955d011SMarcel Moolenaarbe used. 14343955d011SMarcel MoolenaarThe wildcard characters may be escaped with a backslash 14353955d011SMarcel Moolenaar.Pq Ql \e . 14360dede8b0SSimon J. GerratyAs a consequence of the way values are split into words, matched, 14374fde40d9SSimon J. Gerratyand then joined, the construct 14384fde40d9SSimon J. Gerraty.Ql ${VAR:M*} 14394fde40d9SSimon J. Gerratyremoves all leading and trailing whitespace 14404fde40d9SSimon J. Gerratyand normalizes the inter-word spacing to a single space. 1441954401e6SSimon J. Gerraty.It Cm \&:N\| Ns Ar pattern 14424fde40d9SSimon J. GerratyThis is the opposite of 1443954401e6SSimon J. Gerraty.Sq Cm \&:M , 14444fde40d9SSimon J. Gerratyselecting all words which do 14454fde40d9SSimon J. Gerraty.Em not 14464fde40d9SSimon J. Gerratymatch 14473955d011SMarcel Moolenaar.Ar pattern . 14483955d011SMarcel Moolenaar.It Cm \&:O 14494fde40d9SSimon J. GerratyOrders the words lexicographically. 145012904384SSimon J. Gerraty.It Cm \&:On 14514fde40d9SSimon J. GerratyOrders the words numerically. 145212904384SSimon J. GerratyA number followed by one of 145312904384SSimon J. Gerraty.Ql k , 145412904384SSimon J. Gerraty.Ql M 145512904384SSimon J. Gerratyor 145612904384SSimon J. Gerraty.Ql G 14574fde40d9SSimon J. Gerratyis multiplied by the appropriate factor, which is 1024 for 14584fde40d9SSimon J. Gerraty.Ql k , 14594fde40d9SSimon J. Gerraty1048576 for 14604fde40d9SSimon J. Gerraty.Ql M , 14614fde40d9SSimon J. Gerratyor 1073741824 for 14624fde40d9SSimon J. Gerraty.Ql G . 146312904384SSimon J. GerratyBoth upper- and lower-case letters are accepted. 1464ef0b2538SSimon J. Gerraty.It Cm \&:Or 14654fde40d9SSimon J. GerratyOrders the words in reverse lexicographical order. 146612904384SSimon J. Gerraty.It Cm \&:Orn 14674fde40d9SSimon J. GerratyOrders the words in reverse numerical order. 14683955d011SMarcel Moolenaar.It Cm \&:Ox 14694fde40d9SSimon J. GerratyShuffles the words. 14704fde40d9SSimon J. GerratyThe results are different each time you are referring to the 14713955d011SMarcel Moolenaarmodified variable; use the assignment with expansion 1472954401e6SSimon J. Gerraty.Sq Cm \&:= 1473be19d90bSSimon J. Gerratyto prevent such behavior. 14743955d011SMarcel MoolenaarFor example, 14753955d011SMarcel Moolenaar.Bd -literal -offset indent 14763955d011SMarcel MoolenaarLIST= uno due tre quattro 14773955d011SMarcel MoolenaarRANDOM_LIST= ${LIST:Ox} 14783955d011SMarcel MoolenaarSTATIC_RANDOM_LIST:= ${LIST:Ox} 14793955d011SMarcel Moolenaar 14803955d011SMarcel Moolenaarall: 14813955d011SMarcel Moolenaar @echo "${RANDOM_LIST}" 14823955d011SMarcel Moolenaar @echo "${RANDOM_LIST}" 14833955d011SMarcel Moolenaar @echo "${STATIC_RANDOM_LIST}" 14843955d011SMarcel Moolenaar @echo "${STATIC_RANDOM_LIST}" 14853955d011SMarcel Moolenaar.Ed 14863955d011SMarcel Moolenaarmay produce output similar to: 14873955d011SMarcel Moolenaar.Bd -literal -offset indent 14883955d011SMarcel Moolenaarquattro due tre uno 14893955d011SMarcel Moolenaartre due quattro uno 14903955d011SMarcel Moolenaardue uno quattro tre 14913955d011SMarcel Moolenaardue uno quattro tre 14923955d011SMarcel Moolenaar.Ed 14933955d011SMarcel Moolenaar.It Cm \&:Q 14944fde40d9SSimon J. GerratyQuotes every shell meta-character in the value, so that it can be passed 14952eae894cSSimon J. Gerratysafely to the shell. 14962eae894cSSimon J. Gerraty.It Cm \&:q 14974fde40d9SSimon J. GerratyQuotes every shell meta-character in the value, and also doubles 14982eae894cSSimon J. Gerraty.Sq $ 14992eae894cSSimon J. Gerratycharacters so that it can be passed 15003955d011SMarcel Moolenaarsafely through recursive invocations of 15013955d011SMarcel Moolenaar.Nm . 15024fde40d9SSimon J. GerratyThis is equivalent to 15034fde40d9SSimon J. Gerraty.Sq Cm \&:S/\e\&$/&&/g:Q . 15043955d011SMarcel Moolenaar.It Cm \&:R 15054fde40d9SSimon J. GerratyReplaces each word with everything but its suffix. 15064fde40d9SSimon J. Gerraty.It Cm \&:range Ns Oo Cm = Ns Ar count Oc 15071ce939a7SSimon J. GerratyThe value is an integer sequence representing the words of the original 15081ce939a7SSimon J. Gerratyvalue, or the supplied 15094fde40d9SSimon J. Gerraty.Ar count . 15104fde40d9SSimon J. Gerraty.It Cm \&:gmtime Ns Oo Cm = Ns Ar timestamp Oc 15114fde40d9SSimon J. GerratyThe value is interpreted as a format string for 15123955d011SMarcel Moolenaar.Xr strftime 3 , 15131ce939a7SSimon J. Gerratyusing 15144fde40d9SSimon J. Gerraty.Xr gmtime 3 , 15154fde40d9SSimon J. Gerratyproducing the formatted timestamp. 151698875883SSimon J. GerratyNote: the 151798875883SSimon J. Gerraty.Ql %s 151898875883SSimon J. Gerratyformat should only be used with 151998875883SSimon J. Gerraty.Sq Cm \&:localtime . 15201ce939a7SSimon J. GerratyIf a 15214fde40d9SSimon J. Gerraty.Ar timestamp 15221ce939a7SSimon J. Gerratyvalue is not provided or is 0, the current time is used. 15233955d011SMarcel Moolenaar.It Cm \&:hash 15244fde40d9SSimon J. GerratyComputes a 32-bit hash of the value and encodes it as 8 hex digits. 15254fde40d9SSimon J. Gerraty.It Cm \&:localtime Ns Oo Cm = Ns Ar timestamp Oc 15264fde40d9SSimon J. GerratyThe value is interpreted as a format string for 15273955d011SMarcel Moolenaar.Xr strftime 3 , 15281ce939a7SSimon J. Gerratyusing 15294fde40d9SSimon J. Gerraty.Xr localtime 3 , 15304fde40d9SSimon J. Gerratyproducing the formatted timestamp. 15311ce939a7SSimon J. GerratyIf a 15324fde40d9SSimon J. Gerraty.Ar timestamp 15331ce939a7SSimon J. Gerratyvalue is not provided or is 0, the current time is used. 1534c1d01b5fSSimon J. Gerraty.It Cm \&:mtime Ns Oo Cm = Ns Ar timestamp Oc 1535c1d01b5fSSimon J. GerratyCall 1536c1d01b5fSSimon J. Gerraty.Xr stat 2 1537c1d01b5fSSimon J. Gerratywith each word as pathname; 1538c1d01b5fSSimon J. Gerratyuse 1539c1d01b5fSSimon J. Gerraty.Ql st_mtime 1540c1d01b5fSSimon J. Gerratyas the new value. 1541c1d01b5fSSimon J. GerratyIf 1542c1d01b5fSSimon J. Gerraty.Xr stat 2 1543c1d01b5fSSimon J. Gerratyfails; use 1544c1d01b5fSSimon J. Gerraty.Ar timestamp 1545c1d01b5fSSimon J. Gerratyor current time. 1546c1d01b5fSSimon J. GerratyIf 1547c1d01b5fSSimon J. Gerraty.Ar timestamp 1548c1d01b5fSSimon J. Gerratyis set to 1549c1d01b5fSSimon J. Gerraty.Ql error , 1550c1d01b5fSSimon J. Gerratythen 1551c1d01b5fSSimon J. Gerraty.Xr stat 2 1552c1d01b5fSSimon J. Gerratyfailure will cause an error. 15533955d011SMarcel Moolenaar.It Cm \&:tA 15544fde40d9SSimon J. GerratyAttempts to convert the value to an absolute path using 15554fde40d9SSimon J. Gerraty.Xr realpath 3 . 15564fde40d9SSimon J. GerratyIf that fails, the value is unchanged. 15573955d011SMarcel Moolenaar.It Cm \&:tl 15584fde40d9SSimon J. GerratyConverts the value to lower-case letters. 15593955d011SMarcel Moolenaar.It Cm \&:ts Ns Ar c 15604fde40d9SSimon J. GerratyWhen joining the words after a modifier that treats the value as words, 15614fde40d9SSimon J. Gerratythe words are normally separated by a space. 15624fde40d9SSimon J. GerratyThis modifier changes the separator to the character 15633955d011SMarcel Moolenaar.Ar c . 15643955d011SMarcel MoolenaarIf 15653955d011SMarcel Moolenaar.Ar c 15664fde40d9SSimon J. Gerratyis omitted, no separator is used. 15672c3632d1SSimon J. GerratyThe common escapes (including octal numeric codes) work as expected. 15683955d011SMarcel Moolenaar.It Cm \&:tu 15694fde40d9SSimon J. GerratyConverts the value to upper-case letters. 15703955d011SMarcel Moolenaar.It Cm \&:tW 15714fde40d9SSimon J. GerratyCauses subsequent modifiers to treat the value as a single word 15723955d011SMarcel Moolenaar(possibly containing embedded whitespace). 15733955d011SMarcel MoolenaarSee also 1574954401e6SSimon J. Gerraty.Sq Cm \&:[*] . 15753955d011SMarcel Moolenaar.It Cm \&:tw 15764fde40d9SSimon J. GerratyCauses the value to be treated as a list of words. 15773955d011SMarcel MoolenaarSee also 1578954401e6SSimon J. Gerraty.Sq Cm \&:[@] . 15793955d011SMarcel Moolenaar.Sm off 1580954401e6SSimon J. Gerraty.It Cm \&:S\| No \&/ Ar old_string\| No \&/ Ar new_string\| No \&/ Op Cm 1gW 15813955d011SMarcel Moolenaar.Sm on 15822c3632d1SSimon J. GerratyModifies the first occurrence of 15833955d011SMarcel Moolenaar.Ar old_string 15844fde40d9SSimon J. Gerratyin each word of the value, replacing it with 15853955d011SMarcel Moolenaar.Ar new_string . 15863955d011SMarcel MoolenaarIf a 15873955d011SMarcel Moolenaar.Ql g 15884fde40d9SSimon J. Gerratyis appended to the last delimiter of the pattern, 15894fde40d9SSimon J. Gerratyall occurrences in each word are replaced. 15903955d011SMarcel MoolenaarIf a 15913955d011SMarcel Moolenaar.Ql 1 15924fde40d9SSimon J. Gerratyis appended to the last delimiter of the pattern, 15934fde40d9SSimon J. Gerratyonly the first occurrence is affected. 15943955d011SMarcel MoolenaarIf a 15953955d011SMarcel Moolenaar.Ql W 15962c3632d1SSimon J. Gerratyis appended to the last delimiter of the pattern, 15974fde40d9SSimon J. Gerratythe value is treated as a single word. 15983955d011SMarcel MoolenaarIf 15993955d011SMarcel Moolenaar.Ar old_string 16003955d011SMarcel Moolenaarbegins with a caret 16013955d011SMarcel Moolenaar.Pq Ql ^ , 16023955d011SMarcel Moolenaar.Ar old_string 16033955d011SMarcel Moolenaaris anchored at the beginning of each word. 16043955d011SMarcel MoolenaarIf 16053955d011SMarcel Moolenaar.Ar old_string 16063955d011SMarcel Moolenaarends with a dollar sign 16073955d011SMarcel Moolenaar.Pq Ql \&$ , 16083955d011SMarcel Moolenaarit is anchored at the end of each word. 16093955d011SMarcel MoolenaarInside 16103955d011SMarcel Moolenaar.Ar new_string , 16113955d011SMarcel Moolenaaran ampersand 16128695518cSSimon J. Gerraty.Pq Ql & 16133955d011SMarcel Moolenaaris replaced by 16143955d011SMarcel Moolenaar.Ar old_string 16154fde40d9SSimon J. Gerraty(without the anchoring 16163955d011SMarcel Moolenaar.Ql ^ 16173955d011SMarcel Moolenaaror 16183955d011SMarcel Moolenaar.Ql \&$ ) . 16194fde40d9SSimon J. GerratyAny character may be used as the delimiter for the parts of the modifier 16203955d011SMarcel Moolenaarstring. 16214fde40d9SSimon J. GerratyThe anchoring, ampersand and delimiter characters can be escaped with a 16223955d011SMarcel Moolenaarbackslash 16233955d011SMarcel Moolenaar.Pq Ql \e . 16243955d011SMarcel Moolenaar.Pp 16254fde40d9SSimon J. GerratyBoth 16263955d011SMarcel Moolenaar.Ar old_string 16273955d011SMarcel Moolenaarand 16283955d011SMarcel Moolenaar.Ar new_string 16294fde40d9SSimon J. Gerratymay contain nested expressions. 16304fde40d9SSimon J. GerratyTo prevent a dollar sign from starting a nested expression, 16314fde40d9SSimon J. Gerratyescape it with a backslash. 16323955d011SMarcel Moolenaar.Sm off 1633954401e6SSimon J. Gerraty.It Cm \&:C\| No \&/ Ar pattern\| No \&/ Ar replacement\| No \&/ Op Cm 1gW 16343955d011SMarcel Moolenaar.Sm on 16353955d011SMarcel MoolenaarThe 16363955d011SMarcel Moolenaar.Cm \&:C 16374fde40d9SSimon J. Gerratymodifier works like the 16383955d011SMarcel Moolenaar.Cm \&:S 16393955d011SMarcel Moolenaarmodifier except that the old and new strings, instead of being 16404fde40d9SSimon J. Gerratysimple strings, are an extended regular expression 16413955d011SMarcel Moolenaar.Ar pattern 16424fde40d9SSimon J. Gerraty(see 16434fde40d9SSimon J. Gerraty.Xr regex 3 ) 16443955d011SMarcel Moolenaarand an 16453955d011SMarcel Moolenaar.Xr ed 1 Ns \-style 16463955d011SMarcel Moolenaar.Ar replacement . 16473955d011SMarcel MoolenaarNormally, the first occurrence of the pattern 16483955d011SMarcel Moolenaar.Ar pattern 16493955d011SMarcel Moolenaarin each word of the value is substituted with 16503955d011SMarcel Moolenaar.Ar replacement . 16513955d011SMarcel MoolenaarThe 16523955d011SMarcel Moolenaar.Ql 1 16533955d011SMarcel Moolenaarmodifier causes the substitution to apply to at most one word; the 16543955d011SMarcel Moolenaar.Ql g 16553955d011SMarcel Moolenaarmodifier causes the substitution to apply to as many instances of the 16563955d011SMarcel Moolenaarsearch pattern 16573955d011SMarcel Moolenaar.Ar pattern 16583955d011SMarcel Moolenaaras occur in the word or words it is found in; the 16593955d011SMarcel Moolenaar.Ql W 16603955d011SMarcel Moolenaarmodifier causes the value to be treated as a single word 16613955d011SMarcel Moolenaar(possibly containing embedded whitespace). 16625bcb7424SSimon J. Gerraty.Pp 16635bcb7424SSimon J. GerratyAs for the 16645bcb7424SSimon J. Gerraty.Cm \&:S 16655bcb7424SSimon J. Gerratymodifier, the 16665bcb7424SSimon J. Gerraty.Ar pattern 16675bcb7424SSimon J. Gerratyand 16685bcb7424SSimon J. Gerraty.Ar replacement 16695bcb7424SSimon J. Gerratyare subjected to variable expansion before being parsed as 16705bcb7424SSimon J. Gerratyregular expressions. 16713955d011SMarcel Moolenaar.It Cm \&:T 16724fde40d9SSimon J. GerratyReplaces each word with its last path component (basename). 16733955d011SMarcel Moolenaar.It Cm \&:u 16742c3632d1SSimon J. GerratyRemoves adjacent duplicate words (like 16753955d011SMarcel Moolenaar.Xr uniq 1 ) . 16763955d011SMarcel Moolenaar.Sm off 1677954401e6SSimon J. Gerraty.It Cm \&:\&?\| Ar true_string\| Cm \&: Ar false_string 16783955d011SMarcel Moolenaar.Sm on 16794fde40d9SSimon J. GerratyIf the variable name (not its value), when parsed as a 16804fde40d9SSimon J. Gerraty.Cm .if 16814fde40d9SSimon J. Gerratyconditional expression, evaluates to true, return as its value the 16823955d011SMarcel Moolenaar.Ar true_string , 16833955d011SMarcel Moolenaarotherwise return the 16843955d011SMarcel Moolenaar.Ar false_string . 16854fde40d9SSimon J. GerratySince the variable name is used as the expression, 16864fde40d9SSimon J. Gerraty\&:\&? must be the first modifier after the variable name 16874fde40d9SSimon J. Gerraty.No itself Ns \^\(em\^ Ns 16884fde40d9SSimon J. Gerratywhich, of course, usually contains variable expansions. 16893955d011SMarcel MoolenaarA common error is trying to use expressions like 16903955d011SMarcel Moolenaar.Dl ${NUMBERS:M42:?match:no} 16914fde40d9SSimon J. Gerratywhich actually tests defined(NUMBERS). 16924fde40d9SSimon J. GerratyTo determine if any words match 16934fde40d9SSimon J. Gerraty.Dq 42 , 16944fde40d9SSimon J. Gerratyyou need to use something like: 16953955d011SMarcel Moolenaar.Dl ${"${NUMBERS:M42}" != \&"\&":?match:no} . 1696954401e6SSimon J. Gerraty.It Cm :\| Ns Ar old_string\| Ns Cm = Ns Ar new_string 16973955d011SMarcel MoolenaarThis is the 16983955d011SMarcel Moolenaar.At V 16994fde40d9SSimon J. Gerratystyle substitution. 17004fde40d9SSimon J. GerratyIt can only be the last modifier specified, 17014fde40d9SSimon J. Gerratyas a 17024fde40d9SSimon J. Gerraty.Ql \&: 17034fde40d9SSimon J. Gerratyin either 17044fde40d9SSimon J. Gerraty.Ar old_string 17054fde40d9SSimon J. Gerratyor 17064fde40d9SSimon J. Gerraty.Ar new_string 17074fde40d9SSimon J. Gerratyis treated as a regular character, not as the end of the modifier. 17084fde40d9SSimon J. Gerraty.Pp 17093955d011SMarcel MoolenaarIf 17103955d011SMarcel Moolenaar.Ar old_string 17114fde40d9SSimon J. Gerratydoes not contain the pattern matching character 17124fde40d9SSimon J. Gerraty.Ql % , 17134fde40d9SSimon J. Gerratyand the word ends with 17143955d011SMarcel Moolenaar.Ar old_string 17154fde40d9SSimon J. Gerratyor equals it, 17164fde40d9SSimon J. Gerratythat suffix is replaced with 17173955d011SMarcel Moolenaar.Ar new_string . 17183955d011SMarcel Moolenaar.Pp 17194fde40d9SSimon J. GerratyOtherwise, the first 17204fde40d9SSimon J. Gerraty.Ql % 17214fde40d9SSimon J. Gerratyin 17224fde40d9SSimon J. Gerraty.Ar old_string 17234fde40d9SSimon J. Gerratymatches a possibly empty substring of arbitrary characters, 17244fde40d9SSimon J. Gerratyand if the whole pattern is found in the word, 17254fde40d9SSimon J. Gerratythe matching part is replaced with 17264fde40d9SSimon J. Gerraty.Ar new_string , 17274fde40d9SSimon J. Gerratyand the first occurrence of 17284fde40d9SSimon J. Gerraty.Ql % 17294fde40d9SSimon J. Gerratyin 17304fde40d9SSimon J. Gerraty.Ar new_string 17314fde40d9SSimon J. Gerraty(if any) is replaced with the substring matched by the 17324fde40d9SSimon J. Gerraty.Ql % . 17334fde40d9SSimon J. Gerraty.Pp 17344fde40d9SSimon J. GerratyBoth 17353955d011SMarcel Moolenaar.Ar old_string 17363955d011SMarcel Moolenaarand 17373955d011SMarcel Moolenaar.Ar new_string 17384fde40d9SSimon J. Gerratymay contain nested expressions. 17394fde40d9SSimon J. GerratyTo prevent a dollar sign from starting a nested expression, 17404fde40d9SSimon J. Gerratyescape it with a backslash. 17413955d011SMarcel Moolenaar.Sm off 17424fde40d9SSimon J. Gerraty.It Cm \&:@ Ar varname\| Cm @ Ar string\| Cm @ 17433955d011SMarcel Moolenaar.Sm on 17443955d011SMarcel MoolenaarThis is the loop expansion mechanism from the OSF Development 17453955d011SMarcel MoolenaarEnvironment (ODE) make. 17463955d011SMarcel MoolenaarUnlike 17473955d011SMarcel Moolenaar.Cm \&.for 17482c3632d1SSimon J. Gerratyloops, expansion occurs at the time of reference. 17494fde40d9SSimon J. GerratyFor each word in the value, assign the word to the variable named 17504fde40d9SSimon J. Gerraty.Ar varname 17514fde40d9SSimon J. Gerratyand evaluate 17523955d011SMarcel Moolenaar.Ar string . 17533955d011SMarcel MoolenaarThe ODE convention is that 17544fde40d9SSimon J. Gerraty.Ar varname 17554fde40d9SSimon J. Gerratyshould start and end with a period, for example: 17563955d011SMarcel Moolenaar.Dl ${LINKS:@.LINK.@${LN} ${TARGET} ${.LINK.}@} 17573955d011SMarcel Moolenaar.Pp 17584fde40d9SSimon J. GerratyHowever, a single-letter variable is often more readable: 17593955d011SMarcel Moolenaar.Dl ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@} 1760954401e6SSimon J. Gerraty.It Cm \&:_ Ns Oo Cm = Ns Ar var Oc 17612c3632d1SSimon J. GerratySaves the current variable value in 17621ce939a7SSimon J. Gerraty.Ql $_ 17631ce939a7SSimon J. Gerratyor the named 17644fde40d9SSimon J. Gerraty.Ar var 17651ce939a7SSimon J. Gerratyfor later reference. 17661ce939a7SSimon J. GerratyExample usage: 17671ce939a7SSimon J. Gerraty.Bd -literal -offset indent 17681ce939a7SSimon J. GerratyM_cmpv.units = 1 1000 1000000 17691ce939a7SSimon J. GerratyM_cmpv = S,., ,g:_:range:@i@+ $${_:[-$$i]} \&\\ 17701ce939a7SSimon J. Gerraty\\* $${M_cmpv.units:[$$i]}@:S,^,expr 0 ,1:sh 17711ce939a7SSimon J. Gerraty 17721ce939a7SSimon J. Gerraty.Dv .if ${VERSION:${M_cmpv}} < ${3.1.12:L:${M_cmpv}} 17731ce939a7SSimon J. Gerraty 17741ce939a7SSimon J. Gerraty.Ed 17751ce939a7SSimon J. GerratyHere 17761ce939a7SSimon J. Gerraty.Ql $_ 17771ce939a7SSimon J. Gerratyis used to save the result of the 17781ce939a7SSimon J. Gerraty.Ql :S 17791ce939a7SSimon J. Gerratymodifier which is later referenced using the index values from 17801ce939a7SSimon J. Gerraty.Ql :range . 1781954401e6SSimon J. Gerraty.It Cm \&:U\| Ns Ar newval 17822c3632d1SSimon J. GerratyIf the variable is undefined, 1783*c59c3bf3SSimon J. Gerratythe optional 17843955d011SMarcel Moolenaar.Ar newval 1785*c59c3bf3SSimon J. Gerraty(which may be empty) is the value. 17863955d011SMarcel MoolenaarIf the variable is defined, the existing value is returned. 17873955d011SMarcel MoolenaarThis is another ODE make feature. 17883955d011SMarcel MoolenaarIt is handy for setting per-target CFLAGS for instance: 17893955d011SMarcel Moolenaar.Dl ${_${.TARGET:T}_CFLAGS:U${DEF_CFLAGS}} 17903955d011SMarcel MoolenaarIf a value is only required if the variable is undefined, use: 17913955d011SMarcel Moolenaar.Dl ${VAR:D:Unewval} 1792954401e6SSimon J. Gerraty.It Cm \&:D\| Ns Ar newval 17932c3632d1SSimon J. GerratyIf the variable is defined, 17943955d011SMarcel Moolenaar.Ar newval 1795*c59c3bf3SSimon J. Gerraty(which may be empty) is the value. 17963955d011SMarcel Moolenaar.It Cm \&:L 17973955d011SMarcel MoolenaarThe name of the variable is the value. 17983955d011SMarcel Moolenaar.It Cm \&:P 17994fde40d9SSimon J. GerratyThe path of the node which has the same name as the variable is the value. 18004fde40d9SSimon J. GerratyIf no such node exists or its path is null, the name of the variable is used. 18013955d011SMarcel MoolenaarIn order for this modifier to work, the name (node) must at least have 18024fde40d9SSimon J. Gerratyappeared on the right-hand side of a dependency. 18033955d011SMarcel Moolenaar.Sm off 1804954401e6SSimon J. Gerraty.It Cm \&:\&! Ar cmd\| Cm \&! 18053955d011SMarcel Moolenaar.Sm on 18063955d011SMarcel MoolenaarThe output of running 18073955d011SMarcel Moolenaar.Ar cmd 18083955d011SMarcel Moolenaaris the value. 18093955d011SMarcel Moolenaar.It Cm \&:sh 18104fde40d9SSimon J. GerratyThe value is run as a command, and the output becomes the new value. 18113955d011SMarcel Moolenaar.It Cm \&::= Ns Ar str 18123955d011SMarcel MoolenaarThe variable is assigned the value 18133955d011SMarcel Moolenaar.Ar str 18143955d011SMarcel Moolenaarafter substitution. 18154fde40d9SSimon J. GerratyThis modifier and its variations are useful in obscure situations 18164fde40d9SSimon J. Gerratysuch as wanting to set a variable 18174fde40d9SSimon J. Gerratyat a point where a target's shell commands are being parsed. 18184fde40d9SSimon J. GerratyThese assignment modifiers always expand to nothing. 18193955d011SMarcel Moolenaar.Pp 18203955d011SMarcel MoolenaarThe 1821954401e6SSimon J. Gerraty.Sq Cm \&:: 18223955d011SMarcel Moolenaarhelps avoid false matches with the 18233955d011SMarcel Moolenaar.At V 18243955d011SMarcel Moolenaarstyle 18254fde40d9SSimon J. Gerraty.Ql \&:= 18264fde40d9SSimon J. Gerratymodifier and since substitution always occurs, the 18274fde40d9SSimon J. Gerraty.Ql \&::= 18283955d011SMarcel Moolenaarform is vaguely appropriate. 18293955d011SMarcel Moolenaar.It Cm \&::?= Ns Ar str 18303955d011SMarcel MoolenaarAs for 18313955d011SMarcel Moolenaar.Cm \&::= 18323955d011SMarcel Moolenaarbut only if the variable does not already have a value. 18333955d011SMarcel Moolenaar.It Cm \&::+= Ns Ar str 18343955d011SMarcel MoolenaarAppend 18353955d011SMarcel Moolenaar.Ar str 18363955d011SMarcel Moolenaarto the variable. 18373955d011SMarcel Moolenaar.It Cm \&::!= Ns Ar cmd 18383955d011SMarcel MoolenaarAssign the output of 18393955d011SMarcel Moolenaar.Ar cmd 18403955d011SMarcel Moolenaarto the variable. 18413955d011SMarcel Moolenaar.It Cm \&:\&[ Ns Ar range Ns Cm \&] 18423955d011SMarcel MoolenaarSelects one or more words from the value, 18433955d011SMarcel Moolenaaror performs other operations related to the way in which the 18444fde40d9SSimon J. Gerratyvalue is split into words. 18453955d011SMarcel Moolenaar.Pp 18463955d011SMarcel MoolenaarAn empty value, or a value that consists entirely of white-space, 18473955d011SMarcel Moolenaaris treated as a single word. 18483955d011SMarcel MoolenaarFor the purposes of the 1849954401e6SSimon J. Gerraty.Sq Cm \&:[] 18503955d011SMarcel Moolenaarmodifier, the words are indexed both forwards using positive integers 18513955d011SMarcel Moolenaar(where index 1 represents the first word), 18523955d011SMarcel Moolenaarand backwards using negative integers 18533955d011SMarcel Moolenaar(where index \-1 represents the last word). 18543955d011SMarcel Moolenaar.Pp 18553955d011SMarcel MoolenaarThe 18563955d011SMarcel Moolenaar.Ar range 18573955d011SMarcel Moolenaaris subjected to variable expansion, and the expanded result is 18583955d011SMarcel Moolenaarthen interpreted as follows: 18593955d011SMarcel Moolenaar.Bl -tag -width index 18603955d011SMarcel Moolenaar.\" :[n] 18613955d011SMarcel Moolenaar.It Ar index 18623955d011SMarcel MoolenaarSelects a single word from the value. 18633955d011SMarcel Moolenaar.\" :[start..end] 18643955d011SMarcel Moolenaar.It Ar start Ns Cm \&.. Ns Ar end 18653955d011SMarcel MoolenaarSelects all words from 18663955d011SMarcel Moolenaar.Ar start 18673955d011SMarcel Moolenaarto 18683955d011SMarcel Moolenaar.Ar end , 18693955d011SMarcel Moolenaarinclusive. 18703955d011SMarcel MoolenaarFor example, 1871954401e6SSimon J. Gerraty.Sq Cm \&:[2..-1] 18723955d011SMarcel Moolenaarselects all words from the second word to the last word. 18733955d011SMarcel MoolenaarIf 18743955d011SMarcel Moolenaar.Ar start 18753955d011SMarcel Moolenaaris greater than 18763955d011SMarcel Moolenaar.Ar end , 18774fde40d9SSimon J. Gerratythe words are output in reverse order. 18783955d011SMarcel MoolenaarFor example, 1879954401e6SSimon J. Gerraty.Sq Cm \&:[-1..1] 18803955d011SMarcel Moolenaarselects all the words from last to first. 18814fde40d9SSimon J. GerratyIf the list is already ordered, 18824fde40d9SSimon J. Gerratythis effectively reverses the list, 18834fde40d9SSimon J. Gerratybut it is more efficient to use 1884954401e6SSimon J. Gerraty.Sq Cm \&:Or 1885ef0b2538SSimon J. Gerratyinstead of 1886954401e6SSimon J. Gerraty.Sq Cm \&:O:[-1..1] . 18873955d011SMarcel Moolenaar.\" :[*] 18883955d011SMarcel Moolenaar.It Cm \&* 18893955d011SMarcel MoolenaarCauses subsequent modifiers to treat the value as a single word 18903955d011SMarcel Moolenaar(possibly containing embedded whitespace). 18913955d011SMarcel MoolenaarAnalogous to the effect of 18924fde40d9SSimon J. Gerraty.Li \&$* 18933955d011SMarcel Moolenaarin Bourne shell. 18943955d011SMarcel Moolenaar.\" :[0] 18953955d011SMarcel Moolenaar.It 0 18963955d011SMarcel MoolenaarMeans the same as 1897954401e6SSimon J. Gerraty.Sq Cm \&:[*] . 18983955d011SMarcel Moolenaar.\" :[*] 18993955d011SMarcel Moolenaar.It Cm \&@ 19003955d011SMarcel MoolenaarCauses subsequent modifiers to treat the value as a sequence of words 19013955d011SMarcel Moolenaardelimited by whitespace. 19023955d011SMarcel MoolenaarAnalogous to the effect of 19034fde40d9SSimon J. Gerraty.Li \&$@ 19043955d011SMarcel Moolenaarin Bourne shell. 19053955d011SMarcel Moolenaar.\" :[#] 19063955d011SMarcel Moolenaar.It Cm \&# 19073955d011SMarcel MoolenaarReturns the number of words in the value. 19083955d011SMarcel Moolenaar.El \" :[range] 19093955d011SMarcel Moolenaar.El 19104fde40d9SSimon J. Gerraty.Sh DIRECTIVES 19114fde40d9SSimon J. Gerraty.Nm 19124fde40d9SSimon J. Gerratyoffers directives for including makefiles, conditionals and for loops. 19134fde40d9SSimon J. GerratyAll these directives are identified by a line beginning with a single dot 19143955d011SMarcel Moolenaar.Pq Ql \&. 19154fde40d9SSimon J. Gerratycharacter, followed by the keyword of the directive, such as 19164fde40d9SSimon J. Gerraty.Cm include 19174fde40d9SSimon J. Gerratyor 19184fde40d9SSimon J. Gerraty.Cm if . 19194fde40d9SSimon J. Gerraty.Ss File inclusion 19203955d011SMarcel MoolenaarFiles are included with either 1921ef0b2538SSimon J. Gerraty.Cm \&.include \&< Ns Ar file Ns Cm \&> 19223955d011SMarcel Moolenaaror 1923ef0b2538SSimon J. Gerraty.Cm \&.include \&\*q Ns Ar file Ns Cm \&\*q . 19243955d011SMarcel MoolenaarVariables between the angle brackets or double quotes are expanded 19253955d011SMarcel Moolenaarto form the file name. 19263955d011SMarcel MoolenaarIf angle brackets are used, the included makefile is expected to be in 19273955d011SMarcel Moolenaarthe system makefile directory. 19283955d011SMarcel MoolenaarIf double quotes are used, the including makefile's directory and any 19293955d011SMarcel Moolenaardirectories specified using the 19303955d011SMarcel Moolenaar.Fl I 19314fde40d9SSimon J. Gerratyoption are searched before the system makefile directory. 19324fde40d9SSimon J. Gerraty.Pp 19334fde40d9SSimon J. GerratyFor compatibility with other make variants, 19344fde40d9SSimon J. Gerraty.Sq Cm include Ar file No ... 19354fde40d9SSimon J. Gerraty(without leading dot) 19363955d011SMarcel Moolenaaris also accepted. 1937be19d90bSSimon J. Gerraty.Pp 19383955d011SMarcel MoolenaarIf the include statement is written as 19393955d011SMarcel Moolenaar.Cm .-include 19403955d011SMarcel Moolenaaror as 19414fde40d9SSimon J. Gerraty.Cm .sinclude , 19424fde40d9SSimon J. Gerratyerrors locating and/or opening include files are ignored. 19433955d011SMarcel Moolenaar.Pp 1944be19d90bSSimon J. GerratyIf the include statement is written as 19454fde40d9SSimon J. Gerraty.Cm .dinclude , 1946be19d90bSSimon J. Gerratynot only are errors locating and/or opening include files ignored, 19474fde40d9SSimon J. Gerratybut stale dependencies within the included file are ignored just like in 1948be19d90bSSimon J. Gerraty.Va .MAKE.DEPENDFILE . 19494fde40d9SSimon J. Gerraty.Ss Exporting variables 19504fde40d9SSimon J. GerratyThe directives for exporting and unexporting variables are: 19513955d011SMarcel Moolenaar.Bl -tag -width Ds 19524fde40d9SSimon J. Gerraty.It Ic .export Ar variable No ... 19533955d011SMarcel MoolenaarExport the specified global variable. 19543955d011SMarcel MoolenaarIf no variable list is provided, all globals are exported 19553955d011SMarcel Moolenaarexcept for internal variables (those that start with 19563955d011SMarcel Moolenaar.Ql \&. ) . 19573955d011SMarcel MoolenaarThis is not affected by the 19583955d011SMarcel Moolenaar.Fl X 19593955d011SMarcel Moolenaarflag, so should be used with caution. 19604fde40d9SSimon J. GerratyFor compatibility with other make programs, 19614fde40d9SSimon J. Gerraty.Cm export Ar variable\| Ns Cm \&= Ns Ar value 19624fde40d9SSimon J. Gerraty(without leading dot) is also accepted. 19633955d011SMarcel Moolenaar.Pp 19643955d011SMarcel MoolenaarAppending a variable name to 19653955d011SMarcel Moolenaar.Va .MAKE.EXPORTED 19663955d011SMarcel Moolenaaris equivalent to exporting a variable. 19674fde40d9SSimon J. Gerraty.It Ic .export-env Ar variable No ... 19683955d011SMarcel MoolenaarThe same as 19693955d011SMarcel Moolenaar.Ql .export , 19703955d011SMarcel Moolenaarexcept that the variable is not appended to 19713955d011SMarcel Moolenaar.Va .MAKE.EXPORTED . 19723955d011SMarcel MoolenaarThis allows exporting a value to the environment which is different from that 19733955d011SMarcel Moolenaarused by 19743955d011SMarcel Moolenaar.Nm 19753955d011SMarcel Moolenaarinternally. 19764fde40d9SSimon J. Gerraty.It Ic .export-literal Ar variable No ... 1977be19d90bSSimon J. GerratyThe same as 1978be19d90bSSimon J. Gerraty.Ql .export-env , 1979be19d90bSSimon J. Gerratyexcept that variables in the value are not expanded. 19804fde40d9SSimon J. Gerraty.It Ic .unexport Ar variable No ... 19813955d011SMarcel MoolenaarThe opposite of 19823955d011SMarcel Moolenaar.Ql .export . 19833955d011SMarcel MoolenaarThe specified global 19844fde40d9SSimon J. Gerraty.Ar variable 19854fde40d9SSimon J. Gerratyis removed from 19863955d011SMarcel Moolenaar.Va .MAKE.EXPORTED . 19873955d011SMarcel MoolenaarIf no variable list is provided, all globals are unexported, 19883955d011SMarcel Moolenaarand 19893955d011SMarcel Moolenaar.Va .MAKE.EXPORTED 19903955d011SMarcel Moolenaardeleted. 19913955d011SMarcel Moolenaar.It Ic .unexport-env 19923955d011SMarcel MoolenaarUnexport all globals previously exported and 19933955d011SMarcel Moolenaarclear the environment inherited from the parent. 19944fde40d9SSimon J. GerratyThis operation causes a memory leak of the original environment, 19953955d011SMarcel Moolenaarso should be used sparingly. 19963955d011SMarcel MoolenaarTesting for 19973955d011SMarcel Moolenaar.Va .MAKE.LEVEL 19984fde40d9SSimon J. Gerratybeing 0 would make sense. 19993955d011SMarcel MoolenaarAlso note that any variables which originated in the parent environment 20003955d011SMarcel Moolenaarshould be explicitly preserved if desired. 20013955d011SMarcel MoolenaarFor example: 20023955d011SMarcel Moolenaar.Bd -literal -offset indent 20033955d011SMarcel Moolenaar.Li .if ${.MAKE.LEVEL} == 0 20043955d011SMarcel MoolenaarPATH := ${PATH} 20053955d011SMarcel Moolenaar.Li .unexport-env 20063955d011SMarcel Moolenaar.Li .export PATH 20073955d011SMarcel Moolenaar.Li .endif 20083955d011SMarcel Moolenaar.Pp 20093955d011SMarcel Moolenaar.Ed 20103955d011SMarcel MoolenaarWould result in an environment containing only 2011954401e6SSimon J. Gerraty.Sq Ev PATH , 20123955d011SMarcel Moolenaarwhich is the minimal useful environment. 20134fde40d9SSimon J. Gerraty.\" TODO: Check the below sentence, environment variables don't start with '.'. 20143955d011SMarcel MoolenaarActually 20154fde40d9SSimon J. Gerraty.Sq Va .MAKE.LEVEL 20164fde40d9SSimon J. Gerratyis also pushed into the new environment. 20174fde40d9SSimon J. Gerraty.El 20184fde40d9SSimon J. Gerraty.Ss Messages 20194fde40d9SSimon J. GerratyThe directives for printing messages to the output are: 20204fde40d9SSimon J. Gerraty.Bl -tag -width Ds 20214fde40d9SSimon J. Gerraty.It Ic .info Ar message 20224fde40d9SSimon J. GerratyThe message is printed along with the name of the makefile and line number. 20233955d011SMarcel Moolenaar.It Ic .warning Ar message 20243955d011SMarcel MoolenaarThe message prefixed by 20254fde40d9SSimon J. Gerraty.Sq Li warning: 20263955d011SMarcel Moolenaaris printed along with the name of the makefile and line number. 20274fde40d9SSimon J. Gerraty.It Ic .error Ar message 20284fde40d9SSimon J. GerratyThe message is printed along with the name of the makefile and line number, 20294fde40d9SSimon J. Gerraty.Nm 20304fde40d9SSimon J. Gerratyexits immediately. 20314fde40d9SSimon J. Gerraty.El 20324fde40d9SSimon J. Gerraty.Ss Conditionals 20334fde40d9SSimon J. GerratyThe directives for conditionals are: 20344fde40d9SSimon J. Gerraty.ds maybenot Oo Ic \&! Oc Ns 20354fde40d9SSimon J. Gerraty.Bl -tag 20364fde40d9SSimon J. Gerraty.It Ic .if \*[maybenot] Ar expression Op Ar operator expression No ... 20373955d011SMarcel MoolenaarTest the value of an expression. 20384fde40d9SSimon J. Gerraty.It Ic .ifdef \*[maybenot] Ar variable Op Ar operator variable No ... 20394fde40d9SSimon J. GerratyTest whether a variable is defined. 20404fde40d9SSimon J. Gerraty.It Ic .ifndef \*[maybenot] Ar variable Op Ar operator variable No ... 20414fde40d9SSimon J. GerratyTest whether a variable is not defined. 20424fde40d9SSimon J. Gerraty.It Ic .ifmake \*[maybenot] Ar target Op Ar operator target No ... 20434fde40d9SSimon J. GerratyTest the target being requested. 20444fde40d9SSimon J. Gerraty.It Ic .ifnmake \*[maybenot] Ar target Op Ar operator target No ... 20454fde40d9SSimon J. GerratyTest the target being requested. 20463955d011SMarcel Moolenaar.It Ic .else 20473955d011SMarcel MoolenaarReverse the sense of the last conditional. 20484fde40d9SSimon J. Gerraty.It Ic .elif \*[maybenot] Ar expression Op Ar operator expression No ... 20493955d011SMarcel MoolenaarA combination of 2050954401e6SSimon J. Gerraty.Sq Ic .else 20513955d011SMarcel Moolenaarfollowed by 2052954401e6SSimon J. Gerraty.Sq Ic .if . 20534fde40d9SSimon J. Gerraty.It Ic .elifdef \*[maybenot] Ar variable Op Ar operator variable No ... 20543955d011SMarcel MoolenaarA combination of 2055954401e6SSimon J. Gerraty.Sq Ic .else 20563955d011SMarcel Moolenaarfollowed by 2057954401e6SSimon J. Gerraty.Sq Ic .ifdef . 20584fde40d9SSimon J. Gerraty.It Ic .elifndef \*[maybenot] Ar variable Op Ar operator variable No ... 20593955d011SMarcel MoolenaarA combination of 2060954401e6SSimon J. Gerraty.Sq Ic .else 20613955d011SMarcel Moolenaarfollowed by 2062954401e6SSimon J. Gerraty.Sq Ic .ifndef . 20634fde40d9SSimon J. Gerraty.It Ic .elifmake \*[maybenot] Ar target Op Ar operator target No ... 20643955d011SMarcel MoolenaarA combination of 2065954401e6SSimon J. Gerraty.Sq Ic .else 20663955d011SMarcel Moolenaarfollowed by 2067954401e6SSimon J. Gerraty.Sq Ic .ifmake . 20684fde40d9SSimon J. Gerraty.It Ic .elifnmake \*[maybenot] Ar target Op Ar operator target No ... 20693955d011SMarcel MoolenaarA combination of 2070954401e6SSimon J. Gerraty.Sq Ic .else 20713955d011SMarcel Moolenaarfollowed by 2072954401e6SSimon J. Gerraty.Sq Ic .ifnmake . 20733955d011SMarcel Moolenaar.It Ic .endif 20743955d011SMarcel MoolenaarEnd the body of the conditional. 20753955d011SMarcel Moolenaar.El 20763955d011SMarcel Moolenaar.Pp 20773955d011SMarcel MoolenaarThe 20783955d011SMarcel Moolenaar.Ar operator 20793955d011SMarcel Moolenaarmay be any one of the following: 20804fde40d9SSimon J. Gerraty.Bl -tag 20814fde40d9SSimon J. Gerraty.It Ic \&|\&| 20823955d011SMarcel MoolenaarLogical OR. 20834fde40d9SSimon J. Gerraty.It Ic \&&& 20844fde40d9SSimon J. GerratyLogical AND; of higher precedence than 20854fde40d9SSimon J. Gerraty.Sq Ic \&|\&| . 20863955d011SMarcel Moolenaar.El 20873955d011SMarcel Moolenaar.Pp 20883955d011SMarcel Moolenaar.Nm 20894fde40d9SSimon J. Gerratyonly evaluates a conditional as far as is necessary to determine its value. 20904fde40d9SSimon J. GerratyParentheses can be used to override the operator precedence. 20913955d011SMarcel MoolenaarThe boolean operator 2092954401e6SSimon J. Gerraty.Sq Ic \&! 209398875883SSimon J. Gerratymay be used to logically negate an expression, typically a function call. 20943955d011SMarcel MoolenaarIt is of higher precedence than 2095954401e6SSimon J. Gerraty.Sq Ic \&&& . 20963955d011SMarcel Moolenaar.Pp 20973955d011SMarcel MoolenaarThe value of 20983955d011SMarcel Moolenaar.Ar expression 20994fde40d9SSimon J. Gerratymay be any of the following function call expressions: 21004fde40d9SSimon J. Gerraty.Bl -tag 21014fde40d9SSimon J. Gerraty.Sm off 21024fde40d9SSimon J. Gerraty.It Ic defined Li \&( Ar varname Li \&) 21034fde40d9SSimon J. Gerraty.Sm on 21044fde40d9SSimon J. GerratyEvaluates to true if the variable 21054fde40d9SSimon J. Gerraty.Ar varname 21063955d011SMarcel Moolenaarhas been defined. 21074fde40d9SSimon J. Gerraty.Sm off 21084fde40d9SSimon J. Gerraty.It Ic make Li \&( Ar target Li \&) 21094fde40d9SSimon J. Gerraty.Sm on 21104fde40d9SSimon J. GerratyEvaluates to true if the target was specified as part of 21113955d011SMarcel Moolenaar.Nm Ns 's 21123955d011SMarcel Moolenaarcommand line or was declared the default target (either implicitly or 21133955d011SMarcel Moolenaarexplicitly, see 21143955d011SMarcel Moolenaar.Va .MAIN ) 21153955d011SMarcel Moolenaarbefore the line containing the conditional. 21164fde40d9SSimon J. Gerraty.Sm off 21174fde40d9SSimon J. Gerraty.It Ic empty Li \&( Ar varname Oo Li : Ar modifiers Oc Li \&) 21184fde40d9SSimon J. Gerraty.Sm on 21194fde40d9SSimon J. GerratyEvaluates to true if the expansion of the variable, 21204fde40d9SSimon J. Gerratyafter applying the modifiers, results in an empty string. 21214fde40d9SSimon J. Gerraty.Sm off 21224fde40d9SSimon J. Gerraty.It Ic exists Li \&( Ar pathname Li \&) 21234fde40d9SSimon J. Gerraty.Sm on 21244fde40d9SSimon J. GerratyEvaluates to true if the given pathname exists. 21254fde40d9SSimon J. GerratyIf relative, the pathname is searched for on the system search path (see 21263955d011SMarcel Moolenaar.Va .PATH ) . 21274fde40d9SSimon J. Gerraty.Sm off 21284fde40d9SSimon J. Gerraty.It Ic target Li \&( Ar target Li \&) 21294fde40d9SSimon J. Gerraty.Sm on 21304fde40d9SSimon J. GerratyEvaluates to true if the target has been defined. 21314fde40d9SSimon J. Gerraty.Sm off 21324fde40d9SSimon J. Gerraty.It Ic commands Li \&( Ar target Li \&) 21334fde40d9SSimon J. Gerraty.Sm on 21344fde40d9SSimon J. GerratyEvaluates to true if the target has been defined 21354fde40d9SSimon J. Gerratyand has commands associated with it. 21363955d011SMarcel Moolenaar.El 21373955d011SMarcel Moolenaar.Pp 21383955d011SMarcel Moolenaar.Ar Expression 21393955d011SMarcel Moolenaarmay also be an arithmetic or string comparison. 21404fde40d9SSimon J. GerratyVariable expansion is performed on both sides of the comparison. 21414fde40d9SSimon J. GerratyIf both sides are numeric and neither is enclosed in quotes, 21424fde40d9SSimon J. Gerratythe comparison is done numerically, otherwise lexicographically. 214398875883SSimon J. GerratyA string is interpreted as a hexadecimal integer if it is preceded by 21444fde40d9SSimon J. Gerraty.Li 0x , 214598875883SSimon J. Gerratyotherwise it is interpreted as a decimal floating-point number; 21464fde40d9SSimon J. Gerratyoctal numbers are not supported. 21474fde40d9SSimon J. Gerraty.Pp 21484fde40d9SSimon J. GerratyAll comparisons may use the operators 21494fde40d9SSimon J. Gerraty.Sq Ic \&== 21504fde40d9SSimon J. Gerratyand 21514fde40d9SSimon J. Gerraty.Sq Ic \&!= . 21524fde40d9SSimon J. GerratyNumeric comparisons may also use the operators 21534fde40d9SSimon J. Gerraty.Sq Ic \&< , 21544fde40d9SSimon J. Gerraty.Sq Ic \&<= , 21554fde40d9SSimon J. Gerraty.Sq Ic \&> 21564fde40d9SSimon J. Gerratyand 21574fde40d9SSimon J. Gerraty.Sq Ic \&>= . 21584fde40d9SSimon J. Gerraty.Pp 21594fde40d9SSimon J. GerratyIf the comparison has neither a comparison operator nor a right side, 21604fde40d9SSimon J. Gerratythe expression evaluates to true if it is nonempty 21614fde40d9SSimon J. Gerratyand its numeric value (if any) is not zero. 21623955d011SMarcel Moolenaar.Pp 21633955d011SMarcel MoolenaarWhen 21643955d011SMarcel Moolenaar.Nm 21653955d011SMarcel Moolenaaris evaluating one of these conditional expressions, and it encounters 216698875883SSimon J. Gerratya (whitespace-separated) word it doesn't recognize, either the 21673955d011SMarcel Moolenaar.Dq make 21683955d011SMarcel Moolenaaror 21693955d011SMarcel Moolenaar.Dq defined 21704fde40d9SSimon J. Gerratyfunction is applied to it, depending on the form of the conditional. 21713955d011SMarcel MoolenaarIf the form is 2172954401e6SSimon J. Gerraty.Sq Ic .ifdef , 21734fde40d9SSimon J. Gerraty.Sq Ic .ifndef 21743955d011SMarcel Moolenaaror 21754fde40d9SSimon J. Gerraty.Sq Ic .if , 21763955d011SMarcel Moolenaarthe 21773955d011SMarcel Moolenaar.Dq defined 21784fde40d9SSimon J. Gerratyfunction is applied. 21793955d011SMarcel MoolenaarSimilarly, if the form is 2180954401e6SSimon J. Gerraty.Sq Ic .ifmake 21813955d011SMarcel Moolenaaror 2182954401e6SSimon J. Gerraty.Sq Ic .ifnmake , 2183494f7191SSimon J. Gerratythe 21843955d011SMarcel Moolenaar.Dq make 21854fde40d9SSimon J. Gerratyfunction is applied. 21863955d011SMarcel Moolenaar.Pp 21874fde40d9SSimon J. GerratyIf the conditional evaluates to true, 21884fde40d9SSimon J. Gerratyparsing of the makefile continues as before. 218998875883SSimon J. GerratyIf it evaluates to false, the following lines until the corresponding 219098875883SSimon J. Gerraty.Sq Ic .elif 219198875883SSimon J. Gerratyvariant, 2192954401e6SSimon J. Gerraty.Sq Ic .else 21933955d011SMarcel Moolenaaror 2194954401e6SSimon J. Gerraty.Sq Ic .endif 219598875883SSimon J. Gerratyare skipped. 21964fde40d9SSimon J. Gerraty.Ss For loops 21973955d011SMarcel MoolenaarFor loops are typically used to apply a set of rules to a list of files. 21983955d011SMarcel MoolenaarThe syntax of a for loop is: 21993955d011SMarcel Moolenaar.Pp 22003955d011SMarcel Moolenaar.Bl -tag -compact -width Ds 22014fde40d9SSimon J. Gerraty.It Ic \&.for Ar variable Oo Ar variable No ... Oc Ic in Ar expression 22024fde40d9SSimon J. Gerraty.It Aq Ar make-lines 22033955d011SMarcel Moolenaar.It Ic \&.endfor 22043955d011SMarcel Moolenaar.El 22053955d011SMarcel Moolenaar.Pp 22064fde40d9SSimon J. GerratyThe 22074fde40d9SSimon J. Gerraty.Ar expression 22084fde40d9SSimon J. Gerratyis expanded and then split into words. 22093955d011SMarcel MoolenaarOn each iteration of the loop, one word is taken and assigned to each 22104fde40d9SSimon J. Gerraty.Ar variable , 22113955d011SMarcel Moolenaarin order, and these 22124fde40d9SSimon J. Gerraty.Ar variables 22133955d011SMarcel Moolenaarare substituted into the 22144fde40d9SSimon J. Gerraty.Ar make-lines 22153955d011SMarcel Moolenaarinside the body of the for loop. 22163955d011SMarcel MoolenaarThe number of words must come out even; that is, if there are three 22173955d011SMarcel Moolenaariteration variables, the number of words provided must be a multiple 22183955d011SMarcel Moolenaarof three. 22194fde40d9SSimon J. Gerraty.Pp 22204fde40d9SSimon J. GerratyIf 22214fde40d9SSimon J. Gerraty.Sq Ic .break 22224fde40d9SSimon J. Gerratyis encountered within a 22234fde40d9SSimon J. Gerraty.Cm \&.for 22244fde40d9SSimon J. Gerratyloop, it causes early termination of the loop, otherwise a parse error. 22254fde40d9SSimon J. Gerraty.\" TODO: Describe limitations with defined/empty. 22264fde40d9SSimon J. Gerraty.Ss Other directives 22274fde40d9SSimon J. Gerraty.Bl -tag -width Ds 22284fde40d9SSimon J. Gerraty.It Ic .undef Ar variable No ... 22294fde40d9SSimon J. GerratyUn-define the specified global variables. 22304fde40d9SSimon J. GerratyOnly global variables can be un-defined. 22314fde40d9SSimon J. Gerraty.El 22323955d011SMarcel Moolenaar.Sh COMMENTS 22333955d011SMarcel MoolenaarComments begin with a hash 22343955d011SMarcel Moolenaar.Pq Ql \&# 22353955d011SMarcel Moolenaarcharacter, anywhere but in a shell 22363955d011SMarcel Moolenaarcommand line, and continue to the end of an unescaped new line. 22373955d011SMarcel Moolenaar.Sh SPECIAL SOURCES (ATTRIBUTES) 22383955d011SMarcel Moolenaar.Bl -tag -width .IGNOREx 22393955d011SMarcel Moolenaar.It Ic .EXEC 22403955d011SMarcel MoolenaarTarget is never out of date, but always execute commands anyway. 22413955d011SMarcel Moolenaar.It Ic .IGNORE 22423955d011SMarcel MoolenaarIgnore any errors from the commands associated with this target, exactly 22433955d011SMarcel Moolenaaras if they all were preceded by a dash 22443955d011SMarcel Moolenaar.Pq Ql \- . 22453955d011SMarcel Moolenaar.\" .It Ic .INVISIBLE 22463955d011SMarcel Moolenaar.\" XXX 22473955d011SMarcel Moolenaar.\" .It Ic .JOIN 22483955d011SMarcel Moolenaar.\" XXX 22493955d011SMarcel Moolenaar.It Ic .MADE 22504fde40d9SSimon J. GerratyMark all sources of this target as being up to date. 22513955d011SMarcel Moolenaar.It Ic .MAKE 22523955d011SMarcel MoolenaarExecute the commands associated with this target even if the 22533955d011SMarcel Moolenaar.Fl n 22543955d011SMarcel Moolenaaror 22553955d011SMarcel Moolenaar.Fl t 22563955d011SMarcel Moolenaaroptions were specified. 22573955d011SMarcel MoolenaarNormally used to mark recursive 22580dede8b0SSimon J. Gerraty.Nm Ns s . 22593955d011SMarcel Moolenaar.It Ic .META 22603955d011SMarcel MoolenaarCreate a meta file for the target, even if it is flagged as 22613955d011SMarcel Moolenaar.Ic .PHONY , 22623955d011SMarcel Moolenaar.Ic .MAKE , 22633955d011SMarcel Moolenaaror 22643955d011SMarcel Moolenaar.Ic .SPECIAL . 22653955d011SMarcel MoolenaarUsage in conjunction with 22663955d011SMarcel Moolenaar.Ic .MAKE 22673955d011SMarcel Moolenaaris the most likely case. 22684fde40d9SSimon J. GerratyIn 22694fde40d9SSimon J. Gerraty.Dq meta 22704fde40d9SSimon J. Gerratymode, the target is out-of-date if the meta file is missing. 22713955d011SMarcel Moolenaar.It Ic .NOMETA 22723955d011SMarcel MoolenaarDo not create a meta file for the target. 22733955d011SMarcel MoolenaarMeta files are also not created for 22743955d011SMarcel Moolenaar.Ic .PHONY , 22753955d011SMarcel Moolenaar.Ic .MAKE , 22763955d011SMarcel Moolenaaror 22773955d011SMarcel Moolenaar.Ic .SPECIAL 22783955d011SMarcel Moolenaartargets. 22793955d011SMarcel Moolenaar.It Ic .NOMETA_CMP 22803955d011SMarcel MoolenaarIgnore differences in commands when deciding if target is out of date. 22813955d011SMarcel MoolenaarThis is useful if the command contains a value which always changes. 22824fde40d9SSimon J. GerratyIf the number of commands change, though, 22834fde40d9SSimon J. Gerratythe target is still considered out of date. 22841748de26SSimon J. GerratyThe same effect applies to any command line that uses the variable 22851748de26SSimon J. Gerraty.Va .OODATE , 22861748de26SSimon J. Gerratywhich can be used for that purpose even when not otherwise needed or desired: 22871748de26SSimon J. Gerraty.Bd -literal -offset indent 22881748de26SSimon J. Gerraty 22891748de26SSimon J. Gerratyskip-compare-for-some: 22904fde40d9SSimon J. Gerraty @echo this is compared 22914fde40d9SSimon J. Gerraty @echo this is not ${.OODATE:M.NOMETA_CMP} 22924fde40d9SSimon J. Gerraty @echo this is also compared 22931748de26SSimon J. Gerraty 22941748de26SSimon J. Gerraty.Ed 22951748de26SSimon J. GerratyThe 22961748de26SSimon J. Gerraty.Cm \&:M 22971748de26SSimon J. Gerratypattern suppresses any expansion of the unwanted variable. 22983955d011SMarcel Moolenaar.It Ic .NOPATH 22993955d011SMarcel MoolenaarDo not search for the target in the directories specified by 23004fde40d9SSimon J. Gerraty.Va .PATH . 23013955d011SMarcel Moolenaar.It Ic .NOTMAIN 23023955d011SMarcel MoolenaarNormally 23033955d011SMarcel Moolenaar.Nm 23043955d011SMarcel Moolenaarselects the first target it encounters as the default target to be built 23053955d011SMarcel Moolenaarif no target was specified. 23063955d011SMarcel MoolenaarThis source prevents this target from being selected. 23073955d011SMarcel Moolenaar.It Ic .OPTIONAL 23083955d011SMarcel MoolenaarIf a target is marked with this attribute and 23093955d011SMarcel Moolenaar.Nm 23104fde40d9SSimon J. Gerratycan't figure out how to create it, it ignores this fact and assumes 23113955d011SMarcel Moolenaarthe file isn't needed or already exists. 23123955d011SMarcel Moolenaar.It Ic .PHONY 23134fde40d9SSimon J. GerratyThe target does not correspond to an actual file; 23144fde40d9SSimon J. Gerratyit is always considered to be out of date, 23154fde40d9SSimon J. Gerratyand is not created with the 23163955d011SMarcel Moolenaar.Fl t 23173955d011SMarcel Moolenaaroption. 23183955d011SMarcel MoolenaarSuffix-transformation rules are not applied to 23193955d011SMarcel Moolenaar.Ic .PHONY 23203955d011SMarcel Moolenaartargets. 23213955d011SMarcel Moolenaar.It Ic .PRECIOUS 23223955d011SMarcel MoolenaarWhen 23233955d011SMarcel Moolenaar.Nm 23243955d011SMarcel Moolenaaris interrupted, it normally removes any partially made targets. 23253955d011SMarcel MoolenaarThis source prevents the target from being removed. 23263955d011SMarcel Moolenaar.It Ic .RECURSIVE 23273955d011SMarcel MoolenaarSynonym for 23283955d011SMarcel Moolenaar.Ic .MAKE . 23293955d011SMarcel Moolenaar.It Ic .SILENT 23303955d011SMarcel MoolenaarDo not echo any of the commands associated with this target, exactly 23313955d011SMarcel Moolenaaras if they all were preceded by an at sign 23323955d011SMarcel Moolenaar.Pq Ql @ . 23333955d011SMarcel Moolenaar.It Ic .USE 23343955d011SMarcel MoolenaarTurn the target into 23353955d011SMarcel Moolenaar.Nm Ns 's 23363955d011SMarcel Moolenaarversion of a macro. 23373955d011SMarcel MoolenaarWhen the target is used as a source for another target, the other target 23383955d011SMarcel Moolenaaracquires the commands, sources, and attributes (except for 23393955d011SMarcel Moolenaar.Ic .USE ) 23403955d011SMarcel Moolenaarof the 23413955d011SMarcel Moolenaarsource. 23423955d011SMarcel MoolenaarIf the target already has commands, the 23433955d011SMarcel Moolenaar.Ic .USE 23443955d011SMarcel Moolenaartarget's commands are appended 23453955d011SMarcel Moolenaarto them. 23463955d011SMarcel Moolenaar.It Ic .USEBEFORE 23474fde40d9SSimon J. GerratyLike 23483955d011SMarcel Moolenaar.Ic .USE , 23494fde40d9SSimon J. Gerratybut instead of appending, prepend the 23503955d011SMarcel Moolenaar.Ic .USEBEFORE 23513955d011SMarcel Moolenaartarget commands to the target. 23523955d011SMarcel Moolenaar.It Ic .WAIT 23533955d011SMarcel MoolenaarIf 23543955d011SMarcel Moolenaar.Ic .WAIT 23553955d011SMarcel Moolenaarappears in a dependency line, the sources that precede it are 23563955d011SMarcel Moolenaarmade before the sources that succeed it in the line. 23573955d011SMarcel MoolenaarSince the dependents of files are not made until the file itself 23583955d011SMarcel Moolenaarcould be made, this also stops the dependents being built unless they 23593955d011SMarcel Moolenaarare needed for another branch of the dependency tree. 23603955d011SMarcel MoolenaarSo given: 23613955d011SMarcel Moolenaar.Bd -literal 23623955d011SMarcel Moolenaarx: a .WAIT b 23633955d011SMarcel Moolenaar echo x 23643955d011SMarcel Moolenaara: 23653955d011SMarcel Moolenaar echo a 23663955d011SMarcel Moolenaarb: b1 23673955d011SMarcel Moolenaar echo b 23683955d011SMarcel Moolenaarb1: 23693955d011SMarcel Moolenaar echo b1 23703955d011SMarcel Moolenaar 23713955d011SMarcel Moolenaar.Ed 23723955d011SMarcel Moolenaarthe output is always 23733955d011SMarcel Moolenaar.Ql a , 23743955d011SMarcel Moolenaar.Ql b1 , 23753955d011SMarcel Moolenaar.Ql b , 23763955d011SMarcel Moolenaar.Ql x . 23774fde40d9SSimon J. Gerraty.Pp 23783955d011SMarcel MoolenaarThe ordering imposed by 23793955d011SMarcel Moolenaar.Ic .WAIT 23803955d011SMarcel Moolenaaris only relevant for parallel makes. 23813955d011SMarcel Moolenaar.El 23823955d011SMarcel Moolenaar.Sh SPECIAL TARGETS 23833955d011SMarcel MoolenaarSpecial targets may not be included with other targets, i.e. they must be 23843955d011SMarcel Moolenaarthe only target specified. 23853955d011SMarcel Moolenaar.Bl -tag -width .BEGINx 23863955d011SMarcel Moolenaar.It Ic .BEGIN 23873955d011SMarcel MoolenaarAny command lines attached to this target are executed before anything 23883955d011SMarcel Moolenaarelse is done. 23893955d011SMarcel Moolenaar.It Ic .DEFAULT 23903955d011SMarcel MoolenaarThis is sort of a 23913955d011SMarcel Moolenaar.Ic .USE 23924fde40d9SSimon J. Gerratyrule for any target (that was used only as a source) that 23933955d011SMarcel Moolenaar.Nm 23943955d011SMarcel Moolenaarcan't figure out any other way to create. 23953955d011SMarcel MoolenaarOnly the shell script is used. 23963955d011SMarcel MoolenaarThe 23974fde40d9SSimon J. Gerraty.Va .IMPSRC 23983955d011SMarcel Moolenaarvariable of a target that inherits 23993955d011SMarcel Moolenaar.Ic .DEFAULT Ns 's 24004fde40d9SSimon J. Gerratycommands is set to the target's own name. 240145447996SSimon J. Gerraty.It Ic .DELETE_ON_ERROR 240245447996SSimon J. GerratyIf this target is present in the makefile, it globally causes make to 240345447996SSimon J. Gerratydelete targets whose commands fail. 240445447996SSimon J. Gerraty(By default, only targets whose commands are interrupted during 240545447996SSimon J. Gerratyexecution are deleted. 240645447996SSimon J. GerratyThis is the historical behavior.) 240745447996SSimon J. GerratyThis setting can be used to help prevent half-finished or malformed 240845447996SSimon J. Gerratytargets from being left around and corrupting future rebuilds. 24093955d011SMarcel Moolenaar.It Ic .END 24103955d011SMarcel MoolenaarAny command lines attached to this target are executed after everything 24114fde40d9SSimon J. Gerratyelse is done successfully. 24123955d011SMarcel Moolenaar.It Ic .ERROR 24133955d011SMarcel MoolenaarAny command lines attached to this target are executed when another target fails. 2414*c59c3bf3SSimon J. GerratySee 2415*c59c3bf3SSimon J. Gerraty.Va MAKE_PRINT_VAR_ON_ERROR 2416*c59c3bf3SSimon J. Gerratyfor the variables that will be set. 24173955d011SMarcel Moolenaar.It Ic .IGNORE 24183955d011SMarcel MoolenaarMark each of the sources with the 24193955d011SMarcel Moolenaar.Ic .IGNORE 24203955d011SMarcel Moolenaarattribute. 24213955d011SMarcel MoolenaarIf no sources are specified, this is the equivalent of specifying the 24223955d011SMarcel Moolenaar.Fl i 24233955d011SMarcel Moolenaaroption. 24243955d011SMarcel Moolenaar.It Ic .INTERRUPT 24253955d011SMarcel MoolenaarIf 24263955d011SMarcel Moolenaar.Nm 24274fde40d9SSimon J. Gerratyis interrupted, the commands for this target are executed. 24283955d011SMarcel Moolenaar.It Ic .MAIN 24293955d011SMarcel MoolenaarIf no target is specified when 24303955d011SMarcel Moolenaar.Nm 24314fde40d9SSimon J. Gerratyis invoked, this target is built. 24323955d011SMarcel Moolenaar.It Ic .MAKEFLAGS 24333955d011SMarcel MoolenaarThis target provides a way to specify flags for 24343955d011SMarcel Moolenaar.Nm 24354fde40d9SSimon J. Gerratyat the time when the makefiles are read. 24363955d011SMarcel MoolenaarThe flags are as if typed to the shell, though the 24373955d011SMarcel Moolenaar.Fl f 24384fde40d9SSimon J. Gerratyoption has 24393955d011SMarcel Moolenaarno effect. 24403955d011SMarcel Moolenaar.\" XXX: NOT YET!!!! 24413955d011SMarcel Moolenaar.\" .It Ic .NOTPARALLEL 24423955d011SMarcel Moolenaar.\" The named targets are executed in non parallel mode. 24433955d011SMarcel Moolenaar.\" If no targets are 24444fde40d9SSimon J. Gerraty.\" specified, all targets are executed in non parallel mode. 24453955d011SMarcel Moolenaar.It Ic .NOPATH 24463955d011SMarcel MoolenaarApply the 24473955d011SMarcel Moolenaar.Ic .NOPATH 24483955d011SMarcel Moolenaarattribute to any specified sources. 24493955d011SMarcel Moolenaar.It Ic .NOTPARALLEL 24503955d011SMarcel MoolenaarDisable parallel mode. 24513955d011SMarcel Moolenaar.It Ic .NO_PARALLEL 24523955d011SMarcel MoolenaarSynonym for 24533955d011SMarcel Moolenaar.Ic .NOTPARALLEL , 24543955d011SMarcel Moolenaarfor compatibility with other pmake variants. 24554fde40d9SSimon J. Gerraty.It Ic .NOREADONLY 24564fde40d9SSimon J. Gerratyclear the read-only attribute from the global variables specified as sources. 2457128a4105SSimon J. Gerraty.It Ic .OBJDIR 2458128a4105SSimon J. GerratyThe source is a new value for 2459954401e6SSimon J. Gerraty.Sq Va .OBJDIR . 2460128a4105SSimon J. GerratyIf it exists, 2461128a4105SSimon J. Gerraty.Nm 24624fde40d9SSimon J. Gerratychanges the current working directory to it and updates the value of 2463954401e6SSimon J. Gerraty.Sq Va .OBJDIR . 24643955d011SMarcel Moolenaar.It Ic .ORDER 2465954401e6SSimon J. GerratyIn parallel mode, the named targets are made in sequence. 24663955d011SMarcel MoolenaarThis ordering does not add targets to the list of targets to be made. 2467954401e6SSimon J. Gerraty.Pp 24683955d011SMarcel MoolenaarSince the dependents of a target do not get built until the target itself 24693955d011SMarcel Moolenaarcould be built, unless 24703955d011SMarcel Moolenaar.Ql a 24713955d011SMarcel Moolenaaris built by another part of the dependency graph, 24723955d011SMarcel Moolenaarthe following is a dependency loop: 24733955d011SMarcel Moolenaar.Bd -literal 24743955d011SMarcel Moolenaar\&.ORDER: b a 24753955d011SMarcel Moolenaarb: a 24763955d011SMarcel Moolenaar.Ed 24773955d011SMarcel Moolenaar.Pp 24783955d011SMarcel Moolenaar.\" XXX: NOT YET!!!! 24793955d011SMarcel Moolenaar.\" .It Ic .PARALLEL 24803955d011SMarcel Moolenaar.\" The named targets are executed in parallel mode. 24813955d011SMarcel Moolenaar.\" If no targets are 24824fde40d9SSimon J. Gerraty.\" specified, all targets are executed in parallel mode. 24833955d011SMarcel Moolenaar.It Ic .PATH 24843955d011SMarcel MoolenaarThe sources are directories which are to be searched for files not 24853955d011SMarcel Moolenaarfound in the current directory. 24864fde40d9SSimon J. GerratyIf no sources are specified, 24874fde40d9SSimon J. Gerratyany previously specified directories are removed from the search path. 24883955d011SMarcel MoolenaarIf the source is the special 24893955d011SMarcel Moolenaar.Ic .DOTLAST 24904fde40d9SSimon J. Gerratytarget, the current working directory is searched last. 24914fde40d9SSimon J. Gerraty.It Ic .PATH. Ns Ar suffix 24921bbe5942SSimon J. GerratyLike 24931bbe5942SSimon J. Gerraty.Ic .PATH 24941bbe5942SSimon J. Gerratybut applies only to files with a particular suffix. 24951bbe5942SSimon J. GerratyThe suffix must have been previously declared with 24961bbe5942SSimon J. Gerraty.Ic .SUFFIXES . 24973955d011SMarcel Moolenaar.It Ic .PHONY 24983955d011SMarcel MoolenaarApply the 24993955d011SMarcel Moolenaar.Ic .PHONY 25003955d011SMarcel Moolenaarattribute to any specified sources. 25011d3f2ddcSSimon J. Gerraty.It Ic .POSIX 25022f2a5ecdSSimon J. GerratyIf this is the first non-comment line in the main makefile, 25032f2a5ecdSSimon J. Gerratythe variable 25041d3f2ddcSSimon J. Gerraty.Va %POSIX 25052f2a5ecdSSimon J. Gerratyis set to the value 25062f2a5ecdSSimon J. Gerraty.Ql 1003.2 25072f2a5ecdSSimon J. Gerratyand the makefile 25082f2a5ecdSSimon J. Gerraty.Ql <posix.mk> 25092f2a5ecdSSimon J. Gerratyis included if it exists, 25102f2a5ecdSSimon J. Gerratyto provide POSIX-compatible default rules. 25111d3f2ddcSSimon J. GerratyIf 25121d3f2ddcSSimon J. Gerraty.Nm 25131d3f2ddcSSimon J. Gerratyis run with the 25141d3f2ddcSSimon J. Gerraty.Fl r 25154fde40d9SSimon J. Gerratyflag, only 25161d3f2ddcSSimon J. Gerraty.Ql posix.mk 25174fde40d9SSimon J. Gerratycontributes to the default rules. 25183955d011SMarcel Moolenaar.It Ic .PRECIOUS 25193955d011SMarcel MoolenaarApply the 25203955d011SMarcel Moolenaar.Ic .PRECIOUS 25213955d011SMarcel Moolenaarattribute to any specified sources. 25223955d011SMarcel MoolenaarIf no sources are specified, the 25233955d011SMarcel Moolenaar.Ic .PRECIOUS 25244fde40d9SSimon J. Gerratyattribute is applied to every target in the file. 25254fde40d9SSimon J. Gerraty.It Ic .READONLY 25264fde40d9SSimon J. Gerratyset the read-only attribute on the global variables specified as sources. 25273955d011SMarcel Moolenaar.It Ic .SHELL 25283955d011SMarcel MoolenaarSets the shell that 25293955d011SMarcel Moolenaar.Nm 2530d5e0a182SSimon J. Gerratyuses to execute commands. 25313955d011SMarcel MoolenaarThe sources are a set of 25324fde40d9SSimon J. Gerraty.Ar field\| Ns Cm \&= Ns Ar value 25333955d011SMarcel Moolenaarpairs. 25344fde40d9SSimon J. Gerraty.Bl -tag -width ".Li hasErrCtls" 25354fde40d9SSimon J. Gerraty.It Li name 2536be19d90bSSimon J. GerratyThis is the minimal specification, used to select one of the built-in 25373955d011SMarcel Moolenaarshell specs; 25384fde40d9SSimon J. Gerraty.Li sh , 25394fde40d9SSimon J. Gerraty.Li ksh , 25403955d011SMarcel Moolenaarand 25414fde40d9SSimon J. Gerraty.Li csh . 25424fde40d9SSimon J. Gerraty.It Li path 25434fde40d9SSimon J. GerratySpecifies the absolute path to the shell. 25444fde40d9SSimon J. Gerraty.It Li hasErrCtl 25453955d011SMarcel MoolenaarIndicates whether the shell supports exit on error. 25464fde40d9SSimon J. Gerraty.It Li check 25473955d011SMarcel MoolenaarThe command to turn on error checking. 25484fde40d9SSimon J. Gerraty.It Li ignore 25493955d011SMarcel MoolenaarThe command to disable error checking. 25504fde40d9SSimon J. Gerraty.It Li echo 25513955d011SMarcel MoolenaarThe command to turn on echoing of commands executed. 25524fde40d9SSimon J. Gerraty.It Li quiet 25533955d011SMarcel MoolenaarThe command to turn off echoing of commands executed. 25544fde40d9SSimon J. Gerraty.It Li filter 25553955d011SMarcel MoolenaarThe output to filter after issuing the 25564fde40d9SSimon J. Gerraty.Li quiet 25573955d011SMarcel Moolenaarcommand. 25583955d011SMarcel MoolenaarIt is typically identical to 25594fde40d9SSimon J. Gerraty.Li quiet . 25604fde40d9SSimon J. Gerraty.It Li errFlag 25613955d011SMarcel MoolenaarThe flag to pass the shell to enable error checking. 25624fde40d9SSimon J. Gerraty.It Li echoFlag 25633955d011SMarcel MoolenaarThe flag to pass the shell to enable command echoing. 25644fde40d9SSimon J. Gerraty.It Li newline 25653955d011SMarcel MoolenaarThe string literal to pass the shell that results in a single newline 25663955d011SMarcel Moolenaarcharacter when used outside of any quoting characters. 25673955d011SMarcel Moolenaar.El 25683955d011SMarcel MoolenaarExample: 25693955d011SMarcel Moolenaar.Bd -literal 25703955d011SMarcel Moolenaar\&.SHELL: name=ksh path=/bin/ksh hasErrCtl=true \e 25713955d011SMarcel Moolenaar check="set \-e" ignore="set +e" \e 25723955d011SMarcel Moolenaar echo="set \-v" quiet="set +v" filter="set +v" \e 25733955d011SMarcel Moolenaar echoFlag=v errFlag=e newline="'\en'" 25743955d011SMarcel Moolenaar.Ed 25753955d011SMarcel Moolenaar.It Ic .SILENT 25763955d011SMarcel MoolenaarApply the 25773955d011SMarcel Moolenaar.Ic .SILENT 25783955d011SMarcel Moolenaarattribute to any specified sources. 25793955d011SMarcel MoolenaarIf no sources are specified, the 25803955d011SMarcel Moolenaar.Ic .SILENT 25813955d011SMarcel Moolenaarattribute is applied to every 25823955d011SMarcel Moolenaarcommand in the file. 25831748de26SSimon J. Gerraty.It Ic .STALE 25841748de26SSimon J. GerratyThis target gets run when a dependency file contains stale entries, having 25851748de26SSimon J. Gerraty.Va .ALLSRC 25861748de26SSimon J. Gerratyset to the name of that dependency file. 25873955d011SMarcel Moolenaar.It Ic .SUFFIXES 25883955d011SMarcel MoolenaarEach source specifies a suffix to 25893955d011SMarcel Moolenaar.Nm . 25903955d011SMarcel MoolenaarIf no sources are specified, any previously specified suffixes are deleted. 25913955d011SMarcel MoolenaarIt allows the creation of suffix-transformation rules. 25923955d011SMarcel Moolenaar.Pp 25933955d011SMarcel MoolenaarExample: 25943955d011SMarcel Moolenaar.Bd -literal 25954fde40d9SSimon J. Gerraty\&.SUFFIXES: .c .o 25963955d011SMarcel Moolenaar\&.c.o: 25973955d011SMarcel Moolenaar cc \-o ${.TARGET} \-c ${.IMPSRC} 25983955d011SMarcel Moolenaar.Ed 25994fde40d9SSimon J. Gerraty.It Ic .SYSPATH 26004fde40d9SSimon J. GerratyThe sources are directories which are to be added to the system 26014fde40d9SSimon J. Gerratyinclude path which 26024fde40d9SSimon J. Gerraty.Nm 26034fde40d9SSimon J. Gerratysearches for makefiles. 26044fde40d9SSimon J. GerratyIf no sources are specified, 26054fde40d9SSimon J. Gerratyany previously specified directories are removed from the system 26064fde40d9SSimon J. Gerratyinclude path. 26073955d011SMarcel Moolenaar.El 26083955d011SMarcel Moolenaar.Sh ENVIRONMENT 26093955d011SMarcel Moolenaar.Nm 26103955d011SMarcel Moolenaaruses the following environment variables, if they exist: 26113955d011SMarcel Moolenaar.Ev MACHINE , 26123955d011SMarcel Moolenaar.Ev MACHINE_ARCH , 26133955d011SMarcel Moolenaar.Ev MAKE , 26143955d011SMarcel Moolenaar.Ev MAKEFLAGS , 26153955d011SMarcel Moolenaar.Ev MAKEOBJDIR , 26163955d011SMarcel Moolenaar.Ev MAKEOBJDIRPREFIX , 26173955d011SMarcel Moolenaar.Ev MAKESYSPATH , 26183955d011SMarcel Moolenaar.Ev PWD , 26193955d011SMarcel Moolenaarand 26203955d011SMarcel Moolenaar.Ev TMPDIR . 26213955d011SMarcel Moolenaar.Pp 26223955d011SMarcel Moolenaar.Ev MAKEOBJDIRPREFIX 26233955d011SMarcel Moolenaarand 26243955d011SMarcel Moolenaar.Ev MAKEOBJDIR 26253955d011SMarcel Moolenaarmay only be set in the environment or on the command line to 26263955d011SMarcel Moolenaar.Nm 26273955d011SMarcel Moolenaarand not as makefile variables; 26283955d011SMarcel Moolenaarsee the description of 2629954401e6SSimon J. Gerraty.Sq Va .OBJDIR 26303955d011SMarcel Moolenaarfor more details. 26313955d011SMarcel Moolenaar.Sh FILES 26323955d011SMarcel Moolenaar.Bl -tag -width /usr/share/mk -compact 26333955d011SMarcel Moolenaar.It .depend 26343955d011SMarcel Moolenaarlist of dependencies 26353955d011SMarcel Moolenaar.It makefile 26364fde40d9SSimon J. Gerratyfirst default makefile if no makefile is specified on the command line 26374fde40d9SSimon J. Gerraty.It Makefile 26384fde40d9SSimon J. Gerratysecond default makefile if no makefile is specified on the command line 26393955d011SMarcel Moolenaar.It sys.mk 26403955d011SMarcel Moolenaarsystem makefile 26413955d011SMarcel Moolenaar.It /usr/share/mk 26423955d011SMarcel Moolenaarsystem makefile directory 26433955d011SMarcel Moolenaar.El 26443955d011SMarcel Moolenaar.Sh COMPATIBILITY 26454fde40d9SSimon J. GerratyThe basic make syntax is compatible between different make variants; 26463955d011SMarcel Moolenaarhowever the special variables, variable modifiers and conditionals are not. 2647db29cad8SSimon J. Gerraty.Ss Older versions 2648db29cad8SSimon J. GerratyAn incomplete list of changes in older versions of 2649db29cad8SSimon J. Gerraty.Nm : 26503955d011SMarcel Moolenaar.Pp 26513955d011SMarcel MoolenaarThe way that .for loop variables are substituted changed after 26523955d011SMarcel MoolenaarNetBSD 5.0 26533955d011SMarcel Moolenaarso that they still appear to be variable expansions. 26543955d011SMarcel MoolenaarIn particular this stops them being treated as syntax, and removes some 26553955d011SMarcel Moolenaarobscure problems using them in .if statements. 2656db29cad8SSimon J. Gerraty.Pp 2657db29cad8SSimon J. GerratyThe way that parallel makes are scheduled changed in 2658db29cad8SSimon J. GerratyNetBSD 4.0 2659db29cad8SSimon J. Gerratyso that .ORDER and .WAIT apply recursively to the dependent nodes. 2660db29cad8SSimon J. GerratyThe algorithms used may change again in the future. 2661db29cad8SSimon J. Gerraty.Ss Other make dialects 2662db29cad8SSimon J. GerratyOther make dialects (GNU make, SVR4 make, POSIX make, etc.) do not 2663db29cad8SSimon J. Gerratysupport most of the features of 2664db29cad8SSimon J. Gerraty.Nm 2665db29cad8SSimon J. Gerratyas described in this manual. 2666db29cad8SSimon J. GerratyMost notably: 2667db29cad8SSimon J. Gerraty.Bl -bullet -offset indent 2668db29cad8SSimon J. Gerraty.It 2669db29cad8SSimon J. GerratyThe 2670db29cad8SSimon J. Gerraty.Ic .WAIT 2671db29cad8SSimon J. Gerratyand 2672db29cad8SSimon J. Gerraty.Ic .ORDER 2673db29cad8SSimon J. Gerratydeclarations and most functionality pertaining to parallelization. 26744fde40d9SSimon J. Gerraty(GNU make supports parallelization but lacks the features needed to 2675db29cad8SSimon J. Gerratycontrol it effectively.) 2676db29cad8SSimon J. Gerraty.It 2677db29cad8SSimon J. GerratyDirectives, including for loops and conditionals and most of the 2678db29cad8SSimon J. Gerratyforms of include files. 2679db29cad8SSimon J. Gerraty(GNU make has its own incompatible and less powerful syntax for 2680db29cad8SSimon J. Gerratyconditionals.) 26814fde40d9SSimon J. Gerraty.\" The "less powerful" above means that GNU make does not have the 26824fde40d9SSimon J. Gerraty.\" make(target), target(target) and commands(target) functions. 2683db29cad8SSimon J. Gerraty.It 2684db29cad8SSimon J. GerratyAll built-in variables that begin with a dot. 2685db29cad8SSimon J. Gerraty.It 2686db29cad8SSimon J. GerratyMost of the special sources and targets that begin with a dot, 2687db29cad8SSimon J. Gerratywith the notable exception of 2688db29cad8SSimon J. Gerraty.Ic .PHONY , 2689db29cad8SSimon J. Gerraty.Ic .PRECIOUS , 2690db29cad8SSimon J. Gerratyand 2691db29cad8SSimon J. Gerraty.Ic .SUFFIXES . 2692db29cad8SSimon J. Gerraty.It 2693db29cad8SSimon J. GerratyVariable modifiers, except for the 26944fde40d9SSimon J. Gerraty.Ql :old=new 2695db29cad8SSimon J. Gerratystring substitution, which does not portably support globbing with 2696db29cad8SSimon J. Gerraty.Ql % 2697db29cad8SSimon J. Gerratyand historically only works on declared suffixes. 2698db29cad8SSimon J. Gerraty.It 2699db29cad8SSimon J. GerratyThe 2700db29cad8SSimon J. Gerraty.Ic $> 2701db29cad8SSimon J. Gerratyvariable even in its short form; most makes support this functionality 2702db29cad8SSimon J. Gerratybut its name varies. 2703db29cad8SSimon J. Gerraty.El 2704db29cad8SSimon J. Gerraty.Pp 2705db29cad8SSimon J. GerratySome features are somewhat more portable, such as assignment with 2706db29cad8SSimon J. Gerraty.Ic += , 2707db29cad8SSimon J. Gerraty.Ic ?= , 2708db29cad8SSimon J. Gerratyand 2709db29cad8SSimon J. Gerraty.Ic != . 2710db29cad8SSimon J. GerratyThe 27114fde40d9SSimon J. Gerraty.Va .PATH 2712db29cad8SSimon J. Gerratyfunctionality is based on an older feature 2713db29cad8SSimon J. Gerraty.Ic VPATH 2714db29cad8SSimon J. Gerratyfound in GNU make and many versions of SVR4 make; however, 2715db29cad8SSimon J. Gerratyhistorically its behavior is too ill-defined (and too buggy) to rely 2716db29cad8SSimon J. Gerratyupon. 2717db29cad8SSimon J. Gerraty.Pp 2718db29cad8SSimon J. GerratyThe 2719db29cad8SSimon J. Gerraty.Ic $@ 2720db29cad8SSimon J. Gerratyand 2721db29cad8SSimon J. Gerraty.Ic $< 2722db29cad8SSimon J. Gerratyvariables are more or less universally portable, as is the 2723db29cad8SSimon J. Gerraty.Ic $(MAKE) 2724db29cad8SSimon J. Gerratyvariable. 2725db29cad8SSimon J. GerratyBasic use of suffix rules (for files only in the current directory, 2726db29cad8SSimon J. Gerratynot trying to chain transformations together, etc.) is also reasonably 2727db29cad8SSimon J. Gerratyportable. 27283955d011SMarcel Moolenaar.Sh SEE ALSO 27293955d011SMarcel Moolenaar.Xr mkdep 1 27303955d011SMarcel Moolenaar.Sh HISTORY 27313955d011SMarcel Moolenaar.Nm 27323955d011SMarcel Moolenaaris derived from NetBSD 27333955d011SMarcel Moolenaar.Xr make 1 . 27343955d011SMarcel MoolenaarIt uses autoconf to facilitate portability to other platforms. 273593036677SSimon J. Gerraty.Pp 273693036677SSimon J. GerratyA 273793036677SSimon J. Gerratymake 273893036677SSimon J. Gerratycommand appeared in 273993036677SSimon J. Gerraty.At v7 . 274093036677SSimon J. GerratyThis 274193036677SSimon J. Gerratymake 27424fde40d9SSimon J. Gerratyimplementation is based on Adam de Boor's pmake program, 27434fde40d9SSimon J. Gerratywhich was written for Sprite at Berkeley. 274493036677SSimon J. GerratyIt was designed to be a parallel distributed make running jobs on different 274593036677SSimon J. Gerratymachines using a daemon called 274693036677SSimon J. Gerraty.Dq customs . 274751ee2c1cSSimon J. Gerraty.Pp 274851ee2c1cSSimon J. GerratyHistorically the target/dependency 27494fde40d9SSimon J. Gerraty.Ic FRC 275051ee2c1cSSimon J. Gerratyhas been used to FoRCe rebuilding (since the target/dependency 275151ee2c1cSSimon J. Gerratydoes not exist ... unless someone creates an 27524fde40d9SSimon J. Gerraty.Pa FRC 275351ee2c1cSSimon J. Gerratyfile). 275493036677SSimon J. Gerraty.Sh BUGS 275593036677SSimon J. GerratyThe 275693036677SSimon J. Gerratymake 27574fde40d9SSimon J. Gerratysyntax is difficult to parse. 2758ef0b2538SSimon J. GerratyFor instance, finding the end of a variable's use should involve scanning 2759ef0b2538SSimon J. Gerratyeach of the modifiers, using the correct terminator for each field. 276093036677SSimon J. GerratyIn many places 276193036677SSimon J. Gerratymake 276293036677SSimon J. Gerratyjust counts {} and () in order to find the end of a variable expansion. 276393036677SSimon J. Gerraty.Pp 276493036677SSimon J. GerratyThere is no way of escaping a space character in a filename. 27658c973ee2SSimon J. Gerraty.Pp 27668c973ee2SSimon J. GerratyIn jobs mode, when a target fails; 27678c973ee2SSimon J. Gerratymake 27688c973ee2SSimon J. Gerratywill put an error token into the job token pool. 27698c973ee2SSimon J. GerratyThis will cause all other instances of 27708c973ee2SSimon J. Gerratymake 27718c973ee2SSimon J. Gerratyusing that token pool to abort the build and exit with error code 6. 27728c973ee2SSimon J. GerratySometimes the attempt to suppress a cascade of unnecessary errors, 27738c973ee2SSimon J. Gerratycan result in a seemingly unexplained 27748c973ee2SSimon J. Gerraty.Ql *** Error code 6 2775