11bbe5942SSimon J. Gerraty.\" $NetBSD: make.1,v 1.222 2013/08/11 09:53:49 apb 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.\" 321bbe5942SSimon J. Gerraty.Dd August 11, 2013 333955d011SMarcel Moolenaar.Dt MAKE 1 343955d011SMarcel Moolenaar.Os 353955d011SMarcel Moolenaar.Sh NAME 363955d011SMarcel Moolenaar.Nm make 373955d011SMarcel Moolenaar.Nd maintain program dependencies 383955d011SMarcel Moolenaar.Sh SYNOPSIS 393955d011SMarcel Moolenaar.Nm 4051ee2c1cSSimon J. Gerraty.Op Fl BeikNnqrstWwX 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 513955d011SMarcel Moolenaar.Op Ar variable=value 523955d011SMarcel Moolenaar.Op Ar target ... 533955d011SMarcel Moolenaar.Sh DESCRIPTION 543955d011SMarcel Moolenaar.Nm 553955d011SMarcel Moolenaaris a program designed to simplify the maintenance of other programs. 563955d011SMarcel MoolenaarIts input is a list of specifications as to the files upon which programs 573955d011SMarcel Moolenaarand other files depend. 583955d011SMarcel MoolenaarIf no 593955d011SMarcel Moolenaar.Fl f Ar makefile 603955d011SMarcel Moolenaarmakefile option is given, 613955d011SMarcel Moolenaar.Nm 623955d011SMarcel Moolenaarwill try to open 633955d011SMarcel Moolenaar.Ql Pa makefile 643955d011SMarcel Moolenaarthen 653955d011SMarcel Moolenaar.Ql Pa Makefile 663955d011SMarcel Moolenaarin order to find the specifications. 673955d011SMarcel MoolenaarIf the file 683955d011SMarcel Moolenaar.Ql Pa .depend 693955d011SMarcel Moolenaarexists, it is read (see 703955d011SMarcel Moolenaar.Xr mkdep 1 ) . 713955d011SMarcel Moolenaar.Pp 723955d011SMarcel MoolenaarThis manual page is intended as a reference document only. 733955d011SMarcel MoolenaarFor a more thorough description of 743955d011SMarcel Moolenaar.Nm 753955d011SMarcel Moolenaarand makefiles, please refer to 763955d011SMarcel Moolenaar.%T "PMake \- A Tutorial" . 773955d011SMarcel Moolenaar.Pp 783955d011SMarcel Moolenaar.Nm 793955d011SMarcel Moolenaarwill prepend the contents of the 803955d011SMarcel Moolenaar.Va MAKEFLAGS 813955d011SMarcel Moolenaarenvironment variable to the command line arguments before parsing them. 823955d011SMarcel Moolenaar.Pp 833955d011SMarcel MoolenaarThe options are as follows: 843955d011SMarcel Moolenaar.Bl -tag -width Ds 853955d011SMarcel Moolenaar.It Fl B 863955d011SMarcel MoolenaarTry to be backwards compatible by executing a single shell per command and 873955d011SMarcel Moolenaarby executing the commands to make the sources of a dependency line in sequence. 883955d011SMarcel Moolenaar.It Fl C Ar directory 893955d011SMarcel MoolenaarChange to 903955d011SMarcel Moolenaar.Ar directory 913955d011SMarcel Moolenaarbefore reading the makefiles or doing anything else. 923955d011SMarcel MoolenaarIf multiple 933955d011SMarcel Moolenaar.Fl C 943955d011SMarcel Moolenaaroptions are specified, each is interpreted relative to the previous one: 953955d011SMarcel Moolenaar.Fl C Pa / Fl C Pa etc 963955d011SMarcel Moolenaaris equivalent to 973955d011SMarcel Moolenaar.Fl C Pa /etc . 983955d011SMarcel Moolenaar.It Fl D Ar variable 993955d011SMarcel MoolenaarDefine 1003955d011SMarcel Moolenaar.Ar variable 1013955d011SMarcel Moolenaarto be 1, in the global context. 1023955d011SMarcel Moolenaar.It Fl d Ar [-]flags 1033955d011SMarcel MoolenaarTurn on debugging, and specify which portions of 1043955d011SMarcel Moolenaar.Nm 1053955d011SMarcel Moolenaarare to print debugging information. 1063955d011SMarcel MoolenaarUnless the flags are preceded by 1073955d011SMarcel Moolenaar.Ql \- 1083955d011SMarcel Moolenaarthey are added to the 1093955d011SMarcel Moolenaar.Va MAKEFLAGS 1103955d011SMarcel Moolenaarenvironment variable and will be processed by any child make processes. 1113955d011SMarcel MoolenaarBy default, debugging information is printed to standard error, 1123955d011SMarcel Moolenaarbut this can be changed using the 1133955d011SMarcel Moolenaar.Ar F 1143955d011SMarcel Moolenaardebugging flag. 1153955d011SMarcel MoolenaarThe debugging output is always unbuffered; in addition, if debugging 1163955d011SMarcel Moolenaaris enabled but debugging output is not directed to standard output, 1173955d011SMarcel Moolenaarthen the standard output is line buffered. 1183955d011SMarcel Moolenaar.Ar Flags 1193955d011SMarcel Moolenaaris one or more of the following: 1203955d011SMarcel Moolenaar.Bl -tag -width Ds 1213955d011SMarcel Moolenaar.It Ar A 1223955d011SMarcel MoolenaarPrint all possible debugging information; 1233955d011SMarcel Moolenaarequivalent to specifying all of the debugging flags. 1243955d011SMarcel Moolenaar.It Ar a 1253955d011SMarcel MoolenaarPrint debugging information about archive searching and caching. 1263955d011SMarcel Moolenaar.It Ar C 1273955d011SMarcel MoolenaarPrint debugging information about current working directory. 1283955d011SMarcel Moolenaar.It Ar c 1293955d011SMarcel MoolenaarPrint debugging information about conditional evaluation. 1303955d011SMarcel Moolenaar.It Ar d 1313955d011SMarcel MoolenaarPrint debugging information about directory searching and caching. 1323955d011SMarcel Moolenaar.It Ar e 1333955d011SMarcel MoolenaarPrint debugging information about failed commands and targets. 1343955d011SMarcel Moolenaar.It Ar F Ns Oo Sy \&+ Oc Ns Ar filename 1353955d011SMarcel MoolenaarSpecify where debugging output is written. 1363955d011SMarcel MoolenaarThis must be the last flag, because it consumes the remainder of 1373955d011SMarcel Moolenaarthe argument. 1383955d011SMarcel MoolenaarIf the character immediately after the 1393955d011SMarcel Moolenaar.Ql F 1403955d011SMarcel Moolenaarflag is 1413955d011SMarcel Moolenaar.Ql \&+ , 1423955d011SMarcel Moolenaarthen the file will be opened in append mode; 1433955d011SMarcel Moolenaarotherwise the file will be overwritten. 1443955d011SMarcel MoolenaarIf the file name is 1453955d011SMarcel Moolenaar.Ql stdout 1463955d011SMarcel Moolenaaror 1473955d011SMarcel Moolenaar.Ql stderr 1483955d011SMarcel Moolenaarthen debugging output will be written to the 1493955d011SMarcel Moolenaarstandard output or standard error output file descriptors respectively 1503955d011SMarcel Moolenaar(and the 1513955d011SMarcel Moolenaar.Ql \&+ 1523955d011SMarcel Moolenaaroption has no effect). 1533955d011SMarcel MoolenaarOtherwise, the output will be written to the named file. 1543955d011SMarcel MoolenaarIf the file name ends 1553955d011SMarcel Moolenaar.Ql .%d 1563955d011SMarcel Moolenaarthen the 1573955d011SMarcel Moolenaar.Ql %d 1583955d011SMarcel Moolenaaris replaced by the pid. 1593955d011SMarcel Moolenaar.It Ar f 1603955d011SMarcel MoolenaarPrint debugging information about loop evaluation. 1613955d011SMarcel Moolenaar.It Ar "g1" 1623955d011SMarcel MoolenaarPrint the input graph before making anything. 1633955d011SMarcel Moolenaar.It Ar "g2" 1643955d011SMarcel MoolenaarPrint the input graph after making everything, or before exiting 1653955d011SMarcel Moolenaaron error. 1663955d011SMarcel Moolenaar.It Ar "g3" 1673955d011SMarcel MoolenaarPrint the input graph before exiting on error. 1683955d011SMarcel Moolenaar.It Ar j 1693955d011SMarcel MoolenaarPrint debugging information about running multiple shells. 1703955d011SMarcel Moolenaar.It Ar l 1713955d011SMarcel MoolenaarPrint commands in Makefiles regardless of whether or not they are prefixed by 1723955d011SMarcel Moolenaar.Ql @ 1733955d011SMarcel Moolenaaror other "quiet" flags. 1743955d011SMarcel MoolenaarAlso known as "loud" behavior. 1753955d011SMarcel Moolenaar.It Ar M 1763955d011SMarcel MoolenaarPrint debugging information about "meta" mode decisions about targets. 1773955d011SMarcel Moolenaar.It Ar m 1783955d011SMarcel MoolenaarPrint debugging information about making targets, including modification 1793955d011SMarcel Moolenaardates. 1803955d011SMarcel Moolenaar.It Ar n 1813955d011SMarcel MoolenaarDon't delete the temporary command scripts created when running commands. 1823955d011SMarcel MoolenaarThese temporary scripts are created in the directory 1833955d011SMarcel Moolenaarreferred to by the 1843955d011SMarcel Moolenaar.Ev TMPDIR 1853955d011SMarcel Moolenaarenvironment variable, or in 1863955d011SMarcel Moolenaar.Pa /tmp 1873955d011SMarcel Moolenaarif 1883955d011SMarcel Moolenaar.Ev TMPDIR 1893955d011SMarcel Moolenaaris unset or set to the empty string. 1903955d011SMarcel MoolenaarThe temporary scripts are created by 1913955d011SMarcel Moolenaar.Xr mkstemp 3 , 1923955d011SMarcel Moolenaarand have names of the form 1933955d011SMarcel Moolenaar.Pa makeXXXXXX . 1943955d011SMarcel Moolenaar.Em NOTE : 1953955d011SMarcel MoolenaarThis can create many files in 1963955d011SMarcel Moolenaar.Ev TMPDIR 1973955d011SMarcel Moolenaaror 1983955d011SMarcel Moolenaar.Pa /tmp , 1993955d011SMarcel Moolenaarso use with care. 2003955d011SMarcel Moolenaar.It Ar p 2013955d011SMarcel MoolenaarPrint debugging information about makefile parsing. 2023955d011SMarcel Moolenaar.It Ar s 2033955d011SMarcel MoolenaarPrint debugging information about suffix-transformation rules. 2043955d011SMarcel Moolenaar.It Ar t 2053955d011SMarcel MoolenaarPrint debugging information about target list maintenance. 2063955d011SMarcel Moolenaar.It Ar V 2073955d011SMarcel MoolenaarForce the 2083955d011SMarcel Moolenaar.Fl V 2093955d011SMarcel Moolenaaroption to print raw values of variables. 2103955d011SMarcel Moolenaar.It Ar v 2113955d011SMarcel MoolenaarPrint debugging information about variable assignment. 21251ee2c1cSSimon J. Gerraty.It Ar w 21351ee2c1cSSimon J. GerratyPrint entering and leaving directory messages, pre and post processing. 2143955d011SMarcel Moolenaar.It Ar x 2153955d011SMarcel MoolenaarRun shell commands with 2163955d011SMarcel Moolenaar.Fl x 2173955d011SMarcel Moolenaarso the actual commands are printed as they are executed. 2183955d011SMarcel Moolenaar.El 2193955d011SMarcel Moolenaar.It Fl e 2203955d011SMarcel MoolenaarSpecify that environment variables override macro assignments within 2213955d011SMarcel Moolenaarmakefiles. 2223955d011SMarcel Moolenaar.It Fl f Ar makefile 2233955d011SMarcel MoolenaarSpecify a makefile to read instead of the default 2243955d011SMarcel Moolenaar.Ql Pa makefile . 2253955d011SMarcel MoolenaarIf 2263955d011SMarcel Moolenaar.Ar makefile 2273955d011SMarcel Moolenaaris 2283955d011SMarcel Moolenaar.Ql Fl , 2293955d011SMarcel Moolenaarstandard input is read. 2303955d011SMarcel MoolenaarMultiple makefiles may be specified, and are read in the order specified. 2313955d011SMarcel Moolenaar.It Fl I Ar directory 2323955d011SMarcel MoolenaarSpecify a directory in which to search for makefiles and included makefiles. 2333955d011SMarcel MoolenaarThe system makefile directory (or directories, see the 2343955d011SMarcel Moolenaar.Fl m 2353955d011SMarcel Moolenaaroption) is automatically included as part of this list. 2363955d011SMarcel Moolenaar.It Fl i 2373955d011SMarcel MoolenaarIgnore non-zero exit of shell commands in the makefile. 2383955d011SMarcel MoolenaarEquivalent to specifying 2393955d011SMarcel Moolenaar.Ql Fl 2403955d011SMarcel Moolenaarbefore each command line in the makefile. 2413955d011SMarcel Moolenaar.It Fl J Ar private 2423955d011SMarcel MoolenaarThis option should 2433955d011SMarcel Moolenaar.Em not 2443955d011SMarcel Moolenaarbe specified by the user. 2453955d011SMarcel Moolenaar.Pp 2463955d011SMarcel MoolenaarWhen the 2473955d011SMarcel Moolenaar.Ar j 2483955d011SMarcel Moolenaaroption is in use in a recursive build, this option is passed by a make 2493955d011SMarcel Moolenaarto child makes to allow all the make processes in the build to 2503955d011SMarcel Moolenaarcooperate to avoid overloading the system. 2513955d011SMarcel Moolenaar.It Fl j Ar max_jobs 2523955d011SMarcel MoolenaarSpecify the maximum number of jobs that 2533955d011SMarcel Moolenaar.Nm 2543955d011SMarcel Moolenaarmay have running at any one time. 2553955d011SMarcel MoolenaarThe value is saved in 2563955d011SMarcel Moolenaar.Va .MAKE.JOBS . 2573955d011SMarcel MoolenaarTurns compatibility mode off, unless the 2583955d011SMarcel Moolenaar.Ar B 2593955d011SMarcel Moolenaarflag is also specified. 2603955d011SMarcel MoolenaarWhen compatibility mode is off, all commands associated with a 2613955d011SMarcel Moolenaartarget are executed in a single shell invocation as opposed to the 2623955d011SMarcel Moolenaartraditional one shell invocation per line. 2633955d011SMarcel MoolenaarThis can break traditional scripts which change directories on each 2643955d011SMarcel Moolenaarcommand invocation and then expect to start with a fresh environment 2653955d011SMarcel Moolenaaron the next line. 2663955d011SMarcel MoolenaarIt is more efficient to correct the scripts rather than turn backwards 2673955d011SMarcel Moolenaarcompatibility on. 2683955d011SMarcel Moolenaar.It Fl k 2693955d011SMarcel MoolenaarContinue processing after errors are encountered, but only on those targets 2703955d011SMarcel Moolenaarthat do not depend on the target whose creation caused the error. 2713955d011SMarcel Moolenaar.It Fl m Ar directory 2723955d011SMarcel MoolenaarSpecify a directory in which to search for sys.mk and makefiles included 2733955d011SMarcel Moolenaarvia the 2743955d011SMarcel Moolenaar.Ao Ar file Ac Ns -style 2753955d011SMarcel Moolenaarinclude statement. 2763955d011SMarcel MoolenaarThe 2773955d011SMarcel Moolenaar.Fl m 2783955d011SMarcel Moolenaaroption can be used multiple times to form a search path. 2793955d011SMarcel MoolenaarThis path will override the default system include path: /usr/share/mk. 2803955d011SMarcel MoolenaarFurthermore the system include path will be appended to the search path used 2813955d011SMarcel Moolenaarfor 2823955d011SMarcel Moolenaar.Qo Ar file Qc Ns -style 2833955d011SMarcel Moolenaarinclude statements (see the 2843955d011SMarcel Moolenaar.Fl I 2853955d011SMarcel Moolenaaroption). 2863955d011SMarcel Moolenaar.Pp 2873955d011SMarcel MoolenaarIf a file or directory name in the 2883955d011SMarcel Moolenaar.Fl m 2893955d011SMarcel Moolenaarargument (or the 2903955d011SMarcel Moolenaar.Ev MAKESYSPATH 2913955d011SMarcel Moolenaarenvironment variable) starts with the string 2923955d011SMarcel Moolenaar.Qq \&.../ 2933955d011SMarcel Moolenaarthen 2943955d011SMarcel Moolenaar.Nm 2953955d011SMarcel Moolenaarwill search for the specified file or directory named in the remaining part 2963955d011SMarcel Moolenaarof the argument string. 2973955d011SMarcel MoolenaarThe search starts with the current directory of 2983955d011SMarcel Moolenaarthe Makefile and then works upward towards the root of the filesystem. 2993955d011SMarcel MoolenaarIf the search is successful, then the resulting directory replaces the 3003955d011SMarcel Moolenaar.Qq \&.../ 3013955d011SMarcel Moolenaarspecification in the 3023955d011SMarcel Moolenaar.Fl m 3033955d011SMarcel Moolenaarargument. 3043955d011SMarcel MoolenaarIf used, this feature allows 3053955d011SMarcel Moolenaar.Nm 3063955d011SMarcel Moolenaarto easily search in the current source tree for customized sys.mk files 3073955d011SMarcel Moolenaar(e.g., by using 3083955d011SMarcel Moolenaar.Qq \&.../mk/sys.mk 3093955d011SMarcel Moolenaaras an argument). 3103955d011SMarcel Moolenaar.It Fl n 3113955d011SMarcel MoolenaarDisplay the commands that would have been executed, but do not 3123955d011SMarcel Moolenaaractually execute them unless the target depends on the .MAKE special 3133955d011SMarcel Moolenaarsource (see below). 3143955d011SMarcel Moolenaar.It Fl N 3153955d011SMarcel MoolenaarDisplay the commands which would have been executed, but do not 3163955d011SMarcel Moolenaaractually execute any of them; useful for debugging top-level makefiles 3173955d011SMarcel Moolenaarwithout descending into subdirectories. 3183955d011SMarcel Moolenaar.It Fl q 3193955d011SMarcel MoolenaarDo not execute any commands, but exit 0 if the specified targets are 3203955d011SMarcel Moolenaarup-to-date and 1, otherwise. 3213955d011SMarcel Moolenaar.It Fl r 3223955d011SMarcel MoolenaarDo not use the built-in rules specified in the system makefile. 3233955d011SMarcel Moolenaar.It Fl s 3243955d011SMarcel MoolenaarDo not echo any commands as they are executed. 3253955d011SMarcel MoolenaarEquivalent to specifying 3263955d011SMarcel Moolenaar.Ql Ic @ 3273955d011SMarcel Moolenaarbefore each command line in the makefile. 3283955d011SMarcel Moolenaar.It Fl T Ar tracefile 3293955d011SMarcel MoolenaarWhen used with the 3303955d011SMarcel Moolenaar.Fl j 3313955d011SMarcel Moolenaarflag, 3323955d011SMarcel Moolenaarappend a trace record to 3333955d011SMarcel Moolenaar.Ar tracefile 3343955d011SMarcel Moolenaarfor each job started and completed. 3353955d011SMarcel Moolenaar.It Fl t 3363955d011SMarcel MoolenaarRather than re-building a target as specified in the makefile, create it 3373955d011SMarcel Moolenaaror update its modification time to make it appear up-to-date. 3383955d011SMarcel Moolenaar.It Fl V Ar variable 3393955d011SMarcel MoolenaarPrint 3403955d011SMarcel Moolenaar.Nm Ns 's 3413955d011SMarcel Moolenaaridea of the value of 3423955d011SMarcel Moolenaar.Ar variable , 3433955d011SMarcel Moolenaarin the global context. 3443955d011SMarcel MoolenaarDo not build any targets. 3453955d011SMarcel MoolenaarMultiple instances of this option may be specified; 3463955d011SMarcel Moolenaarthe variables will be printed one per line, 3473955d011SMarcel Moolenaarwith a blank line for each null or undefined variable. 3483955d011SMarcel MoolenaarIf 3493955d011SMarcel Moolenaar.Ar variable 3503955d011SMarcel Moolenaarcontains a 3513955d011SMarcel Moolenaar.Ql \&$ 3523955d011SMarcel Moolenaarthen the value will be expanded before printing. 3533955d011SMarcel Moolenaar.It Fl W 3543955d011SMarcel MoolenaarTreat any warnings during makefile parsing as errors. 3553955d011SMarcel Moolenaar.It Fl X 3563955d011SMarcel MoolenaarDon't export variables passed on the command line to the environment 3573955d011SMarcel Moolenaarindividually. 3583955d011SMarcel MoolenaarVariables passed on the command line are still exported 3593955d011SMarcel Moolenaarvia the 3603955d011SMarcel Moolenaar.Va MAKEFLAGS 3613955d011SMarcel Moolenaarenvironment variable. 3623955d011SMarcel MoolenaarThis option may be useful on systems which have a small limit on the 3633955d011SMarcel Moolenaarsize of command arguments. 3643955d011SMarcel Moolenaar.It Ar variable=value 3653955d011SMarcel MoolenaarSet the value of the variable 3663955d011SMarcel Moolenaar.Ar variable 3673955d011SMarcel Moolenaarto 3683955d011SMarcel Moolenaar.Ar value . 3693955d011SMarcel MoolenaarNormally, all values passed on the command line are also exported to 3703955d011SMarcel Moolenaarsub-makes in the environment. 3713955d011SMarcel MoolenaarThe 3723955d011SMarcel Moolenaar.Fl X 3733955d011SMarcel Moolenaarflag disables this behavior. 3743955d011SMarcel MoolenaarVariable assignments should follow options for POSIX compatibility 3753955d011SMarcel Moolenaarbut no ordering is enforced. 3763955d011SMarcel Moolenaar.El 3773955d011SMarcel Moolenaar.Pp 3783955d011SMarcel MoolenaarThere are seven different types of lines in a makefile: file dependency 3793955d011SMarcel Moolenaarspecifications, shell commands, variable assignments, include statements, 3803955d011SMarcel Moolenaarconditional directives, for loops, and comments. 3813955d011SMarcel Moolenaar.Pp 3823955d011SMarcel MoolenaarIn general, lines may be continued from one line to the next by ending 3833955d011SMarcel Moolenaarthem with a backslash 3843955d011SMarcel Moolenaar.Pq Ql \e . 3853955d011SMarcel MoolenaarThe trailing newline character and initial whitespace on the following 3863955d011SMarcel Moolenaarline are compressed into a single space. 3873955d011SMarcel Moolenaar.Sh FILE DEPENDENCY SPECIFICATIONS 3883955d011SMarcel MoolenaarDependency lines consist of one or more targets, an operator, and zero 3893955d011SMarcel Moolenaaror more sources. 3903955d011SMarcel MoolenaarThis creates a relationship where the targets 3913955d011SMarcel Moolenaar.Dq depend 3923955d011SMarcel Moolenaaron the sources 3933955d011SMarcel Moolenaarand are usually created from them. 3943955d011SMarcel MoolenaarThe exact relationship between the target and the source is determined 3953955d011SMarcel Moolenaarby the operator that separates them. 3963955d011SMarcel MoolenaarThe three operators are as follows: 3973955d011SMarcel Moolenaar.Bl -tag -width flag 3983955d011SMarcel Moolenaar.It Ic \&: 3993955d011SMarcel MoolenaarA target is considered out-of-date if its modification time is less than 4003955d011SMarcel Moolenaarthose of any of its sources. 4013955d011SMarcel MoolenaarSources for a target accumulate over dependency lines when this operator 4023955d011SMarcel Moolenaaris used. 4033955d011SMarcel MoolenaarThe target is removed if 4043955d011SMarcel Moolenaar.Nm 4053955d011SMarcel Moolenaaris interrupted. 4063955d011SMarcel Moolenaar.It Ic \&! 4073955d011SMarcel MoolenaarTargets are always re-created, but not until all sources have been 4083955d011SMarcel Moolenaarexamined and re-created as necessary. 4093955d011SMarcel MoolenaarSources for a target accumulate over dependency lines when this operator 4103955d011SMarcel Moolenaaris used. 4113955d011SMarcel MoolenaarThe target is removed if 4123955d011SMarcel Moolenaar.Nm 4133955d011SMarcel Moolenaaris interrupted. 4143955d011SMarcel Moolenaar.It Ic \&:: 4153955d011SMarcel MoolenaarIf no sources are specified, the target is always re-created. 4163955d011SMarcel MoolenaarOtherwise, a target is considered out-of-date if any of its sources has 4173955d011SMarcel Moolenaarbeen modified more recently than the target. 4183955d011SMarcel MoolenaarSources for a target do not accumulate over dependency lines when this 4193955d011SMarcel Moolenaaroperator is used. 4203955d011SMarcel MoolenaarThe target will not be removed if 4213955d011SMarcel Moolenaar.Nm 4223955d011SMarcel Moolenaaris interrupted. 4233955d011SMarcel Moolenaar.El 4243955d011SMarcel Moolenaar.Pp 4253955d011SMarcel MoolenaarTargets and sources may contain the shell wildcard values 4263955d011SMarcel Moolenaar.Ql \&? , 4273955d011SMarcel Moolenaar.Ql * , 4283955d011SMarcel Moolenaar.Ql [] , 4293955d011SMarcel Moolenaarand 4303955d011SMarcel Moolenaar.Ql {} . 4313955d011SMarcel MoolenaarThe values 4323955d011SMarcel Moolenaar.Ql \&? , 4333955d011SMarcel Moolenaar.Ql * , 4343955d011SMarcel Moolenaarand 4353955d011SMarcel Moolenaar.Ql [] 4363955d011SMarcel Moolenaarmay only be used as part of the final 4373955d011SMarcel Moolenaarcomponent of the target or source, and must be used to describe existing 4383955d011SMarcel Moolenaarfiles. 4393955d011SMarcel MoolenaarThe value 4403955d011SMarcel Moolenaar.Ql {} 4413955d011SMarcel Moolenaarneed not necessarily be used to describe existing files. 4423955d011SMarcel MoolenaarExpansion is in directory order, not alphabetically as done in the shell. 4433955d011SMarcel Moolenaar.Sh SHELL COMMANDS 4443955d011SMarcel MoolenaarEach target may have associated with it a series of shell commands, normally 4453955d011SMarcel Moolenaarused to create the target. 4463955d011SMarcel MoolenaarEach of the commands in this script 4473955d011SMarcel Moolenaar.Em must 4483955d011SMarcel Moolenaarbe preceded by a tab. 4493955d011SMarcel MoolenaarWhile any target may appear on a dependency line, only one of these 4503955d011SMarcel Moolenaardependencies may be followed by a creation script, unless the 4513955d011SMarcel Moolenaar.Ql Ic \&:: 4523955d011SMarcel Moolenaaroperator is used. 4533955d011SMarcel Moolenaar.Pp 4543955d011SMarcel MoolenaarIf the first characters of the command line are any combination of 4553955d011SMarcel Moolenaar.Ql Ic @ , 4563955d011SMarcel Moolenaar.Ql Ic + , 4573955d011SMarcel Moolenaaror 4583955d011SMarcel Moolenaar.Ql Ic \- , 4593955d011SMarcel Moolenaarthe command is treated specially. 4603955d011SMarcel MoolenaarA 4613955d011SMarcel Moolenaar.Ql Ic @ 4623955d011SMarcel Moolenaarcauses the command not to be echoed before it is executed. 4633955d011SMarcel MoolenaarA 4643955d011SMarcel Moolenaar.Ql Ic + 4653955d011SMarcel Moolenaarcauses the command to be executed even when 4663955d011SMarcel Moolenaar.Fl n 4673955d011SMarcel Moolenaaris given. 4683955d011SMarcel MoolenaarThis is similar to the effect of the .MAKE special source, 4693955d011SMarcel Moolenaarexcept that the effect can be limited to a single line of a script. 4703955d011SMarcel MoolenaarA 4713955d011SMarcel Moolenaar.Ql Ic \- 4723955d011SMarcel Moolenaarcauses any non-zero exit status of the command line to be ignored. 4733cbdda60SSimon J. Gerraty.Pp 4743cbdda60SSimon J. GerratyWhen 4753cbdda60SSimon J. Gerraty.Nm 4763cbdda60SSimon J. Gerratyis run in jobs mode with 4773cbdda60SSimon J. Gerraty.Fl j Ar max_jobs , 4783cbdda60SSimon J. Gerratythe entire script for the target is fed to a 4793cbdda60SSimon J. Gerratysingle instance of the shell. 4803cbdda60SSimon J. Gerraty.Pp 4813cbdda60SSimon J. GerratyIn compatibility (non-jobs) mode, each command is run in a separate process. 4823cbdda60SSimon J. GerratyIf the command contains any shell meta characters 4833cbdda60SSimon J. Gerraty.Pq Ql #=|^(){};&<>*?[]:$`\e\en 4843cbdda60SSimon J. Gerratyit will be passed to the shell, otherwise 4853cbdda60SSimon J. Gerraty.Nm 4863cbdda60SSimon J. Gerratywill attempt direct execution. 4873cbdda60SSimon J. Gerraty.Pp 4883cbdda60SSimon J. GerratySince 4893cbdda60SSimon J. Gerraty.Nm 4903cbdda60SSimon J. Gerratywill 4913cbdda60SSimon J. Gerraty.Xr chdir 2 4923cbdda60SSimon J. Gerratyto 4933cbdda60SSimon J. Gerraty.Ql Va .OBJDIR 4943cbdda60SSimon J. Gerratybefore executing any targets, each child process 4953cbdda60SSimon J. Gerratystarts with that as its current working directory. 4963cbdda60SSimon J. Gerraty.Pp 4973cbdda60SSimon J. GerratyMakefiles should be written so that the mode of 4983cbdda60SSimon J. Gerraty.Nm 4993cbdda60SSimon J. Gerratyoperation does not change their behavior. 5003cbdda60SSimon J. GerratyFor example, any command which needs to use 5013cbdda60SSimon J. Gerraty.Dq cd 5023cbdda60SSimon J. Gerratyor 5033cbdda60SSimon J. Gerraty.Dq chdir , 5043cbdda60SSimon J. Gerratywithout side-effect should be put in parenthesis: 5053cbdda60SSimon J. Gerraty.Bd -literal -offset indent 5063cbdda60SSimon J. Gerraty 5073cbdda60SSimon J. Gerratyavoid-chdir-side-effects: 5083cbdda60SSimon J. Gerraty @echo Building $@ in `pwd` 5093cbdda60SSimon J. Gerraty @(cd ${.CURDIR} && ${.MAKE} $@) 5103cbdda60SSimon J. Gerraty @echo Back in `pwd` 5113cbdda60SSimon J. Gerraty 5123cbdda60SSimon J. Gerratyensure-one-shell-regardless-of-mode: 5133cbdda60SSimon J. Gerraty @echo Building $@ in `pwd`; \\ 5143cbdda60SSimon J. Gerraty (cd ${.CURDIR} && ${.MAKE} $@); \\ 5153cbdda60SSimon J. Gerraty echo Back in `pwd` 5163cbdda60SSimon J. Gerraty.Ed 5173955d011SMarcel Moolenaar.Sh VARIABLE ASSIGNMENTS 5183955d011SMarcel MoolenaarVariables in make are much like variables in the shell, and, by tradition, 5193955d011SMarcel Moolenaarconsist of all upper-case letters. 5203955d011SMarcel Moolenaar.Ss Variable assignment modifiers 5213955d011SMarcel MoolenaarThe five operators that can be used to assign values to variables are as 5223955d011SMarcel Moolenaarfollows: 5233955d011SMarcel Moolenaar.Bl -tag -width Ds 5243955d011SMarcel Moolenaar.It Ic \&= 5253955d011SMarcel MoolenaarAssign the value to the variable. 5263955d011SMarcel MoolenaarAny previous value is overridden. 5273955d011SMarcel Moolenaar.It Ic \&+= 5283955d011SMarcel MoolenaarAppend the value to the current value of the variable. 5293955d011SMarcel Moolenaar.It Ic \&?= 5303955d011SMarcel MoolenaarAssign the value to the variable if it is not already defined. 5313955d011SMarcel Moolenaar.It Ic \&:= 5323955d011SMarcel MoolenaarAssign with expansion, i.e. expand the value before assigning it 5333955d011SMarcel Moolenaarto the variable. 5343955d011SMarcel MoolenaarNormally, expansion is not done until the variable is referenced. 5353955d011SMarcel Moolenaar.Em NOTE : 5363955d011SMarcel MoolenaarReferences to undefined variables are 5373955d011SMarcel Moolenaar.Em not 5383955d011SMarcel Moolenaarexpanded. 5393955d011SMarcel MoolenaarThis can cause problems when variable modifiers are used. 5403955d011SMarcel Moolenaar.It Ic \&!= 5413955d011SMarcel MoolenaarExpand the value and pass it to the shell for execution and assign 5423955d011SMarcel Moolenaarthe result to the variable. 5433955d011SMarcel MoolenaarAny newlines in the result are replaced with spaces. 5443955d011SMarcel Moolenaar.El 5453955d011SMarcel Moolenaar.Pp 5463955d011SMarcel MoolenaarAny white-space before the assigned 5473955d011SMarcel Moolenaar.Ar value 5483955d011SMarcel Moolenaaris removed; if the value is being appended, a single space is inserted 5493955d011SMarcel Moolenaarbetween the previous contents of the variable and the appended value. 5503955d011SMarcel Moolenaar.Pp 5513955d011SMarcel MoolenaarVariables are expanded by surrounding the variable name with either 5523955d011SMarcel Moolenaarcurly braces 5533955d011SMarcel Moolenaar.Pq Ql {} 5543955d011SMarcel Moolenaaror parentheses 5553955d011SMarcel Moolenaar.Pq Ql () 5563955d011SMarcel Moolenaarand preceding it with 5573955d011SMarcel Moolenaara dollar sign 5583955d011SMarcel Moolenaar.Pq Ql \&$ . 5593955d011SMarcel MoolenaarIf the variable name contains only a single letter, the surrounding 5603955d011SMarcel Moolenaarbraces or parentheses are not required. 5613955d011SMarcel MoolenaarThis shorter form is not recommended. 5623955d011SMarcel Moolenaar.Pp 5633955d011SMarcel MoolenaarIf the variable name contains a dollar, then the name itself is expanded first. 5643955d011SMarcel MoolenaarThis allows almost arbitrary variable names, however names containing dollar, 5653955d011SMarcel Moolenaarbraces, parenthesis, or whitespace are really best avoided! 5663955d011SMarcel Moolenaar.Pp 5673955d011SMarcel MoolenaarIf the result of expanding a variable contains a dollar sign 5683955d011SMarcel Moolenaar.Pq Ql \&$ 5693955d011SMarcel Moolenaarthe string is expanded again. 5703955d011SMarcel Moolenaar.Pp 5713955d011SMarcel MoolenaarVariable substitution occurs at three distinct times, depending on where 5723955d011SMarcel Moolenaarthe variable is being used. 5733955d011SMarcel Moolenaar.Bl -enum 5743955d011SMarcel Moolenaar.It 5753955d011SMarcel MoolenaarVariables in dependency lines are expanded as the line is read. 5763955d011SMarcel Moolenaar.It 5773955d011SMarcel MoolenaarVariables in shell commands are expanded when the shell command is 5783955d011SMarcel Moolenaarexecuted. 5793955d011SMarcel Moolenaar.It 5803955d011SMarcel Moolenaar.Dq .for 5813955d011SMarcel Moolenaarloop index variables are expanded on each loop iteration. 5823955d011SMarcel MoolenaarNote that other variables are not expanded inside loops so 5833955d011SMarcel Moolenaarthe following example code: 5843955d011SMarcel Moolenaar.Bd -literal -offset indent 5853955d011SMarcel Moolenaar 5863955d011SMarcel Moolenaar.Dv .for i in 1 2 3 5873955d011SMarcel Moolenaara+= ${i} 5883955d011SMarcel Moolenaarj= ${i} 5893955d011SMarcel Moolenaarb+= ${j} 5903955d011SMarcel Moolenaar.Dv .endfor 5913955d011SMarcel Moolenaar 5923955d011SMarcel Moolenaarall: 5933955d011SMarcel Moolenaar @echo ${a} 5943955d011SMarcel Moolenaar @echo ${b} 5953955d011SMarcel Moolenaar 5963955d011SMarcel Moolenaar.Ed 5973955d011SMarcel Moolenaarwill print: 5983955d011SMarcel Moolenaar.Bd -literal -offset indent 5993955d011SMarcel Moolenaar1 2 3 6003955d011SMarcel Moolenaar3 3 3 6013955d011SMarcel Moolenaar 6023955d011SMarcel Moolenaar.Ed 6033955d011SMarcel MoolenaarBecause while ${a} contains 6043955d011SMarcel Moolenaar.Dq 1 2 3 6053955d011SMarcel Moolenaarafter the loop is executed, ${b} 6063955d011SMarcel Moolenaarcontains 6073955d011SMarcel Moolenaar.Dq ${j} ${j} ${j} 6083955d011SMarcel Moolenaarwhich expands to 6093955d011SMarcel Moolenaar.Dq 3 3 3 6103955d011SMarcel Moolenaarsince after the loop completes ${j} contains 6113955d011SMarcel Moolenaar.Dq 3 . 6123955d011SMarcel Moolenaar.El 6133955d011SMarcel Moolenaar.Ss Variable classes 6143955d011SMarcel MoolenaarThe four different classes of variables (in order of increasing precedence) 6153955d011SMarcel Moolenaarare: 6163955d011SMarcel Moolenaar.Bl -tag -width Ds 6173955d011SMarcel Moolenaar.It Environment variables 6183955d011SMarcel MoolenaarVariables defined as part of 6193955d011SMarcel Moolenaar.Nm Ns 's 6203955d011SMarcel Moolenaarenvironment. 6213955d011SMarcel Moolenaar.It Global variables 6223955d011SMarcel MoolenaarVariables defined in the makefile or in included makefiles. 6233955d011SMarcel Moolenaar.It Command line variables 6243955d011SMarcel MoolenaarVariables defined as part of the command line. 6253955d011SMarcel Moolenaar.It Local variables 6263955d011SMarcel MoolenaarVariables that are defined specific to a certain target. 6273955d011SMarcel MoolenaarThe seven local variables are as follows: 6283955d011SMarcel Moolenaar.Bl -tag -width ".ARCHIVE" 6293955d011SMarcel Moolenaar.It Va .ALLSRC 6303955d011SMarcel MoolenaarThe list of all sources for this target; also known as 6313955d011SMarcel Moolenaar.Ql Va \&\*[Gt] . 6323955d011SMarcel Moolenaar.It Va .ARCHIVE 6333955d011SMarcel MoolenaarThe name of the archive file. 6343955d011SMarcel Moolenaar.It Va .IMPSRC 6353955d011SMarcel MoolenaarIn suffix-transformation rules, the name/path of the source from which the 6363955d011SMarcel Moolenaartarget is to be transformed (the 6373955d011SMarcel Moolenaar.Dq implied 6383955d011SMarcel Moolenaarsource); also known as 6393955d011SMarcel Moolenaar.Ql Va \&\*[Lt] . 6403955d011SMarcel MoolenaarIt is not defined in explicit rules. 6413955d011SMarcel Moolenaar.It Va .MEMBER 6423955d011SMarcel MoolenaarThe name of the archive member. 6433955d011SMarcel Moolenaar.It Va .OODATE 6443955d011SMarcel MoolenaarThe list of sources for this target that were deemed out-of-date; also 6453955d011SMarcel Moolenaarknown as 6463955d011SMarcel Moolenaar.Ql Va \&? . 6473955d011SMarcel Moolenaar.It Va .PREFIX 6483955d011SMarcel MoolenaarThe file prefix of the target, containing only the file portion, no suffix 6493955d011SMarcel Moolenaaror preceding directory components; also known as 6503955d011SMarcel Moolenaar.Ql Va * . 6513955d011SMarcel Moolenaar.It Va .TARGET 6523955d011SMarcel MoolenaarThe name of the target; also known as 6533955d011SMarcel Moolenaar.Ql Va @ . 6543955d011SMarcel Moolenaar.El 6553955d011SMarcel Moolenaar.Pp 6563955d011SMarcel MoolenaarThe shorter forms 6573955d011SMarcel Moolenaar.Ql Va @ , 6583955d011SMarcel Moolenaar.Ql Va \&? , 6593955d011SMarcel Moolenaar.Ql Va \&\*[Lt] , 6603955d011SMarcel Moolenaar.Ql Va \&\*[Gt] , 6613955d011SMarcel Moolenaarand 6623955d011SMarcel Moolenaar.Ql Va * 6633955d011SMarcel Moolenaarare permitted for backward 6643955d011SMarcel Moolenaarcompatibility with historical makefiles and are not recommended. 6653955d011SMarcel MoolenaarThe six variables 6663955d011SMarcel Moolenaar.Ql Va "@F" , 6673955d011SMarcel Moolenaar.Ql Va "@D" , 6683955d011SMarcel Moolenaar.Ql Va "\*[Lt]F" , 6693955d011SMarcel Moolenaar.Ql Va "\*[Lt]D" , 6703955d011SMarcel Moolenaar.Ql Va "*F" , 6713955d011SMarcel Moolenaarand 6723955d011SMarcel Moolenaar.Ql Va "*D" 6733955d011SMarcel Moolenaarare permitted for compatibility with 6743955d011SMarcel Moolenaar.At V 6753955d011SMarcel Moolenaarmakefiles and are not recommended. 6763955d011SMarcel Moolenaar.Pp 6773955d011SMarcel MoolenaarFour of the local variables may be used in sources on dependency lines 6783955d011SMarcel Moolenaarbecause they expand to the proper value for each target on the line. 6793955d011SMarcel MoolenaarThese variables are 6803955d011SMarcel Moolenaar.Ql Va .TARGET , 6813955d011SMarcel Moolenaar.Ql Va .PREFIX , 6823955d011SMarcel Moolenaar.Ql Va .ARCHIVE , 6833955d011SMarcel Moolenaarand 6843955d011SMarcel Moolenaar.Ql Va .MEMBER . 6853955d011SMarcel Moolenaar.El 6863955d011SMarcel Moolenaar.Ss Additional built-in variables 6873955d011SMarcel MoolenaarIn addition, 6883955d011SMarcel Moolenaar.Nm 6893955d011SMarcel Moolenaarsets or knows about the following variables: 6903955d011SMarcel Moolenaar.Bl -tag -width .MAKEOVERRIDES 6913955d011SMarcel Moolenaar.It Va \&$ 6923955d011SMarcel MoolenaarA single dollar sign 6933955d011SMarcel Moolenaar.Ql \&$ , 6943955d011SMarcel Moolenaari.e. 6953955d011SMarcel Moolenaar.Ql \&$$ 6963955d011SMarcel Moolenaarexpands to a single dollar 6973955d011SMarcel Moolenaarsign. 6983955d011SMarcel Moolenaar.It Va .ALLTARGETS 6993955d011SMarcel MoolenaarThe list of all targets encountered in the Makefile. 7003955d011SMarcel MoolenaarIf evaluated during 7013955d011SMarcel MoolenaarMakefile parsing, lists only those targets encountered thus far. 7023955d011SMarcel Moolenaar.It Va .CURDIR 7033955d011SMarcel MoolenaarA path to the directory where 7043955d011SMarcel Moolenaar.Nm 7053955d011SMarcel Moolenaarwas executed. 7063955d011SMarcel MoolenaarRefer to the description of 7073955d011SMarcel Moolenaar.Ql Ev PWD 7083955d011SMarcel Moolenaarfor more details. 7093955d011SMarcel Moolenaar.It Ev MAKE 7103955d011SMarcel MoolenaarThe name that 7113955d011SMarcel Moolenaar.Nm 7123955d011SMarcel Moolenaarwas executed with 7133955d011SMarcel Moolenaar.Pq Va argv[0] . 7143955d011SMarcel MoolenaarFor compatibility 7153955d011SMarcel Moolenaar.Nm 7163955d011SMarcel Moolenaaralso sets 7173955d011SMarcel Moolenaar.Va .MAKE 7183955d011SMarcel Moolenaarwith the same value. 7193955d011SMarcel MoolenaarThe preferred variable to use is the environment variable 7203955d011SMarcel Moolenaar.Ev MAKE 7213955d011SMarcel Moolenaarbecause it is more compatible with other versions of 7223955d011SMarcel Moolenaar.Nm 7233955d011SMarcel Moolenaarand cannot be confused with the special target with the same name. 7249a4bc556SSimon J. Gerraty.It Va .MAKE.ALWAYS_PASS_JOB_QUEUE 7259a4bc556SSimon J. GerratyTells 7269a4bc556SSimon J. Gerraty.Nm 7279a4bc556SSimon J. Gerratywhether to pass the descriptors of the job token queue 7289a4bc556SSimon J. Gerratyeven if the target is not tagged with 7299a4bc556SSimon J. Gerraty.Ic .MAKE 7309a4bc556SSimon J. GerratyThe default is 7319a4bc556SSimon J. Gerraty.Ql Pa yes 7329a4bc556SSimon J. Gerratyfor backwards compatability with 733*a0774d09SSimon J. Gerraty.Fx 9.0 7349a4bc556SSimon J. Gerratyand earlier. 7353955d011SMarcel Moolenaar.It Va .MAKE.DEPENDFILE 7363955d011SMarcel MoolenaarNames the makefile (default 7373955d011SMarcel Moolenaar.Ql Pa .depend ) 7383955d011SMarcel Moolenaarfrom which generated dependencies are read. 7393955d011SMarcel Moolenaar.It Va .MAKE.EXPAND_VARIABLES 7403955d011SMarcel MoolenaarA boolean that controls the default behavior of the 7413955d011SMarcel Moolenaar.Fl V 7423955d011SMarcel Moolenaaroption. 7433955d011SMarcel Moolenaar.It Va .MAKE.EXPORTED 7443955d011SMarcel MoolenaarThe list of variables exported by 7453955d011SMarcel Moolenaar.Nm . 7463955d011SMarcel Moolenaar.It Va .MAKE.JOBS 7473955d011SMarcel MoolenaarThe argument to the 7483955d011SMarcel Moolenaar.Fl j 7493955d011SMarcel Moolenaaroption. 7503955d011SMarcel Moolenaar.It Va .MAKE.JOB.PREFIX 7513955d011SMarcel MoolenaarIf 7523955d011SMarcel Moolenaar.Nm 7533955d011SMarcel Moolenaaris run with 7543955d011SMarcel Moolenaar.Ar j 7553955d011SMarcel Moolenaarthen output for each target is prefixed with a token 7563955d011SMarcel Moolenaar.Ql --- target --- 7573955d011SMarcel Moolenaarthe first part of which can be controlled via 7583955d011SMarcel Moolenaar.Va .MAKE.JOB.PREFIX . 75951ee2c1cSSimon J. GerratyIf 76051ee2c1cSSimon J. Gerraty.Va .MAKE.JOB.PREFIX 76151ee2c1cSSimon J. Gerratyis empty, no token is printed. 7623955d011SMarcel Moolenaar.br 7633955d011SMarcel MoolenaarFor example: 7643955d011SMarcel Moolenaar.Li .MAKE.JOB.PREFIX=${.newline}---${.MAKE:T}[${.MAKE.PID}] 7653955d011SMarcel Moolenaarwould produce tokens like 7663955d011SMarcel Moolenaar.Ql ---make[1234] target --- 7673955d011SMarcel Moolenaarmaking it easier to track the degree of parallelism being achieved. 7683955d011SMarcel Moolenaar.It Ev MAKEFLAGS 7693955d011SMarcel MoolenaarThe environment variable 7703955d011SMarcel Moolenaar.Ql Ev MAKEFLAGS 7713955d011SMarcel Moolenaarmay contain anything that 7723955d011SMarcel Moolenaarmay be specified on 7733955d011SMarcel Moolenaar.Nm Ns 's 7743955d011SMarcel Moolenaarcommand line. 7753955d011SMarcel MoolenaarAnything specified on 7763955d011SMarcel Moolenaar.Nm Ns 's 7773955d011SMarcel Moolenaarcommand line is appended to the 7783955d011SMarcel Moolenaar.Ql Ev MAKEFLAGS 7793955d011SMarcel Moolenaarvariable which is then 7803955d011SMarcel Moolenaarentered into the environment for all programs which 7813955d011SMarcel Moolenaar.Nm 7823955d011SMarcel Moolenaarexecutes. 7833955d011SMarcel Moolenaar.It Va .MAKE.LEVEL 7843955d011SMarcel MoolenaarThe recursion depth of 7853955d011SMarcel Moolenaar.Nm . 7863955d011SMarcel MoolenaarThe initial instance of 7873955d011SMarcel Moolenaar.Nm 7883955d011SMarcel Moolenaarwill be 0, and an incremented value is put into the environment 7893955d011SMarcel Moolenaarto be seen by the next generation. 7903955d011SMarcel MoolenaarThis allows tests like: 7913955d011SMarcel Moolenaar.Li .if ${.MAKE.LEVEL} == 0 7923955d011SMarcel Moolenaarto protect things which should only be evaluated in the initial instance of 7933955d011SMarcel Moolenaar.Nm . 7943955d011SMarcel Moolenaar.It Va .MAKE.MAKEFILE_PREFERENCE 7953955d011SMarcel MoolenaarThe ordered list of makefile names 7963955d011SMarcel Moolenaar(default 7973955d011SMarcel Moolenaar.Ql Pa makefile , 7983955d011SMarcel Moolenaar.Ql Pa Makefile ) 7993955d011SMarcel Moolenaarthat 8003955d011SMarcel Moolenaar.Nm 8013955d011SMarcel Moolenaarwill look for. 8023955d011SMarcel Moolenaar.It Va .MAKE.MAKEFILES 8033955d011SMarcel MoolenaarThe list of makefiles read by 8043955d011SMarcel Moolenaar.Nm , 8053955d011SMarcel Moolenaarwhich is useful for tracking dependencies. 8063955d011SMarcel MoolenaarEach makefile is recorded only once, regardless of the number of times read. 8073955d011SMarcel Moolenaar.It Va .MAKE.MODE 8083955d011SMarcel MoolenaarProcessed after reading all makefiles. 8093955d011SMarcel MoolenaarCan affect the mode that 8103955d011SMarcel Moolenaar.Nm 8113955d011SMarcel Moolenaarruns in. 8123955d011SMarcel MoolenaarIt can contain a number of keywords: 8133955d011SMarcel Moolenaar.Bl -hang -width ignore-cmd 8143955d011SMarcel Moolenaar.It Pa compat 8153955d011SMarcel MoolenaarLike 8163955d011SMarcel Moolenaar.Fl B , 8173955d011SMarcel Moolenaarputs 8183955d011SMarcel Moolenaar.Nm 8193955d011SMarcel Moolenaarinto "compat" mode. 8203955d011SMarcel Moolenaar.It Pa meta 8213955d011SMarcel MoolenaarPuts 8223955d011SMarcel Moolenaar.Nm 8233955d011SMarcel Moolenaarinto "meta" mode, where meta files are created for each target 8243955d011SMarcel Moolenaarto capture the command run, the output generated and if 8253955d011SMarcel Moolenaar.Xr filemon 4 8263955d011SMarcel Moolenaaris available, the system calls which are of interest to 8273955d011SMarcel Moolenaar.Nm . 8283955d011SMarcel MoolenaarThe captured output can be very useful when diagnosing errors. 8293955d011SMarcel Moolenaar.It Pa curdirOk= Ar bf 8303955d011SMarcel MoolenaarNormally 8313955d011SMarcel Moolenaar.Nm 8323955d011SMarcel Moolenaarwill not create .meta files in 8333955d011SMarcel Moolenaar.Ql Va .CURDIR . 8343955d011SMarcel MoolenaarThis can be overridden by setting 8353955d011SMarcel Moolenaar.Va bf 8363955d011SMarcel Moolenaarto a value which represents True. 8373955d011SMarcel Moolenaar.It Pa env 8383955d011SMarcel MoolenaarFor debugging, it can be useful to inlcude the environment 8393955d011SMarcel Moolenaarin the .meta file. 8403955d011SMarcel Moolenaar.It Pa verbose 8413955d011SMarcel MoolenaarIf in "meta" mode, print a clue about the target being built. 8423955d011SMarcel MoolenaarThis is useful if the build is otherwise running silently. 8433955d011SMarcel MoolenaarThe message printed the value of: 8443955d011SMarcel Moolenaar.Va .MAKE.META.PREFIX . 8453955d011SMarcel Moolenaar.It Pa ignore-cmd 8463955d011SMarcel MoolenaarSome makefiles have commands which are simply not stable. 8473955d011SMarcel MoolenaarThis keyword causes them to be ignored for 8483955d011SMarcel Moolenaardetermining whether a target is out of date in "meta" mode. 8493955d011SMarcel MoolenaarSee also 8503955d011SMarcel Moolenaar.Ic .NOMETA_CMP . 8513955d011SMarcel Moolenaar.It Pa silent= Ar bf 8523955d011SMarcel MoolenaarIf 8533955d011SMarcel Moolenaar.Va bf 8543955d011SMarcel Moolenaaris True, when a .meta file is created, mark the target 8553955d011SMarcel Moolenaar.Ic .SILENT . 8563955d011SMarcel Moolenaar.El 8573955d011SMarcel Moolenaar.It Va .MAKE.META.BAILIWICK 8583955d011SMarcel MoolenaarIn "meta" mode, provides a list of prefixes which 8593955d011SMarcel Moolenaarmatch the directories controlled by 8603955d011SMarcel Moolenaar.Nm . 8613955d011SMarcel MoolenaarIf a file that was generated outside of 8623955d011SMarcel Moolenaar.Va .OBJDIR 8633955d011SMarcel Moolenaarbut within said bailiwick is missing, 8643955d011SMarcel Moolenaarthe current target is considered out-of-date. 8653955d011SMarcel Moolenaar.It Va .MAKE.META.CREATED 8663955d011SMarcel MoolenaarIn "meta" mode, this variable contains a list of all the meta files 8673955d011SMarcel Moolenaarupdated. 8683955d011SMarcel MoolenaarIf not empty, it can be used to trigger processing of 8693955d011SMarcel Moolenaar.Va .MAKE.META.FILES . 8703955d011SMarcel Moolenaar.It Va .MAKE.META.FILES 8713955d011SMarcel MoolenaarIn "meta" mode, this variable contains a list of all the meta files 8723955d011SMarcel Moolenaarused (updated or not). 8733955d011SMarcel MoolenaarThis list can be used to process the meta files to extract dependency 8743955d011SMarcel Moolenaarinformation. 87551ee2c1cSSimon J. Gerraty.It Va .MAKE.META.IGNORE_PATHS 87651ee2c1cSSimon J. GerratyProvides a list of path prefixes that should be ignored; 87751ee2c1cSSimon J. Gerratybecause the contents are expected to change over time. 87851ee2c1cSSimon J. GerratyThe default list includes: 87951ee2c1cSSimon J. Gerraty.Ql Pa /dev /etc /proc /tmp /var/run /var/tmp 8803955d011SMarcel Moolenaar.It Va .MAKE.META.PREFIX 8813955d011SMarcel MoolenaarDefines the message printed for each meta file updated in "meta verbose" mode. 8823955d011SMarcel MoolenaarThe default value is: 8833955d011SMarcel Moolenaar.Dl Building ${.TARGET:H:tA}/${.TARGET:T} 8843955d011SMarcel Moolenaar.It Va .MAKEOVERRIDES 8853955d011SMarcel MoolenaarThis variable is used to record the names of variables assigned to 8863955d011SMarcel Moolenaaron the command line, so that they may be exported as part of 8873955d011SMarcel Moolenaar.Ql Ev MAKEFLAGS . 8883955d011SMarcel MoolenaarThis behaviour can be disabled by assigning an empty value to 8893955d011SMarcel Moolenaar.Ql Va .MAKEOVERRIDES 8903955d011SMarcel Moolenaarwithin a makefile. 8913955d011SMarcel MoolenaarExtra variables can be exported from a makefile 8923955d011SMarcel Moolenaarby appending their names to 8933955d011SMarcel Moolenaar.Ql Va .MAKEOVERRIDES . 8943955d011SMarcel Moolenaar.Ql Ev MAKEFLAGS 8953955d011SMarcel Moolenaaris re-exported whenever 8963955d011SMarcel Moolenaar.Ql Va .MAKEOVERRIDES 8973955d011SMarcel Moolenaaris modified. 8981748de26SSimon J. Gerraty.It Va .MAKE.PATH_FILEMON 8991748de26SSimon J. GerratyIf 9001748de26SSimon J. Gerraty.Nm 9011748de26SSimon J. Gerratywas built with 9021748de26SSimon J. Gerraty.Xr filemon 4 9031748de26SSimon J. Gerratysupport, this is set to the path of the device node. 9041748de26SSimon J. GerratyThis allows makefiles to test for this support. 9053955d011SMarcel Moolenaar.It Va .MAKE.PID 9063955d011SMarcel MoolenaarThe process-id of 9073955d011SMarcel Moolenaar.Nm . 9083955d011SMarcel Moolenaar.It Va .MAKE.PPID 9093955d011SMarcel MoolenaarThe parent process-id of 9103955d011SMarcel Moolenaar.Nm . 9113955d011SMarcel Moolenaar.It Va MAKE_PRINT_VAR_ON_ERROR 9123955d011SMarcel MoolenaarWhen 9133955d011SMarcel Moolenaar.Nm 9143955d011SMarcel Moolenaarstops due to an error, it prints its name and the value of 9153955d011SMarcel Moolenaar.Ql Va .CURDIR 9163955d011SMarcel Moolenaaras well as the value of any variables named in 9173955d011SMarcel Moolenaar.Ql Va MAKE_PRINT_VAR_ON_ERROR . 9183955d011SMarcel Moolenaar.It Va .newline 9193955d011SMarcel MoolenaarThis variable is simply assigned a newline character as its value. 9203955d011SMarcel MoolenaarThis allows expansions using the 9213955d011SMarcel Moolenaar.Cm \&:@ 9223955d011SMarcel Moolenaarmodifier to put a newline between 9233955d011SMarcel Moolenaariterations of the loop rather than a space. 9243955d011SMarcel MoolenaarFor example, the printing of 9253955d011SMarcel Moolenaar.Ql Va MAKE_PRINT_VAR_ON_ERROR 9263955d011SMarcel Moolenaarcould be done as ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@}. 9273955d011SMarcel Moolenaar.It Va .OBJDIR 9283955d011SMarcel MoolenaarA path to the directory where the targets are built. 9293955d011SMarcel MoolenaarIts value is determined by trying to 9303955d011SMarcel Moolenaar.Xr chdir 2 9313955d011SMarcel Moolenaarto the following directories in order and using the first match: 9323955d011SMarcel Moolenaar.Bl -enum 9333955d011SMarcel Moolenaar.It 9343955d011SMarcel Moolenaar.Ev ${MAKEOBJDIRPREFIX}${.CURDIR} 9353955d011SMarcel Moolenaar.Pp 9363955d011SMarcel Moolenaar(Only if 9373955d011SMarcel Moolenaar.Ql Ev MAKEOBJDIRPREFIX 9383955d011SMarcel Moolenaaris set in the environment or on the command line.) 9393955d011SMarcel Moolenaar.It 9403955d011SMarcel Moolenaar.Ev ${MAKEOBJDIR} 9413955d011SMarcel Moolenaar.Pp 9423955d011SMarcel Moolenaar(Only if 9433955d011SMarcel Moolenaar.Ql Ev MAKEOBJDIR 9443955d011SMarcel Moolenaaris set in the environment or on the command line.) 9453955d011SMarcel Moolenaar.It 9463955d011SMarcel Moolenaar.Ev ${.CURDIR} Ns Pa /obj. Ns Ev ${MACHINE} 9473955d011SMarcel Moolenaar.It 9483955d011SMarcel Moolenaar.Ev ${.CURDIR} Ns Pa /obj 9493955d011SMarcel Moolenaar.It 9503955d011SMarcel Moolenaar.Pa /usr/obj/ Ns Ev ${.CURDIR} 9513955d011SMarcel Moolenaar.It 9523955d011SMarcel Moolenaar.Ev ${.CURDIR} 9533955d011SMarcel Moolenaar.El 9543955d011SMarcel Moolenaar.Pp 9553955d011SMarcel MoolenaarVariable expansion is performed on the value before it's used, 9563955d011SMarcel Moolenaarso expressions such as 9573955d011SMarcel Moolenaar.Dl ${.CURDIR:S,^/usr/src,/var/obj,} 9583955d011SMarcel Moolenaarmay be used. 9593955d011SMarcel MoolenaarThis is especially useful with 9603955d011SMarcel Moolenaar.Ql Ev MAKEOBJDIR . 9613955d011SMarcel Moolenaar.Pp 9623955d011SMarcel Moolenaar.Ql Va .OBJDIR 9633955d011SMarcel Moolenaarmay be modified in the makefile as a global variable. 9643955d011SMarcel MoolenaarIn all cases, 9653955d011SMarcel Moolenaar.Nm 9663955d011SMarcel Moolenaarwill 9673955d011SMarcel Moolenaar.Xr chdir 2 9683955d011SMarcel Moolenaarto 9693955d011SMarcel Moolenaar.Ql Va .OBJDIR 9703955d011SMarcel Moolenaarand set 9713955d011SMarcel Moolenaar.Ql Ev PWD 9723955d011SMarcel Moolenaarto that directory before executing any targets. 9733955d011SMarcel Moolenaar. 9743955d011SMarcel Moolenaar.It Va .PARSEDIR 9753955d011SMarcel MoolenaarA path to the directory of the current 9763955d011SMarcel Moolenaar.Ql Pa Makefile 9773955d011SMarcel Moolenaarbeing parsed. 9783955d011SMarcel Moolenaar.It Va .PARSEFILE 9793955d011SMarcel MoolenaarThe basename of the current 9803955d011SMarcel Moolenaar.Ql Pa Makefile 9813955d011SMarcel Moolenaarbeing parsed. 9823955d011SMarcel MoolenaarThis variable and 9833955d011SMarcel Moolenaar.Ql Va .PARSEDIR 9843955d011SMarcel Moolenaarare both set only while the 9853955d011SMarcel Moolenaar.Ql Pa Makefiles 9863955d011SMarcel Moolenaarare being parsed. 9873955d011SMarcel MoolenaarIf you want to retain their current values, assign them to a variable 9883955d011SMarcel Moolenaarusing assignment with expansion: 9893955d011SMarcel Moolenaar.Pq Ql Cm \&:= . 9903955d011SMarcel Moolenaar.It Va .PATH 9913955d011SMarcel MoolenaarA variable that represents the list of directories that 9923955d011SMarcel Moolenaar.Nm 9933955d011SMarcel Moolenaarwill search for files. 9943955d011SMarcel MoolenaarThe search list should be updated using the target 9953955d011SMarcel Moolenaar.Ql Va .PATH 9963955d011SMarcel Moolenaarrather than the variable. 9973955d011SMarcel Moolenaar.It Ev PWD 9983955d011SMarcel MoolenaarAlternate path to the current directory. 9993955d011SMarcel Moolenaar.Nm 10003955d011SMarcel Moolenaarnormally sets 10013955d011SMarcel Moolenaar.Ql Va .CURDIR 10023955d011SMarcel Moolenaarto the canonical path given by 10033955d011SMarcel Moolenaar.Xr getcwd 3 . 10043955d011SMarcel MoolenaarHowever, if the environment variable 10053955d011SMarcel Moolenaar.Ql Ev PWD 10063955d011SMarcel Moolenaaris set and gives a path to the current directory, then 10073955d011SMarcel Moolenaar.Nm 10083955d011SMarcel Moolenaarsets 10093955d011SMarcel Moolenaar.Ql Va .CURDIR 10103955d011SMarcel Moolenaarto the value of 10113955d011SMarcel Moolenaar.Ql Ev PWD 10123955d011SMarcel Moolenaarinstead. 10133955d011SMarcel MoolenaarThis behaviour is disabled if 10143955d011SMarcel Moolenaar.Ql Ev MAKEOBJDIRPREFIX 10153955d011SMarcel Moolenaaris set or 10163955d011SMarcel Moolenaar.Ql Ev MAKEOBJDIR 10173955d011SMarcel Moolenaarcontains a variable transform. 10183955d011SMarcel Moolenaar.Ql Ev PWD 10193955d011SMarcel Moolenaaris set to the value of 10203955d011SMarcel Moolenaar.Ql Va .OBJDIR 10213955d011SMarcel Moolenaarfor all programs which 10223955d011SMarcel Moolenaar.Nm 10233955d011SMarcel Moolenaarexecutes. 10243955d011SMarcel Moolenaar.It Ev .TARGETS 10253955d011SMarcel MoolenaarThe list of targets explicitly specified on the command line, if any. 10263955d011SMarcel Moolenaar.It Ev VPATH 10273955d011SMarcel MoolenaarColon-separated 10283955d011SMarcel Moolenaar.Pq Dq \&: 10293955d011SMarcel Moolenaarlists of directories that 10303955d011SMarcel Moolenaar.Nm 10313955d011SMarcel Moolenaarwill search for files. 10323955d011SMarcel MoolenaarThe variable is supported for compatibility with old make programs only, 10333955d011SMarcel Moolenaaruse 10343955d011SMarcel Moolenaar.Ql Va .PATH 10353955d011SMarcel Moolenaarinstead. 10363955d011SMarcel Moolenaar.El 10373955d011SMarcel Moolenaar.Ss Variable modifiers 10383955d011SMarcel MoolenaarVariable expansion may be modified to select or modify each word of the 10393955d011SMarcel Moolenaarvariable (where a 10403955d011SMarcel Moolenaar.Dq word 10413955d011SMarcel Moolenaaris white-space delimited sequence of characters). 10423955d011SMarcel MoolenaarThe general format of a variable expansion is as follows: 10433955d011SMarcel Moolenaar.Pp 10443955d011SMarcel Moolenaar.Dl ${variable[:modifier[:...]]} 10453955d011SMarcel Moolenaar.Pp 10463955d011SMarcel MoolenaarEach modifier begins with a colon, 10473955d011SMarcel Moolenaarwhich may be escaped with a backslash 10483955d011SMarcel Moolenaar.Pq Ql \e . 10493955d011SMarcel Moolenaar.Pp 10503955d011SMarcel MoolenaarA set of modifiers can be specified via a variable, as follows: 10513955d011SMarcel Moolenaar.Pp 10523955d011SMarcel Moolenaar.Dl modifier_variable=modifier[:...] 10533955d011SMarcel Moolenaar.Dl ${variable:${modifier_variable}[:...]} 10543955d011SMarcel Moolenaar.Pp 10553955d011SMarcel MoolenaarIn this case the first modifier in the modifier_variable does not 10563955d011SMarcel Moolenaarstart with a colon, since that must appear in the referencing 10573955d011SMarcel Moolenaarvariable. 10583955d011SMarcel MoolenaarIf any of the modifiers in the modifier_variable contain a dollar sign 10593955d011SMarcel Moolenaar.Pq Ql $ , 10603955d011SMarcel Moolenaarthese must be doubled to avoid early expansion. 10613955d011SMarcel Moolenaar.Pp 10623955d011SMarcel MoolenaarThe supported modifiers are: 10633955d011SMarcel Moolenaar.Bl -tag -width EEE 10643955d011SMarcel Moolenaar.It Cm \&:E 10653955d011SMarcel MoolenaarReplaces each word in the variable with its suffix. 10663955d011SMarcel Moolenaar.It Cm \&:H 10673955d011SMarcel MoolenaarReplaces each word in the variable with everything but the last component. 10683955d011SMarcel Moolenaar.It Cm \&:M Ns Ar pattern 10693955d011SMarcel MoolenaarSelect only those words that match 10703955d011SMarcel Moolenaar.Ar pattern . 10713955d011SMarcel MoolenaarThe standard shell wildcard characters 10723955d011SMarcel Moolenaar.Pf ( Ql * , 10733955d011SMarcel Moolenaar.Ql \&? , 10743955d011SMarcel Moolenaarand 10753955d011SMarcel Moolenaar.Ql Oo Oc ) 10763955d011SMarcel Moolenaarmay 10773955d011SMarcel Moolenaarbe used. 10783955d011SMarcel MoolenaarThe wildcard characters may be escaped with a backslash 10793955d011SMarcel Moolenaar.Pq Ql \e . 10803955d011SMarcel Moolenaar.It Cm \&:N Ns Ar pattern 10813955d011SMarcel MoolenaarThis is identical to 10823955d011SMarcel Moolenaar.Ql Cm \&:M , 10833955d011SMarcel Moolenaarbut selects all words which do not match 10843955d011SMarcel Moolenaar.Ar pattern . 10853955d011SMarcel Moolenaar.It Cm \&:O 10863955d011SMarcel MoolenaarOrder every word in variable alphabetically. 10873955d011SMarcel MoolenaarTo sort words in 10883955d011SMarcel Moolenaarreverse order use the 10893955d011SMarcel Moolenaar.Ql Cm \&:O:[-1..1] 10903955d011SMarcel Moolenaarcombination of modifiers. 10913955d011SMarcel Moolenaar.It Cm \&:Ox 10923955d011SMarcel MoolenaarRandomize words in variable. 10933955d011SMarcel MoolenaarThe results will be different each time you are referring to the 10943955d011SMarcel Moolenaarmodified variable; use the assignment with expansion 10953955d011SMarcel Moolenaar.Pq Ql Cm \&:= 10963955d011SMarcel Moolenaarto prevent such behaviour. 10973955d011SMarcel MoolenaarFor example, 10983955d011SMarcel Moolenaar.Bd -literal -offset indent 10993955d011SMarcel MoolenaarLIST= uno due tre quattro 11003955d011SMarcel MoolenaarRANDOM_LIST= ${LIST:Ox} 11013955d011SMarcel MoolenaarSTATIC_RANDOM_LIST:= ${LIST:Ox} 11023955d011SMarcel Moolenaar 11033955d011SMarcel Moolenaarall: 11043955d011SMarcel Moolenaar @echo "${RANDOM_LIST}" 11053955d011SMarcel Moolenaar @echo "${RANDOM_LIST}" 11063955d011SMarcel Moolenaar @echo "${STATIC_RANDOM_LIST}" 11073955d011SMarcel Moolenaar @echo "${STATIC_RANDOM_LIST}" 11083955d011SMarcel Moolenaar.Ed 11093955d011SMarcel Moolenaarmay produce output similar to: 11103955d011SMarcel Moolenaar.Bd -literal -offset indent 11113955d011SMarcel Moolenaarquattro due tre uno 11123955d011SMarcel Moolenaartre due quattro uno 11133955d011SMarcel Moolenaardue uno quattro tre 11143955d011SMarcel Moolenaardue uno quattro tre 11153955d011SMarcel Moolenaar.Ed 11163955d011SMarcel Moolenaar.It Cm \&:Q 11173955d011SMarcel MoolenaarQuotes every shell meta-character in the variable, so that it can be passed 11183955d011SMarcel Moolenaarsafely through recursive invocations of 11193955d011SMarcel Moolenaar.Nm . 11203955d011SMarcel Moolenaar.It Cm \&:R 11213955d011SMarcel MoolenaarReplaces each word in the variable with everything but its suffix. 11223955d011SMarcel Moolenaar.It Cm \&:gmtime 11233955d011SMarcel MoolenaarThe value is a format string for 11243955d011SMarcel Moolenaar.Xr strftime 3 , 11253955d011SMarcel Moolenaarusing the current 11263955d011SMarcel Moolenaar.Xr gmtime 3 . 11273955d011SMarcel Moolenaar.It Cm \&:hash 11283955d011SMarcel MoolenaarCompute a 32bit hash of the value and encode it as hex digits. 11293955d011SMarcel Moolenaar.It Cm \&:localtime 11303955d011SMarcel MoolenaarThe value is a format string for 11313955d011SMarcel Moolenaar.Xr strftime 3 , 11323955d011SMarcel Moolenaarusing the current 11333955d011SMarcel Moolenaar.Xr localtime 3 . 11343955d011SMarcel Moolenaar.It Cm \&:tA 11353955d011SMarcel MoolenaarAttempt to convert variable to an absolute path using 11363955d011SMarcel Moolenaar.Xr realpath 3 , 11373955d011SMarcel Moolenaarif that fails, the value is unchanged. 11383955d011SMarcel Moolenaar.It Cm \&:tl 11393955d011SMarcel MoolenaarConverts variable to lower-case letters. 11403955d011SMarcel Moolenaar.It Cm \&:ts Ns Ar c 11413955d011SMarcel MoolenaarWords in the variable are normally separated by a space on expansion. 11423955d011SMarcel MoolenaarThis modifier sets the separator to the character 11433955d011SMarcel Moolenaar.Ar c . 11443955d011SMarcel MoolenaarIf 11453955d011SMarcel Moolenaar.Ar c 11463955d011SMarcel Moolenaaris omitted, then no separator is used. 11473955d011SMarcel MoolenaarThe common escapes (including octal numeric codes), work as expected. 11483955d011SMarcel Moolenaar.It Cm \&:tu 11493955d011SMarcel MoolenaarConverts variable to upper-case letters. 11503955d011SMarcel Moolenaar.It Cm \&:tW 11513955d011SMarcel MoolenaarCauses the value to be treated as a single word 11523955d011SMarcel Moolenaar(possibly containing embedded white space). 11533955d011SMarcel MoolenaarSee also 11543955d011SMarcel Moolenaar.Ql Cm \&:[*] . 11553955d011SMarcel Moolenaar.It Cm \&:tw 11563955d011SMarcel MoolenaarCauses the value to be treated as a sequence of 11573955d011SMarcel Moolenaarwords delimited by white space. 11583955d011SMarcel MoolenaarSee also 11593955d011SMarcel Moolenaar.Ql Cm \&:[@] . 11603955d011SMarcel Moolenaar.Sm off 11613955d011SMarcel Moolenaar.It Cm \&:S No \&/ Ar old_string No \&/ Ar new_string No \&/ Op Cm 1gW 11623955d011SMarcel Moolenaar.Sm on 11633955d011SMarcel MoolenaarModify the first occurrence of 11643955d011SMarcel Moolenaar.Ar old_string 11653955d011SMarcel Moolenaarin the variable's value, replacing it with 11663955d011SMarcel Moolenaar.Ar new_string . 11673955d011SMarcel MoolenaarIf a 11683955d011SMarcel Moolenaar.Ql g 11693955d011SMarcel Moolenaaris appended to the last slash of the pattern, all occurrences 11703955d011SMarcel Moolenaarin each word are replaced. 11713955d011SMarcel MoolenaarIf a 11723955d011SMarcel Moolenaar.Ql 1 11733955d011SMarcel Moolenaaris appended to the last slash of the pattern, only the first word 11743955d011SMarcel Moolenaaris affected. 11753955d011SMarcel MoolenaarIf a 11763955d011SMarcel Moolenaar.Ql W 11773955d011SMarcel Moolenaaris appended to the last slash of the pattern, 11783955d011SMarcel Moolenaarthen the value is treated as a single word 11793955d011SMarcel Moolenaar(possibly containing embedded white space). 11803955d011SMarcel MoolenaarIf 11813955d011SMarcel Moolenaar.Ar old_string 11823955d011SMarcel Moolenaarbegins with a caret 11833955d011SMarcel Moolenaar.Pq Ql ^ , 11843955d011SMarcel Moolenaar.Ar old_string 11853955d011SMarcel Moolenaaris anchored at the beginning of each word. 11863955d011SMarcel MoolenaarIf 11873955d011SMarcel Moolenaar.Ar old_string 11883955d011SMarcel Moolenaarends with a dollar sign 11893955d011SMarcel Moolenaar.Pq Ql \&$ , 11903955d011SMarcel Moolenaarit is anchored at the end of each word. 11913955d011SMarcel MoolenaarInside 11923955d011SMarcel Moolenaar.Ar new_string , 11933955d011SMarcel Moolenaaran ampersand 11943955d011SMarcel Moolenaar.Pq Ql \*[Am] 11953955d011SMarcel Moolenaaris replaced by 11963955d011SMarcel Moolenaar.Ar old_string 11973955d011SMarcel Moolenaar(without any 11983955d011SMarcel Moolenaar.Ql ^ 11993955d011SMarcel Moolenaaror 12003955d011SMarcel Moolenaar.Ql \&$ ) . 12013955d011SMarcel MoolenaarAny character may be used as a delimiter for the parts of the modifier 12023955d011SMarcel Moolenaarstring. 12033955d011SMarcel MoolenaarThe anchoring, ampersand and delimiter characters may be escaped with a 12043955d011SMarcel Moolenaarbackslash 12053955d011SMarcel Moolenaar.Pq Ql \e . 12063955d011SMarcel Moolenaar.Pp 12073955d011SMarcel MoolenaarVariable expansion occurs in the normal fashion inside both 12083955d011SMarcel Moolenaar.Ar old_string 12093955d011SMarcel Moolenaarand 12103955d011SMarcel Moolenaar.Ar new_string 12113955d011SMarcel Moolenaarwith the single exception that a backslash is used to prevent the expansion 12123955d011SMarcel Moolenaarof a dollar sign 12133955d011SMarcel Moolenaar.Pq Ql \&$ , 12143955d011SMarcel Moolenaarnot a preceding dollar sign as is usual. 12153955d011SMarcel Moolenaar.Sm off 12163955d011SMarcel Moolenaar.It Cm \&:C No \&/ Ar pattern No \&/ Ar replacement No \&/ Op Cm 1gW 12173955d011SMarcel Moolenaar.Sm on 12183955d011SMarcel MoolenaarThe 12193955d011SMarcel Moolenaar.Cm \&:C 12203955d011SMarcel Moolenaarmodifier is just like the 12213955d011SMarcel Moolenaar.Cm \&:S 12223955d011SMarcel Moolenaarmodifier except that the old and new strings, instead of being 12233955d011SMarcel Moolenaarsimple strings, are a regular expression (see 12243955d011SMarcel Moolenaar.Xr regex 3 ) 12253955d011SMarcel Moolenaarstring 12263955d011SMarcel Moolenaar.Ar pattern 12273955d011SMarcel Moolenaarand an 12283955d011SMarcel Moolenaar.Xr ed 1 Ns \-style 12293955d011SMarcel Moolenaarstring 12303955d011SMarcel Moolenaar.Ar replacement . 12313955d011SMarcel MoolenaarNormally, the first occurrence of the pattern 12323955d011SMarcel Moolenaar.Ar pattern 12333955d011SMarcel Moolenaarin each word of the value is substituted with 12343955d011SMarcel Moolenaar.Ar replacement . 12353955d011SMarcel MoolenaarThe 12363955d011SMarcel Moolenaar.Ql 1 12373955d011SMarcel Moolenaarmodifier causes the substitution to apply to at most one word; the 12383955d011SMarcel Moolenaar.Ql g 12393955d011SMarcel Moolenaarmodifier causes the substitution to apply to as many instances of the 12403955d011SMarcel Moolenaarsearch pattern 12413955d011SMarcel Moolenaar.Ar pattern 12423955d011SMarcel Moolenaaras occur in the word or words it is found in; the 12433955d011SMarcel Moolenaar.Ql W 12443955d011SMarcel Moolenaarmodifier causes the value to be treated as a single word 12453955d011SMarcel Moolenaar(possibly containing embedded white space). 12463955d011SMarcel MoolenaarNote that 12473955d011SMarcel Moolenaar.Ql 1 12483955d011SMarcel Moolenaarand 12493955d011SMarcel Moolenaar.Ql g 12503955d011SMarcel Moolenaarare orthogonal; the former specifies whether multiple words are 12513955d011SMarcel Moolenaarpotentially affected, the latter whether multiple substitutions can 12523955d011SMarcel Moolenaarpotentially occur within each affected word. 12533955d011SMarcel Moolenaar.It Cm \&:T 12543955d011SMarcel MoolenaarReplaces each word in the variable with its last component. 12553955d011SMarcel Moolenaar.It Cm \&:u 12563955d011SMarcel MoolenaarRemove adjacent duplicate words (like 12573955d011SMarcel Moolenaar.Xr uniq 1 ) . 12583955d011SMarcel Moolenaar.Sm off 12593955d011SMarcel Moolenaar.It Cm \&:\&? Ar true_string Cm \&: Ar false_string 12603955d011SMarcel Moolenaar.Sm on 12613955d011SMarcel MoolenaarIf the variable name (not its value), when parsed as a .if conditional 12623955d011SMarcel Moolenaarexpression, evaluates to true, return as its value the 12633955d011SMarcel Moolenaar.Ar true_string , 12643955d011SMarcel Moolenaarotherwise return the 12653955d011SMarcel Moolenaar.Ar false_string . 12663955d011SMarcel MoolenaarSince the variable name is used as the expression, \&:\&? must be the 12673955d011SMarcel Moolenaarfirst modifier after the variable name itself - which will, of course, 12683955d011SMarcel Moolenaarusually contain variable expansions. 12693955d011SMarcel MoolenaarA common error is trying to use expressions like 12703955d011SMarcel Moolenaar.Dl ${NUMBERS:M42:?match:no} 12713955d011SMarcel Moolenaarwhich actually tests defined(NUMBERS), 12723955d011SMarcel Moolenaarto determine is any words match "42" you need to use something like: 12733955d011SMarcel Moolenaar.Dl ${"${NUMBERS:M42}" != \&"\&":?match:no} . 12743955d011SMarcel Moolenaar.It Ar :old_string=new_string 12753955d011SMarcel MoolenaarThis is the 12763955d011SMarcel Moolenaar.At V 12773955d011SMarcel Moolenaarstyle variable substitution. 12783955d011SMarcel MoolenaarIt must be the last modifier specified. 12793955d011SMarcel MoolenaarIf 12803955d011SMarcel Moolenaar.Ar old_string 12813955d011SMarcel Moolenaaror 12823955d011SMarcel Moolenaar.Ar new_string 12833955d011SMarcel Moolenaardo not contain the pattern matching character 12843955d011SMarcel Moolenaar.Ar % 12853955d011SMarcel Moolenaarthen it is assumed that they are 12863955d011SMarcel Moolenaaranchored at the end of each word, so only suffixes or entire 12873955d011SMarcel Moolenaarwords may be replaced. 12883955d011SMarcel MoolenaarOtherwise 12893955d011SMarcel Moolenaar.Ar % 12903955d011SMarcel Moolenaaris the substring of 12913955d011SMarcel Moolenaar.Ar old_string 12923955d011SMarcel Moolenaarto be replaced in 12933955d011SMarcel Moolenaar.Ar new_string . 12943955d011SMarcel Moolenaar.Pp 12953955d011SMarcel MoolenaarVariable expansion occurs in the normal fashion inside both 12963955d011SMarcel Moolenaar.Ar old_string 12973955d011SMarcel Moolenaarand 12983955d011SMarcel Moolenaar.Ar new_string 12993955d011SMarcel Moolenaarwith the single exception that a backslash is used to prevent the 13003955d011SMarcel Moolenaarexpansion of a dollar sign 13013955d011SMarcel Moolenaar.Pq Ql \&$ , 13023955d011SMarcel Moolenaarnot a preceding dollar sign as is usual. 13033955d011SMarcel Moolenaar.Sm off 13043955d011SMarcel Moolenaar.It Cm \&:@ Ar temp Cm @ Ar string Cm @ 13053955d011SMarcel Moolenaar.Sm on 13063955d011SMarcel MoolenaarThis is the loop expansion mechanism from the OSF Development 13073955d011SMarcel MoolenaarEnvironment (ODE) make. 13083955d011SMarcel MoolenaarUnlike 13093955d011SMarcel Moolenaar.Cm \&.for 13103955d011SMarcel Moolenaarloops expansion occurs at the time of 13113955d011SMarcel Moolenaarreference. 13123955d011SMarcel MoolenaarAssign 13133955d011SMarcel Moolenaar.Ar temp 13143955d011SMarcel Moolenaarto each word in the variable and evaluate 13153955d011SMarcel Moolenaar.Ar string . 13163955d011SMarcel MoolenaarThe ODE convention is that 13173955d011SMarcel Moolenaar.Ar temp 13183955d011SMarcel Moolenaarshould start and end with a period. 13193955d011SMarcel MoolenaarFor example. 13203955d011SMarcel Moolenaar.Dl ${LINKS:@.LINK.@${LN} ${TARGET} ${.LINK.}@} 13213955d011SMarcel Moolenaar.Pp 132251ee2c1cSSimon J. GerratyHowever a single character variable is often more readable: 13233955d011SMarcel Moolenaar.Dl ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@} 13243955d011SMarcel Moolenaar.It Cm \&:U Ns Ar newval 13253955d011SMarcel MoolenaarIf the variable is undefined 13263955d011SMarcel Moolenaar.Ar newval 13273955d011SMarcel Moolenaaris the value. 13283955d011SMarcel MoolenaarIf the variable is defined, the existing value is returned. 13293955d011SMarcel MoolenaarThis is another ODE make feature. 13303955d011SMarcel MoolenaarIt is handy for setting per-target CFLAGS for instance: 13313955d011SMarcel Moolenaar.Dl ${_${.TARGET:T}_CFLAGS:U${DEF_CFLAGS}} 13323955d011SMarcel MoolenaarIf a value is only required if the variable is undefined, use: 13333955d011SMarcel Moolenaar.Dl ${VAR:D:Unewval} 13343955d011SMarcel Moolenaar.It Cm \&:D Ns Ar newval 13353955d011SMarcel MoolenaarIf the variable is defined 13363955d011SMarcel Moolenaar.Ar newval 13373955d011SMarcel Moolenaaris the value. 13383955d011SMarcel Moolenaar.It Cm \&:L 13393955d011SMarcel MoolenaarThe name of the variable is the value. 13403955d011SMarcel Moolenaar.It Cm \&:P 13413955d011SMarcel MoolenaarThe path of the node which has the same name as the variable 13423955d011SMarcel Moolenaaris the value. 13433955d011SMarcel MoolenaarIf no such node exists or its path is null, then the 13443955d011SMarcel Moolenaarname of the variable is used. 13453955d011SMarcel MoolenaarIn order for this modifier to work, the name (node) must at least have 13463955d011SMarcel Moolenaarappeared on the rhs of a dependency. 13473955d011SMarcel Moolenaar.Sm off 13483955d011SMarcel Moolenaar.It Cm \&:\&! Ar cmd Cm \&! 13493955d011SMarcel Moolenaar.Sm on 13503955d011SMarcel MoolenaarThe output of running 13513955d011SMarcel Moolenaar.Ar cmd 13523955d011SMarcel Moolenaaris the value. 13533955d011SMarcel Moolenaar.It Cm \&:sh 13543955d011SMarcel MoolenaarIf the variable is non-empty it is run as a command and the output 13553955d011SMarcel Moolenaarbecomes the new value. 13563955d011SMarcel Moolenaar.It Cm \&::= Ns Ar str 13573955d011SMarcel MoolenaarThe variable is assigned the value 13583955d011SMarcel Moolenaar.Ar str 13593955d011SMarcel Moolenaarafter substitution. 13603955d011SMarcel MoolenaarThis modifier and its variations are useful in 13613955d011SMarcel Moolenaarobscure situations such as wanting to set a variable when shell commands 13623955d011SMarcel Moolenaarare being parsed. 13633955d011SMarcel MoolenaarThese assignment modifiers always expand to 13643955d011SMarcel Moolenaarnothing, so if appearing in a rule line by themselves should be 13653955d011SMarcel Moolenaarpreceded with something to keep 13663955d011SMarcel Moolenaar.Nm 13673955d011SMarcel Moolenaarhappy. 13683955d011SMarcel Moolenaar.Pp 13693955d011SMarcel MoolenaarThe 13703955d011SMarcel Moolenaar.Ql Cm \&:: 13713955d011SMarcel Moolenaarhelps avoid false matches with the 13723955d011SMarcel Moolenaar.At V 13733955d011SMarcel Moolenaarstyle 13743955d011SMarcel Moolenaar.Cm \&:= 13753955d011SMarcel Moolenaarmodifier and since substitution always occurs the 13763955d011SMarcel Moolenaar.Cm \&::= 13773955d011SMarcel Moolenaarform is vaguely appropriate. 13783955d011SMarcel Moolenaar.It Cm \&::?= Ns Ar str 13793955d011SMarcel MoolenaarAs for 13803955d011SMarcel Moolenaar.Cm \&::= 13813955d011SMarcel Moolenaarbut only if the variable does not already have a value. 13823955d011SMarcel Moolenaar.It Cm \&::+= Ns Ar str 13833955d011SMarcel MoolenaarAppend 13843955d011SMarcel Moolenaar.Ar str 13853955d011SMarcel Moolenaarto the variable. 13863955d011SMarcel Moolenaar.It Cm \&::!= Ns Ar cmd 13873955d011SMarcel MoolenaarAssign the output of 13883955d011SMarcel Moolenaar.Ar cmd 13893955d011SMarcel Moolenaarto the variable. 13903955d011SMarcel Moolenaar.It Cm \&:\&[ Ns Ar range Ns Cm \&] 13913955d011SMarcel MoolenaarSelects one or more words from the value, 13923955d011SMarcel Moolenaaror performs other operations related to the way in which the 13933955d011SMarcel Moolenaarvalue is divided into words. 13943955d011SMarcel Moolenaar.Pp 13953955d011SMarcel MoolenaarOrdinarily, a value is treated as a sequence of words 13963955d011SMarcel Moolenaardelimited by white space. 13973955d011SMarcel MoolenaarSome modifiers suppress this behaviour, 13983955d011SMarcel Moolenaarcausing a value to be treated as a single word 13993955d011SMarcel Moolenaar(possibly containing embedded white space). 14003955d011SMarcel MoolenaarAn empty value, or a value that consists entirely of white-space, 14013955d011SMarcel Moolenaaris treated as a single word. 14023955d011SMarcel MoolenaarFor the purposes of the 14033955d011SMarcel Moolenaar.Ql Cm \&:[] 14043955d011SMarcel Moolenaarmodifier, the words are indexed both forwards using positive integers 14053955d011SMarcel Moolenaar(where index 1 represents the first word), 14063955d011SMarcel Moolenaarand backwards using negative integers 14073955d011SMarcel Moolenaar(where index \-1 represents the last word). 14083955d011SMarcel Moolenaar.Pp 14093955d011SMarcel MoolenaarThe 14103955d011SMarcel Moolenaar.Ar range 14113955d011SMarcel Moolenaaris subjected to variable expansion, and the expanded result is 14123955d011SMarcel Moolenaarthen interpreted as follows: 14133955d011SMarcel Moolenaar.Bl -tag -width index 14143955d011SMarcel Moolenaar.\" :[n] 14153955d011SMarcel Moolenaar.It Ar index 14163955d011SMarcel MoolenaarSelects a single word from the value. 14173955d011SMarcel Moolenaar.\" :[start..end] 14183955d011SMarcel Moolenaar.It Ar start Ns Cm \&.. Ns Ar end 14193955d011SMarcel MoolenaarSelects all words from 14203955d011SMarcel Moolenaar.Ar start 14213955d011SMarcel Moolenaarto 14223955d011SMarcel Moolenaar.Ar end , 14233955d011SMarcel Moolenaarinclusive. 14243955d011SMarcel MoolenaarFor example, 14253955d011SMarcel Moolenaar.Ql Cm \&:[2..-1] 14263955d011SMarcel Moolenaarselects all words from the second word to the last word. 14273955d011SMarcel MoolenaarIf 14283955d011SMarcel Moolenaar.Ar start 14293955d011SMarcel Moolenaaris greater than 14303955d011SMarcel Moolenaar.Ar end , 14313955d011SMarcel Moolenaarthen the words are output in reverse order. 14323955d011SMarcel MoolenaarFor example, 14333955d011SMarcel Moolenaar.Ql Cm \&:[-1..1] 14343955d011SMarcel Moolenaarselects all the words from last to first. 14353955d011SMarcel Moolenaar.\" :[*] 14363955d011SMarcel Moolenaar.It Cm \&* 14373955d011SMarcel MoolenaarCauses subsequent modifiers to treat the value as a single word 14383955d011SMarcel Moolenaar(possibly containing embedded white space). 14393955d011SMarcel MoolenaarAnalogous to the effect of 14403955d011SMarcel Moolenaar\&"$*\&" 14413955d011SMarcel Moolenaarin Bourne shell. 14423955d011SMarcel Moolenaar.\" :[0] 14433955d011SMarcel Moolenaar.It 0 14443955d011SMarcel MoolenaarMeans the same as 14453955d011SMarcel Moolenaar.Ql Cm \&:[*] . 14463955d011SMarcel Moolenaar.\" :[*] 14473955d011SMarcel Moolenaar.It Cm \&@ 14483955d011SMarcel MoolenaarCauses subsequent modifiers to treat the value as a sequence of words 14493955d011SMarcel Moolenaardelimited by white space. 14503955d011SMarcel MoolenaarAnalogous to the effect of 14513955d011SMarcel Moolenaar\&"$@\&" 14523955d011SMarcel Moolenaarin Bourne shell. 14533955d011SMarcel Moolenaar.\" :[#] 14543955d011SMarcel Moolenaar.It Cm \&# 14553955d011SMarcel MoolenaarReturns the number of words in the value. 14563955d011SMarcel Moolenaar.El \" :[range] 14573955d011SMarcel Moolenaar.El 14583955d011SMarcel Moolenaar.Sh INCLUDE STATEMENTS, CONDITIONALS AND FOR LOOPS 14593955d011SMarcel MoolenaarMakefile inclusion, conditional structures and for loops reminiscent 14603955d011SMarcel Moolenaarof the C programming language are provided in 14613955d011SMarcel Moolenaar.Nm . 14623955d011SMarcel MoolenaarAll such structures are identified by a line beginning with a single 14633955d011SMarcel Moolenaardot 14643955d011SMarcel Moolenaar.Pq Ql \&. 14653955d011SMarcel Moolenaarcharacter. 14663955d011SMarcel MoolenaarFiles are included with either 14673955d011SMarcel Moolenaar.Cm \&.include Aq Ar file 14683955d011SMarcel Moolenaaror 14693955d011SMarcel Moolenaar.Cm \&.include Pf \*q Ar file Ns \*q . 14703955d011SMarcel MoolenaarVariables between the angle brackets or double quotes are expanded 14713955d011SMarcel Moolenaarto form the file name. 14723955d011SMarcel MoolenaarIf angle brackets are used, the included makefile is expected to be in 14733955d011SMarcel Moolenaarthe system makefile directory. 14743955d011SMarcel MoolenaarIf double quotes are used, the including makefile's directory and any 14753955d011SMarcel Moolenaardirectories specified using the 14763955d011SMarcel Moolenaar.Fl I 14773955d011SMarcel Moolenaaroption are searched before the system 14783955d011SMarcel Moolenaarmakefile directory. 14793955d011SMarcel MoolenaarFor compatibility with other versions of 14803955d011SMarcel Moolenaar.Nm 14813955d011SMarcel Moolenaar.Ql include file ... 14823955d011SMarcel Moolenaaris also accepted. 14833955d011SMarcel MoolenaarIf the include statement is written as 14843955d011SMarcel Moolenaar.Cm .-include 14853955d011SMarcel Moolenaaror as 14863955d011SMarcel Moolenaar.Cm .sinclude 14873955d011SMarcel Moolenaarthen errors locating and/or opening include files are ignored. 14883955d011SMarcel Moolenaar.Pp 14893955d011SMarcel MoolenaarConditional expressions are also preceded by a single dot as the first 14903955d011SMarcel Moolenaarcharacter of a line. 14913955d011SMarcel MoolenaarThe possible conditionals are as follows: 14923955d011SMarcel Moolenaar.Bl -tag -width Ds 14933955d011SMarcel Moolenaar.It Ic .error Ar message 14943955d011SMarcel MoolenaarThe message is printed along with the name of the makefile and line number, 14953955d011SMarcel Moolenaarthen 14963955d011SMarcel Moolenaar.Nm 14973955d011SMarcel Moolenaarwill exit. 14983955d011SMarcel Moolenaar.It Ic .export Ar variable ... 14993955d011SMarcel MoolenaarExport the specified global variable. 15003955d011SMarcel MoolenaarIf no variable list is provided, all globals are exported 15013955d011SMarcel Moolenaarexcept for internal variables (those that start with 15023955d011SMarcel Moolenaar.Ql \&. ) . 15033955d011SMarcel MoolenaarThis is not affected by the 15043955d011SMarcel Moolenaar.Fl X 15053955d011SMarcel Moolenaarflag, so should be used with caution. 15063955d011SMarcel MoolenaarFor compatibility with other 15073955d011SMarcel Moolenaar.Nm 15083955d011SMarcel Moolenaarprograms 15093955d011SMarcel Moolenaar.Ql export variable=value 15103955d011SMarcel Moolenaaris also accepted. 15113955d011SMarcel Moolenaar.Pp 15123955d011SMarcel MoolenaarAppending a variable name to 15133955d011SMarcel Moolenaar.Va .MAKE.EXPORTED 15143955d011SMarcel Moolenaaris equivalent to exporting a variable. 15153955d011SMarcel Moolenaar.It Ic .export-env Ar variable ... 15163955d011SMarcel MoolenaarThe same as 15173955d011SMarcel Moolenaar.Ql .export , 15183955d011SMarcel Moolenaarexcept that the variable is not appended to 15193955d011SMarcel Moolenaar.Va .MAKE.EXPORTED . 15203955d011SMarcel MoolenaarThis allows exporting a value to the environment which is different from that 15213955d011SMarcel Moolenaarused by 15223955d011SMarcel Moolenaar.Nm 15233955d011SMarcel Moolenaarinternally. 15243955d011SMarcel Moolenaar.It Ic .info Ar message 15253955d011SMarcel MoolenaarThe message is printed along with the name of the makefile and line number. 15263955d011SMarcel Moolenaar.It Ic .undef Ar variable 15273955d011SMarcel MoolenaarUn-define the specified global variable. 15283955d011SMarcel MoolenaarOnly global variables may be un-defined. 15293955d011SMarcel Moolenaar.It Ic .unexport Ar variable ... 15303955d011SMarcel MoolenaarThe opposite of 15313955d011SMarcel Moolenaar.Ql .export . 15323955d011SMarcel MoolenaarThe specified global 15333955d011SMarcel Moolenaar.Va variable 15343955d011SMarcel Moolenaarwill be removed from 15353955d011SMarcel Moolenaar.Va .MAKE.EXPORTED . 15363955d011SMarcel MoolenaarIf no variable list is provided, all globals are unexported, 15373955d011SMarcel Moolenaarand 15383955d011SMarcel Moolenaar.Va .MAKE.EXPORTED 15393955d011SMarcel Moolenaardeleted. 15403955d011SMarcel Moolenaar.It Ic .unexport-env 15413955d011SMarcel MoolenaarUnexport all globals previously exported and 15423955d011SMarcel Moolenaarclear the environment inherited from the parent. 15433955d011SMarcel MoolenaarThis operation will cause a memory leak of the original environment, 15443955d011SMarcel Moolenaarso should be used sparingly. 15453955d011SMarcel MoolenaarTesting for 15463955d011SMarcel Moolenaar.Va .MAKE.LEVEL 15473955d011SMarcel Moolenaarbeing 0, would make sense. 15483955d011SMarcel MoolenaarAlso note that any variables which originated in the parent environment 15493955d011SMarcel Moolenaarshould be explicitly preserved if desired. 15503955d011SMarcel MoolenaarFor example: 15513955d011SMarcel Moolenaar.Bd -literal -offset indent 15523955d011SMarcel Moolenaar.Li .if ${.MAKE.LEVEL} == 0 15533955d011SMarcel MoolenaarPATH := ${PATH} 15543955d011SMarcel Moolenaar.Li .unexport-env 15553955d011SMarcel Moolenaar.Li .export PATH 15563955d011SMarcel Moolenaar.Li .endif 15573955d011SMarcel Moolenaar.Pp 15583955d011SMarcel Moolenaar.Ed 15593955d011SMarcel MoolenaarWould result in an environment containing only 15603955d011SMarcel Moolenaar.Ql Ev PATH , 15613955d011SMarcel Moolenaarwhich is the minimal useful environment. 15623955d011SMarcel MoolenaarActually 15633955d011SMarcel Moolenaar.Ql Ev .MAKE.LEVEL 15643955d011SMarcel Moolenaarwill also be pushed into the new environment. 15653955d011SMarcel Moolenaar.It Ic .warning Ar message 15663955d011SMarcel MoolenaarThe message prefixed by 15673955d011SMarcel Moolenaar.Ql Pa warning: 15683955d011SMarcel Moolenaaris printed along with the name of the makefile and line number. 15693955d011SMarcel Moolenaar.It Ic \&.if Oo \&! Oc Ns Ar expression Op Ar operator expression ... 15703955d011SMarcel MoolenaarTest the value of an expression. 15713955d011SMarcel Moolenaar.It Ic .ifdef Oo \&! Oc Ns Ar variable Op Ar operator variable ... 15723955d011SMarcel MoolenaarTest the value of a variable. 15733955d011SMarcel Moolenaar.It Ic .ifndef Oo \&! Oc Ns Ar variable Op Ar operator variable ... 15743955d011SMarcel MoolenaarTest the value of a variable. 15753955d011SMarcel Moolenaar.It Ic .ifmake Oo \&! Oc Ns Ar target Op Ar operator target ... 15763955d011SMarcel MoolenaarTest the target being built. 15773955d011SMarcel Moolenaar.It Ic .ifnmake Oo \&! Ns Oc Ar target Op Ar operator target ... 15783955d011SMarcel MoolenaarTest the target being built. 15793955d011SMarcel Moolenaar.It Ic .else 15803955d011SMarcel MoolenaarReverse the sense of the last conditional. 15813955d011SMarcel Moolenaar.It Ic .elif Oo \&! Ns Oc Ar expression Op Ar operator expression ... 15823955d011SMarcel MoolenaarA combination of 15833955d011SMarcel Moolenaar.Ql Ic .else 15843955d011SMarcel Moolenaarfollowed by 15853955d011SMarcel Moolenaar.Ql Ic .if . 15863955d011SMarcel Moolenaar.It Ic .elifdef Oo \&! Oc Ns Ar variable Op Ar operator variable ... 15873955d011SMarcel MoolenaarA combination of 15883955d011SMarcel Moolenaar.Ql Ic .else 15893955d011SMarcel Moolenaarfollowed by 15903955d011SMarcel Moolenaar.Ql Ic .ifdef . 15913955d011SMarcel Moolenaar.It Ic .elifndef Oo \&! Oc Ns Ar variable Op Ar operator variable ... 15923955d011SMarcel MoolenaarA combination of 15933955d011SMarcel Moolenaar.Ql Ic .else 15943955d011SMarcel Moolenaarfollowed by 15953955d011SMarcel Moolenaar.Ql Ic .ifndef . 15963955d011SMarcel Moolenaar.It Ic .elifmake Oo \&! Oc Ns Ar target Op Ar operator target ... 15973955d011SMarcel MoolenaarA combination of 15983955d011SMarcel Moolenaar.Ql Ic .else 15993955d011SMarcel Moolenaarfollowed by 16003955d011SMarcel Moolenaar.Ql Ic .ifmake . 16013955d011SMarcel Moolenaar.It Ic .elifnmake Oo \&! Oc Ns Ar target Op Ar operator target ... 16023955d011SMarcel MoolenaarA combination of 16033955d011SMarcel Moolenaar.Ql Ic .else 16043955d011SMarcel Moolenaarfollowed by 16053955d011SMarcel Moolenaar.Ql Ic .ifnmake . 16063955d011SMarcel Moolenaar.It Ic .endif 16073955d011SMarcel MoolenaarEnd the body of the conditional. 16083955d011SMarcel Moolenaar.El 16093955d011SMarcel Moolenaar.Pp 16103955d011SMarcel MoolenaarThe 16113955d011SMarcel Moolenaar.Ar operator 16123955d011SMarcel Moolenaarmay be any one of the following: 16133955d011SMarcel Moolenaar.Bl -tag -width "Cm XX" 16143955d011SMarcel Moolenaar.It Cm \&|\&| 16153955d011SMarcel MoolenaarLogical OR. 16163955d011SMarcel Moolenaar.It Cm \&\*[Am]\*[Am] 16173955d011SMarcel MoolenaarLogical 16183955d011SMarcel Moolenaar.Tn AND ; 16193955d011SMarcel Moolenaarof higher precedence than 16203955d011SMarcel Moolenaar.Dq \&|\&| . 16213955d011SMarcel Moolenaar.El 16223955d011SMarcel Moolenaar.Pp 16233955d011SMarcel MoolenaarAs in C, 16243955d011SMarcel Moolenaar.Nm 16253955d011SMarcel Moolenaarwill only evaluate a conditional as far as is necessary to determine 16263955d011SMarcel Moolenaarits value. 16273955d011SMarcel MoolenaarParentheses may be used to change the order of evaluation. 16283955d011SMarcel MoolenaarThe boolean operator 16293955d011SMarcel Moolenaar.Ql Ic \&! 16303955d011SMarcel Moolenaarmay be used to logically negate an entire 16313955d011SMarcel Moolenaarconditional. 16323955d011SMarcel MoolenaarIt is of higher precedence than 16333955d011SMarcel Moolenaar.Ql Ic \&\*[Am]\*[Am] . 16343955d011SMarcel Moolenaar.Pp 16353955d011SMarcel MoolenaarThe value of 16363955d011SMarcel Moolenaar.Ar expression 16373955d011SMarcel Moolenaarmay be any of the following: 16383955d011SMarcel Moolenaar.Bl -tag -width defined 16393955d011SMarcel Moolenaar.It Ic defined 16403955d011SMarcel MoolenaarTakes a variable name as an argument and evaluates to true if the variable 16413955d011SMarcel Moolenaarhas been defined. 16423955d011SMarcel Moolenaar.It Ic make 16433955d011SMarcel MoolenaarTakes a target name as an argument and evaluates to true if the target 16443955d011SMarcel Moolenaarwas specified as part of 16453955d011SMarcel Moolenaar.Nm Ns 's 16463955d011SMarcel Moolenaarcommand line or was declared the default target (either implicitly or 16473955d011SMarcel Moolenaarexplicitly, see 16483955d011SMarcel Moolenaar.Va .MAIN ) 16493955d011SMarcel Moolenaarbefore the line containing the conditional. 16503955d011SMarcel Moolenaar.It Ic empty 16513955d011SMarcel MoolenaarTakes a variable, with possible modifiers, and evaluates to true if 16523955d011SMarcel Moolenaarthe expansion of the variable would result in an empty string. 16533955d011SMarcel Moolenaar.It Ic exists 16543955d011SMarcel MoolenaarTakes a file name as an argument and evaluates to true if the file exists. 16553955d011SMarcel MoolenaarThe file is searched for on the system search path (see 16563955d011SMarcel Moolenaar.Va .PATH ) . 16573955d011SMarcel Moolenaar.It Ic target 16583955d011SMarcel MoolenaarTakes a target name as an argument and evaluates to true if the target 16593955d011SMarcel Moolenaarhas been defined. 16603955d011SMarcel Moolenaar.It Ic commands 16613955d011SMarcel MoolenaarTakes a target name as an argument and evaluates to true if the target 16623955d011SMarcel Moolenaarhas been defined and has commands associated with it. 16633955d011SMarcel Moolenaar.El 16643955d011SMarcel Moolenaar.Pp 16653955d011SMarcel Moolenaar.Ar Expression 16663955d011SMarcel Moolenaarmay also be an arithmetic or string comparison. 16673955d011SMarcel MoolenaarVariable expansion is 16683955d011SMarcel Moolenaarperformed on both sides of the comparison, after which the integral 16693955d011SMarcel Moolenaarvalues are compared. 16703955d011SMarcel MoolenaarA value is interpreted as hexadecimal if it is 16713955d011SMarcel Moolenaarpreceded by 0x, otherwise it is decimal; octal numbers are not supported. 16723955d011SMarcel MoolenaarThe standard C relational operators are all supported. 16733955d011SMarcel MoolenaarIf after 16743955d011SMarcel Moolenaarvariable expansion, either the left or right hand side of a 16753955d011SMarcel Moolenaar.Ql Ic == 16763955d011SMarcel Moolenaaror 16773955d011SMarcel Moolenaar.Ql Ic "!=" 16783955d011SMarcel Moolenaaroperator is not an integral value, then 16793955d011SMarcel Moolenaarstring comparison is performed between the expanded 16803955d011SMarcel Moolenaarvariables. 16813955d011SMarcel MoolenaarIf no relational operator is given, it is assumed that the expanded 16823955d011SMarcel Moolenaarvariable is being compared against 0 or an empty string in the case 16833955d011SMarcel Moolenaarof a string comparison. 16843955d011SMarcel Moolenaar.Pp 16853955d011SMarcel MoolenaarWhen 16863955d011SMarcel Moolenaar.Nm 16873955d011SMarcel Moolenaaris evaluating one of these conditional expressions, and it encounters 16883955d011SMarcel Moolenaara (white-space separated) word it doesn't recognize, either the 16893955d011SMarcel Moolenaar.Dq make 16903955d011SMarcel Moolenaaror 16913955d011SMarcel Moolenaar.Dq defined 16923955d011SMarcel Moolenaarexpression is applied to it, depending on the form of the conditional. 16933955d011SMarcel MoolenaarIf the form is 16943955d011SMarcel Moolenaar.Ql Ic .ifdef , 16953955d011SMarcel Moolenaar.Ql Ic .ifndef , 16963955d011SMarcel Moolenaaror 16973955d011SMarcel Moolenaar.Ql Ic .if 16983955d011SMarcel Moolenaarthe 16993955d011SMarcel Moolenaar.Dq defined 17003955d011SMarcel Moolenaarexpression is applied. 17013955d011SMarcel MoolenaarSimilarly, if the form is 17023955d011SMarcel Moolenaar.Ql Ic .ifmake 17033955d011SMarcel Moolenaaror 17043955d011SMarcel Moolenaar.Ql Ic .ifnmake , the 17053955d011SMarcel Moolenaar.Dq make 17063955d011SMarcel Moolenaarexpression is applied. 17073955d011SMarcel Moolenaar.Pp 17083955d011SMarcel MoolenaarIf the conditional evaluates to true the parsing of the makefile continues 17093955d011SMarcel Moolenaaras before. 17103955d011SMarcel MoolenaarIf it evaluates to false, the following lines are skipped. 17113955d011SMarcel MoolenaarIn both cases this continues until a 17123955d011SMarcel Moolenaar.Ql Ic .else 17133955d011SMarcel Moolenaaror 17143955d011SMarcel Moolenaar.Ql Ic .endif 17153955d011SMarcel Moolenaaris found. 17163955d011SMarcel Moolenaar.Pp 17173955d011SMarcel MoolenaarFor loops are typically used to apply a set of rules to a list of files. 17183955d011SMarcel MoolenaarThe syntax of a for loop is: 17193955d011SMarcel Moolenaar.Pp 17203955d011SMarcel Moolenaar.Bl -tag -compact -width Ds 17213955d011SMarcel Moolenaar.It Ic \&.for Ar variable Oo Ar variable ... Oc Ic in Ar expression 17223955d011SMarcel Moolenaar.It Aq make-rules 17233955d011SMarcel Moolenaar.It Ic \&.endfor 17243955d011SMarcel Moolenaar.El 17253955d011SMarcel Moolenaar.Pp 17263955d011SMarcel MoolenaarAfter the for 17273955d011SMarcel Moolenaar.Ic expression 17283955d011SMarcel Moolenaaris evaluated, it is split into words. 17293955d011SMarcel MoolenaarOn each iteration of the loop, one word is taken and assigned to each 17303955d011SMarcel Moolenaar.Ic variable , 17313955d011SMarcel Moolenaarin order, and these 17323955d011SMarcel Moolenaar.Ic variables 17333955d011SMarcel Moolenaarare substituted into the 17343955d011SMarcel Moolenaar.Ic make-rules 17353955d011SMarcel Moolenaarinside the body of the for loop. 17363955d011SMarcel MoolenaarThe number of words must come out even; that is, if there are three 17373955d011SMarcel Moolenaariteration variables, the number of words provided must be a multiple 17383955d011SMarcel Moolenaarof three. 17393955d011SMarcel Moolenaar.Sh COMMENTS 17403955d011SMarcel MoolenaarComments begin with a hash 17413955d011SMarcel Moolenaar.Pq Ql \&# 17423955d011SMarcel Moolenaarcharacter, anywhere but in a shell 17433955d011SMarcel Moolenaarcommand line, and continue to the end of an unescaped new line. 17443955d011SMarcel Moolenaar.Sh SPECIAL SOURCES (ATTRIBUTES) 17453955d011SMarcel Moolenaar.Bl -tag -width .IGNOREx 17463955d011SMarcel Moolenaar.It Ic .EXEC 17473955d011SMarcel MoolenaarTarget is never out of date, but always execute commands anyway. 17483955d011SMarcel Moolenaar.It Ic .IGNORE 17493955d011SMarcel MoolenaarIgnore any errors from the commands associated with this target, exactly 17503955d011SMarcel Moolenaaras if they all were preceded by a dash 17513955d011SMarcel Moolenaar.Pq Ql \- . 17523955d011SMarcel Moolenaar.\" .It Ic .INVISIBLE 17533955d011SMarcel Moolenaar.\" XXX 17543955d011SMarcel Moolenaar.\" .It Ic .JOIN 17553955d011SMarcel Moolenaar.\" XXX 17563955d011SMarcel Moolenaar.It Ic .MADE 17573955d011SMarcel MoolenaarMark all sources of this target as being up-to-date. 17583955d011SMarcel Moolenaar.It Ic .MAKE 17593955d011SMarcel MoolenaarExecute the commands associated with this target even if the 17603955d011SMarcel Moolenaar.Fl n 17613955d011SMarcel Moolenaaror 17623955d011SMarcel Moolenaar.Fl t 17633955d011SMarcel Moolenaaroptions were specified. 17643955d011SMarcel MoolenaarNormally used to mark recursive 17653955d011SMarcel Moolenaar.Nm Ns 's . 17663955d011SMarcel Moolenaar.It Ic .META 17673955d011SMarcel MoolenaarCreate a meta file for the target, even if it is flagged as 17683955d011SMarcel Moolenaar.Ic .PHONY , 17693955d011SMarcel Moolenaar.Ic .MAKE , 17703955d011SMarcel Moolenaaror 17713955d011SMarcel Moolenaar.Ic .SPECIAL . 17723955d011SMarcel MoolenaarUsage in conjunction with 17733955d011SMarcel Moolenaar.Ic .MAKE 17743955d011SMarcel Moolenaaris the most likely case. 17753955d011SMarcel MoolenaarIn "meta" mode, the target is out-of-date if the meta file is missing. 17763955d011SMarcel Moolenaar.It Ic .NOMETA 17773955d011SMarcel MoolenaarDo not create a meta file for the target. 17783955d011SMarcel MoolenaarMeta files are also not created for 17793955d011SMarcel Moolenaar.Ic .PHONY , 17803955d011SMarcel Moolenaar.Ic .MAKE , 17813955d011SMarcel Moolenaaror 17823955d011SMarcel Moolenaar.Ic .SPECIAL 17833955d011SMarcel Moolenaartargets. 17843955d011SMarcel Moolenaar.It Ic .NOMETA_CMP 17853955d011SMarcel MoolenaarIgnore differences in commands when deciding if target is out of date. 17863955d011SMarcel MoolenaarThis is useful if the command contains a value which always changes. 17873955d011SMarcel MoolenaarIf the number of commands change, though, the target will still be out of date. 17881748de26SSimon J. GerratyThe same effect applies to any command line that uses the variable 17891748de26SSimon J. Gerraty.Va .OODATE , 17901748de26SSimon J. Gerratywhich can be used for that purpose even when not otherwise needed or desired: 17911748de26SSimon J. Gerraty.Bd -literal -offset indent 17921748de26SSimon J. Gerraty 17931748de26SSimon J. Gerratyskip-compare-for-some: 17941748de26SSimon J. Gerraty @echo this will be compared 17951748de26SSimon J. Gerraty @echo this will not ${.OODATE:M.NOMETA_CMP} 17961748de26SSimon J. Gerraty @echo this will also be compared 17971748de26SSimon J. Gerraty 17981748de26SSimon J. Gerraty.Ed 17991748de26SSimon J. GerratyThe 18001748de26SSimon J. Gerraty.Cm \&:M 18011748de26SSimon J. Gerratypattern suppresses any expansion of the unwanted variable. 18023955d011SMarcel Moolenaar.It Ic .NOPATH 18033955d011SMarcel MoolenaarDo not search for the target in the directories specified by 18043955d011SMarcel Moolenaar.Ic .PATH . 18053955d011SMarcel Moolenaar.It Ic .NOTMAIN 18063955d011SMarcel MoolenaarNormally 18073955d011SMarcel Moolenaar.Nm 18083955d011SMarcel Moolenaarselects the first target it encounters as the default target to be built 18093955d011SMarcel Moolenaarif no target was specified. 18103955d011SMarcel MoolenaarThis source prevents this target from being selected. 18113955d011SMarcel Moolenaar.It Ic .OPTIONAL 18123955d011SMarcel MoolenaarIf a target is marked with this attribute and 18133955d011SMarcel Moolenaar.Nm 18143955d011SMarcel Moolenaarcan't figure out how to create it, it will ignore this fact and assume 18153955d011SMarcel Moolenaarthe file isn't needed or already exists. 18163955d011SMarcel Moolenaar.It Ic .PHONY 18173955d011SMarcel MoolenaarThe target does not 18183955d011SMarcel Moolenaarcorrespond to an actual file; it is always considered to be out of date, 18193955d011SMarcel Moolenaarand will not be created with the 18203955d011SMarcel Moolenaar.Fl t 18213955d011SMarcel Moolenaaroption. 18223955d011SMarcel MoolenaarSuffix-transformation rules are not applied to 18233955d011SMarcel Moolenaar.Ic .PHONY 18243955d011SMarcel Moolenaartargets. 18253955d011SMarcel Moolenaar.It Ic .PRECIOUS 18263955d011SMarcel MoolenaarWhen 18273955d011SMarcel Moolenaar.Nm 18283955d011SMarcel Moolenaaris interrupted, it normally removes any partially made targets. 18293955d011SMarcel MoolenaarThis source prevents the target from being removed. 18303955d011SMarcel Moolenaar.It Ic .RECURSIVE 18313955d011SMarcel MoolenaarSynonym for 18323955d011SMarcel Moolenaar.Ic .MAKE . 18333955d011SMarcel Moolenaar.It Ic .SILENT 18343955d011SMarcel MoolenaarDo not echo any of the commands associated with this target, exactly 18353955d011SMarcel Moolenaaras if they all were preceded by an at sign 18363955d011SMarcel Moolenaar.Pq Ql @ . 18373955d011SMarcel Moolenaar.It Ic .USE 18383955d011SMarcel MoolenaarTurn the target into 18393955d011SMarcel Moolenaar.Nm Ns 's 18403955d011SMarcel Moolenaarversion of a macro. 18413955d011SMarcel MoolenaarWhen the target is used as a source for another target, the other target 18423955d011SMarcel Moolenaaracquires the commands, sources, and attributes (except for 18433955d011SMarcel Moolenaar.Ic .USE ) 18443955d011SMarcel Moolenaarof the 18453955d011SMarcel Moolenaarsource. 18463955d011SMarcel MoolenaarIf the target already has commands, the 18473955d011SMarcel Moolenaar.Ic .USE 18483955d011SMarcel Moolenaartarget's commands are appended 18493955d011SMarcel Moolenaarto them. 18503955d011SMarcel Moolenaar.It Ic .USEBEFORE 18513955d011SMarcel MoolenaarExactly like 18523955d011SMarcel Moolenaar.Ic .USE , 18533955d011SMarcel Moolenaarbut prepend the 18543955d011SMarcel Moolenaar.Ic .USEBEFORE 18553955d011SMarcel Moolenaartarget commands to the target. 18563955d011SMarcel Moolenaar.It Ic .WAIT 18573955d011SMarcel MoolenaarIf 18583955d011SMarcel Moolenaar.Ic .WAIT 18593955d011SMarcel Moolenaarappears in a dependency line, the sources that precede it are 18603955d011SMarcel Moolenaarmade before the sources that succeed it in the line. 18613955d011SMarcel MoolenaarSince the dependents of files are not made until the file itself 18623955d011SMarcel Moolenaarcould be made, this also stops the dependents being built unless they 18633955d011SMarcel Moolenaarare needed for another branch of the dependency tree. 18643955d011SMarcel MoolenaarSo given: 18653955d011SMarcel Moolenaar.Bd -literal 18663955d011SMarcel Moolenaarx: a .WAIT b 18673955d011SMarcel Moolenaar echo x 18683955d011SMarcel Moolenaara: 18693955d011SMarcel Moolenaar echo a 18703955d011SMarcel Moolenaarb: b1 18713955d011SMarcel Moolenaar echo b 18723955d011SMarcel Moolenaarb1: 18733955d011SMarcel Moolenaar echo b1 18743955d011SMarcel Moolenaar 18753955d011SMarcel Moolenaar.Ed 18763955d011SMarcel Moolenaarthe output is always 18773955d011SMarcel Moolenaar.Ql a , 18783955d011SMarcel Moolenaar.Ql b1 , 18793955d011SMarcel Moolenaar.Ql b , 18803955d011SMarcel Moolenaar.Ql x . 18813955d011SMarcel Moolenaar.br 18823955d011SMarcel MoolenaarThe ordering imposed by 18833955d011SMarcel Moolenaar.Ic .WAIT 18843955d011SMarcel Moolenaaris only relevant for parallel makes. 18853955d011SMarcel Moolenaar.El 18863955d011SMarcel Moolenaar.Sh SPECIAL TARGETS 18873955d011SMarcel MoolenaarSpecial targets may not be included with other targets, i.e. they must be 18883955d011SMarcel Moolenaarthe only target specified. 18893955d011SMarcel Moolenaar.Bl -tag -width .BEGINx 18903955d011SMarcel Moolenaar.It Ic .BEGIN 18913955d011SMarcel MoolenaarAny command lines attached to this target are executed before anything 18923955d011SMarcel Moolenaarelse is done. 18933955d011SMarcel Moolenaar.It Ic .DEFAULT 18943955d011SMarcel MoolenaarThis is sort of a 18953955d011SMarcel Moolenaar.Ic .USE 18963955d011SMarcel Moolenaarrule for any target (that was used only as a 18973955d011SMarcel Moolenaarsource) that 18983955d011SMarcel Moolenaar.Nm 18993955d011SMarcel Moolenaarcan't figure out any other way to create. 19003955d011SMarcel MoolenaarOnly the shell script is used. 19013955d011SMarcel MoolenaarThe 19023955d011SMarcel Moolenaar.Ic .IMPSRC 19033955d011SMarcel Moolenaarvariable of a target that inherits 19043955d011SMarcel Moolenaar.Ic .DEFAULT Ns 's 19053955d011SMarcel Moolenaarcommands is set 19063955d011SMarcel Moolenaarto the target's own name. 19073955d011SMarcel Moolenaar.It Ic .END 19083955d011SMarcel MoolenaarAny command lines attached to this target are executed after everything 19093955d011SMarcel Moolenaarelse is done. 19103955d011SMarcel Moolenaar.It Ic .ERROR 19113955d011SMarcel MoolenaarAny command lines attached to this target are executed when another target fails. 19123955d011SMarcel MoolenaarThe 19133955d011SMarcel Moolenaar.Ic .ERROR_TARGET 19143955d011SMarcel Moolenaarvariable is set to the target that failed. 19153955d011SMarcel MoolenaarSee also 19163955d011SMarcel Moolenaar.Ic MAKE_PRINT_VAR_ON_ERROR . 19173955d011SMarcel Moolenaar.It Ic .IGNORE 19183955d011SMarcel MoolenaarMark each of the sources with the 19193955d011SMarcel Moolenaar.Ic .IGNORE 19203955d011SMarcel Moolenaarattribute. 19213955d011SMarcel MoolenaarIf no sources are specified, this is the equivalent of specifying the 19223955d011SMarcel Moolenaar.Fl i 19233955d011SMarcel Moolenaaroption. 19243955d011SMarcel Moolenaar.It Ic .INTERRUPT 19253955d011SMarcel MoolenaarIf 19263955d011SMarcel Moolenaar.Nm 19273955d011SMarcel Moolenaaris interrupted, the commands for this target will be executed. 19283955d011SMarcel Moolenaar.It Ic .MAIN 19293955d011SMarcel MoolenaarIf no target is specified when 19303955d011SMarcel Moolenaar.Nm 19313955d011SMarcel Moolenaaris invoked, this target will be built. 19323955d011SMarcel Moolenaar.It Ic .MAKEFLAGS 19333955d011SMarcel MoolenaarThis target provides a way to specify flags for 19343955d011SMarcel Moolenaar.Nm 19353955d011SMarcel Moolenaarwhen the makefile is used. 19363955d011SMarcel MoolenaarThe flags are as if typed to the shell, though the 19373955d011SMarcel Moolenaar.Fl f 19383955d011SMarcel Moolenaaroption will have 19393955d011SMarcel Moolenaarno effect. 19403955d011SMarcel Moolenaar.\" XXX: NOT YET!!!! 19413955d011SMarcel Moolenaar.\" .It Ic .NOTPARALLEL 19423955d011SMarcel Moolenaar.\" The named targets are executed in non parallel mode. 19433955d011SMarcel Moolenaar.\" If no targets are 19443955d011SMarcel Moolenaar.\" specified, then all targets are executed in non parallel mode. 19453955d011SMarcel Moolenaar.It Ic .NOPATH 19463955d011SMarcel MoolenaarApply the 19473955d011SMarcel Moolenaar.Ic .NOPATH 19483955d011SMarcel Moolenaarattribute to any specified sources. 19493955d011SMarcel Moolenaar.It Ic .NOTPARALLEL 19503955d011SMarcel MoolenaarDisable parallel mode. 19513955d011SMarcel Moolenaar.It Ic .NO_PARALLEL 19523955d011SMarcel MoolenaarSynonym for 19533955d011SMarcel Moolenaar.Ic .NOTPARALLEL , 19543955d011SMarcel Moolenaarfor compatibility with other pmake variants. 19553955d011SMarcel Moolenaar.It Ic .ORDER 19563955d011SMarcel MoolenaarThe named targets are made in sequence. 19573955d011SMarcel MoolenaarThis ordering does not add targets to the list of targets to be made. 19583955d011SMarcel MoolenaarSince the dependents of a target do not get built until the target itself 19593955d011SMarcel Moolenaarcould be built, unless 19603955d011SMarcel Moolenaar.Ql a 19613955d011SMarcel Moolenaaris built by another part of the dependency graph, 19623955d011SMarcel Moolenaarthe following is a dependency loop: 19633955d011SMarcel Moolenaar.Bd -literal 19643955d011SMarcel Moolenaar\&.ORDER: b a 19653955d011SMarcel Moolenaarb: a 19663955d011SMarcel Moolenaar.Ed 19673955d011SMarcel Moolenaar.Pp 19683955d011SMarcel MoolenaarThe ordering imposed by 19693955d011SMarcel Moolenaar.Ic .ORDER 19703955d011SMarcel Moolenaaris only relevant for parallel makes. 19713955d011SMarcel Moolenaar.\" XXX: NOT YET!!!! 19723955d011SMarcel Moolenaar.\" .It Ic .PARALLEL 19733955d011SMarcel Moolenaar.\" The named targets are executed in parallel mode. 19743955d011SMarcel Moolenaar.\" If no targets are 19753955d011SMarcel Moolenaar.\" specified, then all targets are executed in parallel mode. 19763955d011SMarcel Moolenaar.It Ic .PATH 19773955d011SMarcel MoolenaarThe sources are directories which are to be searched for files not 19783955d011SMarcel Moolenaarfound in the current directory. 19793955d011SMarcel MoolenaarIf no sources are specified, any previously specified directories are 19803955d011SMarcel Moolenaardeleted. 19813955d011SMarcel MoolenaarIf the source is the special 19823955d011SMarcel Moolenaar.Ic .DOTLAST 19833955d011SMarcel Moolenaartarget, then the current working 19843955d011SMarcel Moolenaardirectory is searched last. 19851bbe5942SSimon J. Gerraty.It Ic .PATH. Ns Va suffix 19861bbe5942SSimon J. GerratyLike 19871bbe5942SSimon J. Gerraty.Ic .PATH 19881bbe5942SSimon J. Gerratybut applies only to files with a particular suffix. 19891bbe5942SSimon J. GerratyThe suffix must have been previously declared with 19901bbe5942SSimon J. Gerraty.Ic .SUFFIXES . 19913955d011SMarcel Moolenaar.It Ic .PHONY 19923955d011SMarcel MoolenaarApply the 19933955d011SMarcel Moolenaar.Ic .PHONY 19943955d011SMarcel Moolenaarattribute to any specified sources. 19953955d011SMarcel Moolenaar.It Ic .PRECIOUS 19963955d011SMarcel MoolenaarApply the 19973955d011SMarcel Moolenaar.Ic .PRECIOUS 19983955d011SMarcel Moolenaarattribute to any specified sources. 19993955d011SMarcel MoolenaarIf no sources are specified, the 20003955d011SMarcel Moolenaar.Ic .PRECIOUS 20013955d011SMarcel Moolenaarattribute is applied to every 20023955d011SMarcel Moolenaartarget in the file. 20033955d011SMarcel Moolenaar.It Ic .SHELL 20043955d011SMarcel MoolenaarSets the shell that 20053955d011SMarcel Moolenaar.Nm 20063955d011SMarcel Moolenaarwill use to execute commands. 20073955d011SMarcel MoolenaarThe sources are a set of 20083955d011SMarcel Moolenaar.Ar field=value 20093955d011SMarcel Moolenaarpairs. 20103955d011SMarcel Moolenaar.Bl -tag -width hasErrCtls 20113955d011SMarcel Moolenaar.It Ar name 20123955d011SMarcel MoolenaarThis is the minimal specification, used to select one of the builtin 20133955d011SMarcel Moolenaarshell specs; 20143955d011SMarcel Moolenaar.Ar sh , 20153955d011SMarcel Moolenaar.Ar ksh , 20163955d011SMarcel Moolenaarand 20173955d011SMarcel Moolenaar.Ar csh . 20183955d011SMarcel Moolenaar.It Ar path 20193955d011SMarcel MoolenaarSpecifies the path to the shell. 20203955d011SMarcel Moolenaar.It Ar hasErrCtl 20213955d011SMarcel MoolenaarIndicates whether the shell supports exit on error. 20223955d011SMarcel Moolenaar.It Ar check 20233955d011SMarcel MoolenaarThe command to turn on error checking. 20243955d011SMarcel Moolenaar.It Ar ignore 20253955d011SMarcel MoolenaarThe command to disable error checking. 20263955d011SMarcel Moolenaar.It Ar echo 20273955d011SMarcel MoolenaarThe command to turn on echoing of commands executed. 20283955d011SMarcel Moolenaar.It Ar quiet 20293955d011SMarcel MoolenaarThe command to turn off echoing of commands executed. 20303955d011SMarcel Moolenaar.It Ar filter 20313955d011SMarcel MoolenaarThe output to filter after issuing the 20323955d011SMarcel Moolenaar.Ar quiet 20333955d011SMarcel Moolenaarcommand. 20343955d011SMarcel MoolenaarIt is typically identical to 20353955d011SMarcel Moolenaar.Ar quiet . 20363955d011SMarcel Moolenaar.It Ar errFlag 20373955d011SMarcel MoolenaarThe flag to pass the shell to enable error checking. 20383955d011SMarcel Moolenaar.It Ar echoFlag 20393955d011SMarcel MoolenaarThe flag to pass the shell to enable command echoing. 20403955d011SMarcel Moolenaar.It Ar newline 20413955d011SMarcel MoolenaarThe string literal to pass the shell that results in a single newline 20423955d011SMarcel Moolenaarcharacter when used outside of any quoting characters. 20433955d011SMarcel Moolenaar.El 20443955d011SMarcel MoolenaarExample: 20453955d011SMarcel Moolenaar.Bd -literal 20463955d011SMarcel Moolenaar\&.SHELL: name=ksh path=/bin/ksh hasErrCtl=true \e 20473955d011SMarcel Moolenaar check="set \-e" ignore="set +e" \e 20483955d011SMarcel Moolenaar echo="set \-v" quiet="set +v" filter="set +v" \e 20493955d011SMarcel Moolenaar echoFlag=v errFlag=e newline="'\en'" 20503955d011SMarcel Moolenaar.Ed 20513955d011SMarcel Moolenaar.It Ic .SILENT 20523955d011SMarcel MoolenaarApply the 20533955d011SMarcel Moolenaar.Ic .SILENT 20543955d011SMarcel Moolenaarattribute to any specified sources. 20553955d011SMarcel MoolenaarIf no sources are specified, the 20563955d011SMarcel Moolenaar.Ic .SILENT 20573955d011SMarcel Moolenaarattribute is applied to every 20583955d011SMarcel Moolenaarcommand in the file. 20591748de26SSimon J. Gerraty.It Ic .STALE 20601748de26SSimon J. GerratyThis target gets run when a dependency file contains stale entries, having 20611748de26SSimon J. Gerraty.Va .ALLSRC 20621748de26SSimon J. Gerratyset to the name of that dependency file. 20633955d011SMarcel Moolenaar.It Ic .SUFFIXES 20643955d011SMarcel MoolenaarEach source specifies a suffix to 20653955d011SMarcel Moolenaar.Nm . 20663955d011SMarcel MoolenaarIf no sources are specified, any previously specified suffixes are deleted. 20673955d011SMarcel MoolenaarIt allows the creation of suffix-transformation rules. 20683955d011SMarcel Moolenaar.Pp 20693955d011SMarcel MoolenaarExample: 20703955d011SMarcel Moolenaar.Bd -literal 20713955d011SMarcel Moolenaar\&.SUFFIXES: .o 20723955d011SMarcel Moolenaar\&.c.o: 20733955d011SMarcel Moolenaar cc \-o ${.TARGET} \-c ${.IMPSRC} 20743955d011SMarcel Moolenaar.Ed 20753955d011SMarcel Moolenaar.El 20763955d011SMarcel Moolenaar.Sh ENVIRONMENT 20773955d011SMarcel Moolenaar.Nm 20783955d011SMarcel Moolenaaruses the following environment variables, if they exist: 20793955d011SMarcel Moolenaar.Ev MACHINE , 20803955d011SMarcel Moolenaar.Ev MACHINE_ARCH , 20813955d011SMarcel Moolenaar.Ev MAKE , 20823955d011SMarcel Moolenaar.Ev MAKEFLAGS , 20833955d011SMarcel Moolenaar.Ev MAKEOBJDIR , 20843955d011SMarcel Moolenaar.Ev MAKEOBJDIRPREFIX , 20853955d011SMarcel Moolenaar.Ev MAKESYSPATH , 20863955d011SMarcel Moolenaar.Ev PWD , 20873955d011SMarcel Moolenaarand 20883955d011SMarcel Moolenaar.Ev TMPDIR . 20893955d011SMarcel Moolenaar.Pp 20903955d011SMarcel Moolenaar.Ev MAKEOBJDIRPREFIX 20913955d011SMarcel Moolenaarand 20923955d011SMarcel Moolenaar.Ev MAKEOBJDIR 20933955d011SMarcel Moolenaarmay only be set in the environment or on the command line to 20943955d011SMarcel Moolenaar.Nm 20953955d011SMarcel Moolenaarand not as makefile variables; 20963955d011SMarcel Moolenaarsee the description of 20973955d011SMarcel Moolenaar.Ql Va .OBJDIR 20983955d011SMarcel Moolenaarfor more details. 20993955d011SMarcel Moolenaar.Sh FILES 21003955d011SMarcel Moolenaar.Bl -tag -width /usr/share/mk -compact 21013955d011SMarcel Moolenaar.It .depend 21023955d011SMarcel Moolenaarlist of dependencies 21033955d011SMarcel Moolenaar.It Makefile 21043955d011SMarcel Moolenaarlist of dependencies 21053955d011SMarcel Moolenaar.It makefile 21063955d011SMarcel Moolenaarlist of dependencies 21073955d011SMarcel Moolenaar.It sys.mk 21083955d011SMarcel Moolenaarsystem makefile 21093955d011SMarcel Moolenaar.It /usr/share/mk 21103955d011SMarcel Moolenaarsystem makefile directory 21113955d011SMarcel Moolenaar.El 21123955d011SMarcel Moolenaar.Sh COMPATIBILITY 21133955d011SMarcel MoolenaarThe basic make syntax is compatible between different versions of make, 21143955d011SMarcel Moolenaarhowever the special variables, variable modifiers and conditionals are not. 21153955d011SMarcel Moolenaar.Pp 21163955d011SMarcel MoolenaarThe way that parallel makes are scheduled changed in 21173955d011SMarcel Moolenaar.Nx 4.0 21183955d011SMarcel Moolenaarso that .ORDER and .WAIT apply recursively to the dependent nodes. 21193955d011SMarcel MoolenaarThe algorithms used may change again in the future. 21203955d011SMarcel Moolenaar.Pp 21213955d011SMarcel MoolenaarThe way that .for loop variables are substituted changed after 21223955d011SMarcel Moolenaar.Nx 5.0 21233955d011SMarcel Moolenaarso that they still appear to be variable expansions. 21243955d011SMarcel MoolenaarIn particular this stops them being treated as syntax, and removes some 21253955d011SMarcel Moolenaarobscure problems using them in .if statements. 21263955d011SMarcel Moolenaar.Sh SEE ALSO 21273955d011SMarcel Moolenaar.Xr mkdep 1 21283955d011SMarcel Moolenaar.Sh HISTORY 21293955d011SMarcel MoolenaarA 21303955d011SMarcel Moolenaar.Nm 21313955d011SMarcel Moolenaarcommand appeared in 21323955d011SMarcel Moolenaar.At v7 . 21333955d011SMarcel MoolenaarThis 21343955d011SMarcel Moolenaar.Nm 21353955d011SMarcel Moolenaarimplementation is based on Adam De Boor's pmake program which was written 213693036677SSimon J. Gerratyfor Sprite at Berkeley. 21373955d011SMarcel MoolenaarIt was designed to be a parallel distributed make running jobs on different 21383955d011SMarcel Moolenaarmachines using a daemon called 21393955d011SMarcel Moolenaar.Dq customs . 214074d2e02bSSimon J. Gerraty.Pp 214174d2e02bSSimon J. GerratyHistorically the target/dependency 214274d2e02bSSimon J. Gerraty.Dq FRC 214374d2e02bSSimon J. Gerratyhas been used to FoRCe rebuilding (since the target/dependency 214474d2e02bSSimon J. Gerratydoes not exist... unless someone creates an 214574d2e02bSSimon J. Gerraty.Dq FRC 214674d2e02bSSimon J. Gerratyfile). 21473955d011SMarcel Moolenaar.Sh BUGS 21483955d011SMarcel MoolenaarThe 21493955d011SMarcel Moolenaar.Nm 21503955d011SMarcel Moolenaarsyntax is difficult to parse without actually acting of the data. 21513955d011SMarcel MoolenaarFor instance finding the end of a variable use should involve scanning each 21523955d011SMarcel Moolenaarthe modifiers using the correct terminator for each field. 21533955d011SMarcel MoolenaarIn many places 21543955d011SMarcel Moolenaar.Nm 21553955d011SMarcel Moolenaarjust counts {} and () in order to find the end of a variable expansion. 21563955d011SMarcel Moolenaar.Pp 21573955d011SMarcel MoolenaarThere is no way of escaping a space character in a filename. 2158