xref: /freebsd/contrib/bmake/make.1 (revision 954401e68e797868ab04a0147b94849feefbb199)
1*954401e6SSimon J. Gerraty.\"	$NetBSD: make.1,v 1.315 2022/07/12 23:47:00 rillig Exp $
23955d011SMarcel Moolenaar.\"
33955d011SMarcel Moolenaar.\" Copyright (c) 1990, 1993
43955d011SMarcel Moolenaar.\"	The Regents of the University of California.  All rights reserved.
53955d011SMarcel Moolenaar.\"
63955d011SMarcel Moolenaar.\" Redistribution and use in source and binary forms, with or without
73955d011SMarcel Moolenaar.\" modification, are permitted provided that the following conditions
83955d011SMarcel Moolenaar.\" are met:
93955d011SMarcel Moolenaar.\" 1. Redistributions of source code must retain the above copyright
103955d011SMarcel Moolenaar.\"    notice, this list of conditions and the following disclaimer.
113955d011SMarcel Moolenaar.\" 2. Redistributions in binary form must reproduce the above copyright
123955d011SMarcel Moolenaar.\"    notice, this list of conditions and the following disclaimer in the
133955d011SMarcel Moolenaar.\"    documentation and/or other materials provided with the distribution.
143955d011SMarcel Moolenaar.\" 3. Neither the name of the University nor the names of its contributors
153955d011SMarcel Moolenaar.\"    may be used to endorse or promote products derived from this software
163955d011SMarcel Moolenaar.\"    without specific prior written permission.
173955d011SMarcel Moolenaar.\"
183955d011SMarcel Moolenaar.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
193955d011SMarcel Moolenaar.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
203955d011SMarcel Moolenaar.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
213955d011SMarcel Moolenaar.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
223955d011SMarcel Moolenaar.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
233955d011SMarcel Moolenaar.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
243955d011SMarcel Moolenaar.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
253955d011SMarcel Moolenaar.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
263955d011SMarcel Moolenaar.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
273955d011SMarcel Moolenaar.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
283955d011SMarcel Moolenaar.\" SUCH DAMAGE.
293955d011SMarcel Moolenaar.\"
303955d011SMarcel Moolenaar.\"	from: @(#)make.1	8.4 (Berkeley) 3/19/94
313955d011SMarcel Moolenaar.\"
32*954401e6SSimon J. Gerraty.Dd July 12, 2022
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
40e2eeea75SSimon J. Gerraty.Op Fl BeikNnqrSstWwX
413955d011SMarcel Moolenaar.Op Fl C Ar directory
423955d011SMarcel Moolenaar.Op Fl D Ar variable
433955d011SMarcel Moolenaar.Op Fl d Ar flags
443955d011SMarcel Moolenaar.Op Fl f Ar makefile
453955d011SMarcel Moolenaar.Op Fl I Ar directory
463955d011SMarcel Moolenaar.Op Fl J Ar private
473955d011SMarcel Moolenaar.Op Fl j Ar max_jobs
483955d011SMarcel Moolenaar.Op Fl m Ar directory
493955d011SMarcel Moolenaar.Op Fl T Ar file
503955d011SMarcel Moolenaar.Op Fl V Ar variable
518695518cSSimon J. Gerraty.Op Fl v Ar variable
523955d011SMarcel Moolenaar.Op Ar variable=value
533955d011SMarcel Moolenaar.Op Ar target ...
543955d011SMarcel Moolenaar.Sh DESCRIPTION
553955d011SMarcel Moolenaar.Nm
563955d011SMarcel Moolenaaris a program designed to simplify the maintenance of other programs.
573955d011SMarcel MoolenaarIts input is a list of specifications as to the files upon which programs
583955d011SMarcel Moolenaarand other files depend.
593955d011SMarcel MoolenaarIf no
603955d011SMarcel Moolenaar.Fl f Ar makefile
613955d011SMarcel Moolenaarmakefile option is given,
623955d011SMarcel Moolenaar.Nm
633955d011SMarcel Moolenaarwill try to open
64*954401e6SSimon J. Gerraty.Sq Pa makefile
653955d011SMarcel Moolenaarthen
66*954401e6SSimon J. Gerraty.Sq Pa Makefile
673955d011SMarcel Moolenaarin order to find the specifications.
683955d011SMarcel MoolenaarIf the file
69*954401e6SSimon J. Gerraty.Sq Pa .depend
703955d011SMarcel Moolenaarexists, it is read (see
713955d011SMarcel Moolenaar.Xr mkdep 1 ) .
723955d011SMarcel Moolenaar.Pp
733955d011SMarcel MoolenaarThis manual page is intended as a reference document only.
743955d011SMarcel MoolenaarFor a more thorough description of
753955d011SMarcel Moolenaar.Nm
763955d011SMarcel Moolenaarand makefiles, please refer to
773955d011SMarcel Moolenaar.%T "PMake \- A Tutorial" .
783955d011SMarcel Moolenaar.Pp
793955d011SMarcel Moolenaar.Nm
803955d011SMarcel Moolenaarwill prepend the contents of the
813955d011SMarcel Moolenaar.Va MAKEFLAGS
823955d011SMarcel Moolenaarenvironment variable to the command line arguments before parsing them.
833955d011SMarcel Moolenaar.Pp
843955d011SMarcel MoolenaarThe options are as follows:
853955d011SMarcel Moolenaar.Bl -tag -width Ds
863955d011SMarcel Moolenaar.It Fl B
873955d011SMarcel MoolenaarTry to be backwards compatible by executing a single shell per command and
883955d011SMarcel Moolenaarby executing the commands to make the sources of a dependency line in sequence.
893955d011SMarcel Moolenaar.It Fl C Ar directory
903955d011SMarcel MoolenaarChange to
913955d011SMarcel Moolenaar.Ar directory
923955d011SMarcel Moolenaarbefore reading the makefiles or doing anything else.
933955d011SMarcel MoolenaarIf multiple
943955d011SMarcel Moolenaar.Fl C
953955d011SMarcel Moolenaaroptions are specified, each is interpreted relative to the previous one:
963955d011SMarcel Moolenaar.Fl C Pa / Fl C Pa etc
973955d011SMarcel Moolenaaris equivalent to
983955d011SMarcel Moolenaar.Fl C Pa /etc .
993955d011SMarcel Moolenaar.It Fl D Ar variable
1003955d011SMarcel MoolenaarDefine
1013955d011SMarcel Moolenaar.Ar variable
102dba7b0efSSimon J. Gerratyto be 1, in the global scope.
1033955d011SMarcel Moolenaar.It Fl d Ar [-]flags
1043955d011SMarcel MoolenaarTurn on debugging, and specify which portions of
1053955d011SMarcel Moolenaar.Nm
1063955d011SMarcel Moolenaarare to print debugging information.
1073955d011SMarcel MoolenaarUnless the flags are preceded by
1083955d011SMarcel Moolenaar.Ql \-
1093955d011SMarcel Moolenaarthey are added to the
1103955d011SMarcel Moolenaar.Va MAKEFLAGS
1113955d011SMarcel Moolenaarenvironment variable and will be processed by any child make processes.
1123955d011SMarcel MoolenaarBy default, debugging information is printed to standard error,
1133955d011SMarcel Moolenaarbut this can be changed using the
1143955d011SMarcel Moolenaar.Ar F
1153955d011SMarcel Moolenaardebugging flag.
1163955d011SMarcel MoolenaarThe debugging output is always unbuffered; in addition, if debugging
1173955d011SMarcel Moolenaaris enabled but debugging output is not directed to standard output,
1183955d011SMarcel Moolenaarthen the standard output is line buffered.
1193955d011SMarcel Moolenaar.Ar Flags
1203955d011SMarcel Moolenaaris one or more of the following:
1213955d011SMarcel Moolenaar.Bl -tag -width Ds
1223955d011SMarcel Moolenaar.It Ar A
1233955d011SMarcel MoolenaarPrint all possible debugging information;
1243955d011SMarcel Moolenaarequivalent to specifying all of the debugging flags.
1253955d011SMarcel Moolenaar.It Ar a
1263955d011SMarcel MoolenaarPrint debugging information about archive searching and caching.
1273955d011SMarcel Moolenaar.It Ar C
1283955d011SMarcel MoolenaarPrint debugging information about current working directory.
1293955d011SMarcel Moolenaar.It Ar c
1303955d011SMarcel MoolenaarPrint debugging information about conditional evaluation.
1313955d011SMarcel Moolenaar.It Ar d
1323955d011SMarcel MoolenaarPrint debugging information about directory searching and caching.
1333955d011SMarcel Moolenaar.It Ar e
1343955d011SMarcel MoolenaarPrint debugging information about failed commands and targets.
1353955d011SMarcel Moolenaar.It Ar F Ns Oo Sy \&+ Oc Ns Ar filename
1363955d011SMarcel MoolenaarSpecify where debugging output is written.
1373955d011SMarcel MoolenaarThis must be the last flag, because it consumes the remainder of
1383955d011SMarcel Moolenaarthe argument.
1393955d011SMarcel MoolenaarIf the character immediately after the
1403955d011SMarcel Moolenaar.Ql F
1413955d011SMarcel Moolenaarflag is
1423955d011SMarcel Moolenaar.Ql \&+ ,
1433955d011SMarcel Moolenaarthen the file will be opened in append mode;
1443955d011SMarcel Moolenaarotherwise the file will be overwritten.
1453955d011SMarcel MoolenaarIf the file name is
1463955d011SMarcel Moolenaar.Ql stdout
1473955d011SMarcel Moolenaaror
1483955d011SMarcel Moolenaar.Ql stderr
1493955d011SMarcel Moolenaarthen debugging output will be written to the
1503955d011SMarcel Moolenaarstandard output or standard error output file descriptors respectively
1513955d011SMarcel Moolenaar(and the
1523955d011SMarcel Moolenaar.Ql \&+
1533955d011SMarcel Moolenaaroption has no effect).
1543955d011SMarcel MoolenaarOtherwise, the output will be written to the named file.
1553955d011SMarcel MoolenaarIf the file name ends
1563955d011SMarcel Moolenaar.Ql .%d
1573955d011SMarcel Moolenaarthen the
1583955d011SMarcel Moolenaar.Ql %d
1593955d011SMarcel Moolenaaris replaced by the pid.
1603955d011SMarcel Moolenaar.It Ar f
1613955d011SMarcel MoolenaarPrint debugging information about loop evaluation.
1623955d011SMarcel Moolenaar.It Ar "g1"
1633955d011SMarcel MoolenaarPrint the input graph before making anything.
1643955d011SMarcel Moolenaar.It Ar "g2"
1653955d011SMarcel MoolenaarPrint the input graph after making everything, or before exiting
1663955d011SMarcel Moolenaaron error.
1673955d011SMarcel Moolenaar.It Ar "g3"
1683955d011SMarcel MoolenaarPrint the input graph before exiting on error.
1692c3632d1SSimon J. Gerraty.It Ar h
1702c3632d1SSimon J. GerratyPrint debugging information about hash table operations.
1713955d011SMarcel Moolenaar.It Ar j
1723955d011SMarcel MoolenaarPrint debugging information about running multiple shells.
1732c3632d1SSimon J. Gerraty.It Ar L
1742c3632d1SSimon J. GerratyTurn on lint checks.
1752c3632d1SSimon J. GerratyThis will throw errors for variable assignments that do not parse
1762c3632d1SSimon J. Gerratycorrectly, at the time of assignment so the file and line number
1772c3632d1SSimon J. Gerratyare available.
1783955d011SMarcel Moolenaar.It Ar l
1793955d011SMarcel MoolenaarPrint commands in Makefiles regardless of whether or not they are prefixed by
1803955d011SMarcel Moolenaar.Ql @
1813955d011SMarcel Moolenaaror other "quiet" flags.
1823955d011SMarcel MoolenaarAlso known as "loud" behavior.
1833955d011SMarcel Moolenaar.It Ar M
1843955d011SMarcel MoolenaarPrint debugging information about "meta" mode decisions about targets.
1853955d011SMarcel Moolenaar.It Ar m
1863955d011SMarcel MoolenaarPrint debugging information about making targets, including modification
1873955d011SMarcel Moolenaardates.
1883955d011SMarcel Moolenaar.It Ar n
1893955d011SMarcel MoolenaarDon't delete the temporary command scripts created when running commands.
1903955d011SMarcel MoolenaarThese temporary scripts are created in the directory
1913955d011SMarcel Moolenaarreferred to by the
1923955d011SMarcel Moolenaar.Ev TMPDIR
1933955d011SMarcel Moolenaarenvironment variable, or in
1943955d011SMarcel Moolenaar.Pa /tmp
1953955d011SMarcel Moolenaarif
1963955d011SMarcel Moolenaar.Ev TMPDIR
1973955d011SMarcel Moolenaaris unset or set to the empty string.
1983955d011SMarcel MoolenaarThe temporary scripts are created by
1993955d011SMarcel Moolenaar.Xr mkstemp 3 ,
2003955d011SMarcel Moolenaarand have names of the form
2013955d011SMarcel Moolenaar.Pa makeXXXXXX .
2023955d011SMarcel Moolenaar.Em NOTE :
2033955d011SMarcel MoolenaarThis can create many files in
2043955d011SMarcel Moolenaar.Ev TMPDIR
2053955d011SMarcel Moolenaaror
2063955d011SMarcel Moolenaar.Pa /tmp ,
2073955d011SMarcel Moolenaarso use with care.
2083955d011SMarcel Moolenaar.It Ar p
2093955d011SMarcel MoolenaarPrint debugging information about makefile parsing.
2103955d011SMarcel Moolenaar.It Ar s
2113955d011SMarcel MoolenaarPrint debugging information about suffix-transformation rules.
2123955d011SMarcel Moolenaar.It Ar t
2133955d011SMarcel MoolenaarPrint debugging information about target list maintenance.
2143955d011SMarcel Moolenaar.It Ar V
2153955d011SMarcel MoolenaarForce the
2163955d011SMarcel Moolenaar.Fl V
2178695518cSSimon J. Gerratyoption to print raw values of variables, overriding the default behavior
2188695518cSSimon J. Gerratyset via
2198695518cSSimon J. Gerraty.Va .MAKE.EXPAND_VARIABLES .
2203955d011SMarcel Moolenaar.It Ar v
2213955d011SMarcel MoolenaarPrint debugging information about variable assignment.
2223955d011SMarcel Moolenaar.It Ar x
2233955d011SMarcel MoolenaarRun shell commands with
2243955d011SMarcel Moolenaar.Fl x
2253955d011SMarcel Moolenaarso the actual commands are printed as they are executed.
2263955d011SMarcel Moolenaar.El
2273955d011SMarcel Moolenaar.It Fl e
2283955d011SMarcel MoolenaarSpecify that environment variables override macro assignments within
2293955d011SMarcel Moolenaarmakefiles.
2303955d011SMarcel Moolenaar.It Fl f Ar makefile
2313955d011SMarcel MoolenaarSpecify a makefile to read instead of the default
232*954401e6SSimon J. Gerraty.Sq Pa makefile .
2333955d011SMarcel MoolenaarIf
2343955d011SMarcel Moolenaar.Ar makefile
2353955d011SMarcel Moolenaaris
236*954401e6SSimon J. Gerraty.Sq Fl ,
2373955d011SMarcel Moolenaarstandard input is read.
2383955d011SMarcel MoolenaarMultiple makefiles may be specified, and are read in the order specified.
2393955d011SMarcel Moolenaar.It Fl I Ar directory
2403955d011SMarcel MoolenaarSpecify a directory in which to search for makefiles and included makefiles.
2413955d011SMarcel MoolenaarThe system makefile directory (or directories, see the
2423955d011SMarcel Moolenaar.Fl m
2433955d011SMarcel Moolenaaroption) is automatically included as part of this list.
2443955d011SMarcel Moolenaar.It Fl i
2453955d011SMarcel MoolenaarIgnore non-zero exit of shell commands in the makefile.
2463955d011SMarcel MoolenaarEquivalent to specifying
247*954401e6SSimon J. Gerraty.Sq Fl
2483955d011SMarcel Moolenaarbefore each command line in the makefile.
2493955d011SMarcel Moolenaar.It Fl J Ar private
2503955d011SMarcel MoolenaarThis option should
2513955d011SMarcel Moolenaar.Em not
2523955d011SMarcel Moolenaarbe specified by the user.
2533955d011SMarcel Moolenaar.Pp
2543955d011SMarcel MoolenaarWhen the
255*954401e6SSimon J. Gerraty.Fl j
2563955d011SMarcel Moolenaaroption is in use in a recursive build, this option is passed by a make
2573955d011SMarcel Moolenaarto child makes to allow all the make processes in the build to
2583955d011SMarcel Moolenaarcooperate to avoid overloading the system.
2593955d011SMarcel Moolenaar.It Fl j Ar max_jobs
2603955d011SMarcel MoolenaarSpecify the maximum number of jobs that
2613955d011SMarcel Moolenaar.Nm
2623955d011SMarcel Moolenaarmay have running at any one time.
2633955d011SMarcel MoolenaarThe value is saved in
2643955d011SMarcel Moolenaar.Va .MAKE.JOBS .
2653955d011SMarcel MoolenaarTurns compatibility mode off, unless the
266*954401e6SSimon J. Gerraty.Fl B
267*954401e6SSimon J. Gerratyoption is also specified.
2683955d011SMarcel MoolenaarWhen compatibility mode is off, all commands associated with a
2693955d011SMarcel Moolenaartarget are executed in a single shell invocation as opposed to the
2703955d011SMarcel Moolenaartraditional one shell invocation per line.
2713955d011SMarcel MoolenaarThis can break traditional scripts which change directories on each
2723955d011SMarcel Moolenaarcommand invocation and then expect to start with a fresh environment
2733955d011SMarcel Moolenaaron the next line.
2743955d011SMarcel MoolenaarIt is more efficient to correct the scripts rather than turn backwards
2753955d011SMarcel Moolenaarcompatibility on.
2763955d011SMarcel Moolenaar.It Fl k
2773955d011SMarcel MoolenaarContinue processing after errors are encountered, but only on those targets
2783955d011SMarcel Moolenaarthat do not depend on the target whose creation caused the error.
2793955d011SMarcel Moolenaar.It Fl m Ar directory
2803955d011SMarcel MoolenaarSpecify a directory in which to search for sys.mk and makefiles included
2813955d011SMarcel Moolenaarvia the
28249caa483SSimon J. Gerraty.Li \&< Ns Ar file Ns Li \&> Ns -style
2833955d011SMarcel Moolenaarinclude statement.
2843955d011SMarcel MoolenaarThe
2853955d011SMarcel Moolenaar.Fl m
2863955d011SMarcel Moolenaaroption can be used multiple times to form a search path.
2873955d011SMarcel MoolenaarThis path will override the default system include path: /usr/share/mk.
2883955d011SMarcel MoolenaarFurthermore the system include path will be appended to the search path used
2893955d011SMarcel Moolenaarfor
29049caa483SSimon J. Gerraty.Li \*q Ns Ar file Ns Li \*q Ns -style
2913955d011SMarcel Moolenaarinclude statements (see the
2923955d011SMarcel Moolenaar.Fl I
2933955d011SMarcel Moolenaaroption).
2943955d011SMarcel Moolenaar.Pp
2953955d011SMarcel MoolenaarIf a file or directory name in the
2963955d011SMarcel Moolenaar.Fl m
2973955d011SMarcel Moolenaarargument (or the
2983955d011SMarcel Moolenaar.Ev MAKESYSPATH
2993955d011SMarcel Moolenaarenvironment variable) starts with the string
3003955d011SMarcel Moolenaar.Qq \&.../
3013955d011SMarcel Moolenaarthen
3023955d011SMarcel Moolenaar.Nm
3033955d011SMarcel Moolenaarwill search for the specified file or directory named in the remaining part
3043955d011SMarcel Moolenaarof the argument string.
3053955d011SMarcel MoolenaarThe search starts with the current directory of
3063955d011SMarcel Moolenaarthe Makefile and then works upward towards the root of the file system.
3073955d011SMarcel MoolenaarIf the search is successful, then the resulting directory replaces the
3083955d011SMarcel Moolenaar.Qq \&.../
3093955d011SMarcel Moolenaarspecification in the
3103955d011SMarcel Moolenaar.Fl m
3113955d011SMarcel Moolenaarargument.
3123955d011SMarcel MoolenaarIf used, this feature allows
3133955d011SMarcel Moolenaar.Nm
3143955d011SMarcel Moolenaarto easily search in the current source tree for customized sys.mk files
3153955d011SMarcel Moolenaar(e.g., by using
3163955d011SMarcel Moolenaar.Qq \&.../mk/sys.mk
3173955d011SMarcel Moolenaaras an argument).
3183955d011SMarcel Moolenaar.It Fl n
3193955d011SMarcel MoolenaarDisplay the commands that would have been executed, but do not
3203955d011SMarcel Moolenaaractually execute them unless the target depends on the .MAKE special
3212c3632d1SSimon J. Gerratysource (see below) or the command is prefixed with
322*954401e6SSimon J. Gerraty.Sq Ic + .
3233955d011SMarcel Moolenaar.It Fl N
3243955d011SMarcel MoolenaarDisplay the commands which would have been executed, but do not
3253955d011SMarcel Moolenaaractually execute any of them; useful for debugging top-level makefiles
3263955d011SMarcel Moolenaarwithout descending into subdirectories.
3273955d011SMarcel Moolenaar.It Fl q
3283955d011SMarcel MoolenaarDo not execute any commands, but exit 0 if the specified targets are
3293955d011SMarcel Moolenaarup-to-date and 1, otherwise.
3303955d011SMarcel Moolenaar.It Fl r
3313955d011SMarcel MoolenaarDo not use the built-in rules specified in the system makefile.
332e2eeea75SSimon J. Gerraty.It Fl S
333e2eeea75SSimon J. GerratyStop processing if an error is encountered.
334e2eeea75SSimon J. GerratyThis is the default behavior and the opposite of
335e2eeea75SSimon J. Gerraty.Fl k .
3363955d011SMarcel Moolenaar.It Fl s
3373955d011SMarcel MoolenaarDo not echo any commands as they are executed.
3383955d011SMarcel MoolenaarEquivalent to specifying
339*954401e6SSimon J. Gerraty.Sq Ic @
3403955d011SMarcel Moolenaarbefore each command line in the makefile.
3413955d011SMarcel Moolenaar.It Fl T Ar tracefile
3423955d011SMarcel MoolenaarWhen used with the
3433955d011SMarcel Moolenaar.Fl j
3443955d011SMarcel Moolenaarflag,
3453955d011SMarcel Moolenaarappend a trace record to
3463955d011SMarcel Moolenaar.Ar tracefile
3473955d011SMarcel Moolenaarfor each job started and completed.
3483955d011SMarcel Moolenaar.It Fl t
3493955d011SMarcel MoolenaarRather than re-building a target as specified in the makefile, create it
3503955d011SMarcel Moolenaaror update its modification time to make it appear up-to-date.
3513955d011SMarcel Moolenaar.It Fl V Ar variable
3528695518cSSimon J. GerratyPrint the value of
3538695518cSSimon J. Gerraty.Ar variable .
3543955d011SMarcel MoolenaarDo not build any targets.
3553955d011SMarcel MoolenaarMultiple instances of this option may be specified;
3563955d011SMarcel Moolenaarthe variables will be printed one per line,
3573955d011SMarcel Moolenaarwith a blank line for each null or undefined variable.
358dba7b0efSSimon J. GerratyThe value printed is extracted from the global scope after all
3598695518cSSimon J. Gerratymakefiles have been read.
3608695518cSSimon J. GerratyBy default, the raw variable contents (which may
3618695518cSSimon J. Gerratyinclude additional unexpanded variable references) are shown.
3623955d011SMarcel MoolenaarIf
3633955d011SMarcel Moolenaar.Ar variable
3643955d011SMarcel Moolenaarcontains a
3653955d011SMarcel Moolenaar.Ql \&$
3668695518cSSimon J. Gerratythen the value will be recursively expanded to its complete resultant
3678695518cSSimon J. Gerratytext before printing.
3688695518cSSimon J. GerratyThe expanded value will also be printed if
3698695518cSSimon J. Gerraty.Va .MAKE.EXPAND_VARIABLES
3708695518cSSimon J. Gerratyis set to true and
3718695518cSSimon J. Gerratythe
3728695518cSSimon J. Gerraty.Fl dV
3738695518cSSimon J. Gerratyoption has not been used to override it.
3748695518cSSimon J. GerratyNote that loop-local and target-local variables, as well as values
3758695518cSSimon J. Gerratytaken temporarily by global variables during makefile processing, are
3768695518cSSimon J. Gerratynot accessible via this option.
3778695518cSSimon J. GerratyThe
3788695518cSSimon J. Gerraty.Fl dv
3798695518cSSimon J. Gerratydebug mode can be used to see these at the cost of generating
3808695518cSSimon J. Gerratysubstantial extraneous output.
3818695518cSSimon J. Gerraty.It Fl v Ar variable
3828695518cSSimon J. GerratyLike
3838695518cSSimon J. Gerraty.Fl V
3848695518cSSimon J. Gerratybut the variable is always expanded to its complete value.
3853955d011SMarcel Moolenaar.It Fl W
3863955d011SMarcel MoolenaarTreat any warnings during makefile parsing as errors.
387db29cad8SSimon J. Gerraty.It Fl w
388db29cad8SSimon J. GerratyPrint entering and leaving directory messages, pre and post processing.
3893955d011SMarcel Moolenaar.It Fl X
3903955d011SMarcel MoolenaarDon't export variables passed on the command line to the environment
3913955d011SMarcel Moolenaarindividually.
3923955d011SMarcel MoolenaarVariables passed on the command line are still exported
3933955d011SMarcel Moolenaarvia the
3943955d011SMarcel Moolenaar.Va MAKEFLAGS
3953955d011SMarcel Moolenaarenvironment variable.
3963955d011SMarcel MoolenaarThis option may be useful on systems which have a small limit on the
3973955d011SMarcel Moolenaarsize of command arguments.
3983955d011SMarcel Moolenaar.It Ar variable=value
3993955d011SMarcel MoolenaarSet the value of the variable
4003955d011SMarcel Moolenaar.Ar variable
4013955d011SMarcel Moolenaarto
4023955d011SMarcel Moolenaar.Ar value .
4033955d011SMarcel MoolenaarNormally, all values passed on the command line are also exported to
4043955d011SMarcel Moolenaarsub-makes in the environment.
4053955d011SMarcel MoolenaarThe
4063955d011SMarcel Moolenaar.Fl X
4073955d011SMarcel Moolenaarflag disables this behavior.
4083955d011SMarcel MoolenaarVariable assignments should follow options for POSIX compatibility
4093955d011SMarcel Moolenaarbut no ordering is enforced.
4103955d011SMarcel Moolenaar.El
4113955d011SMarcel Moolenaar.Pp
4123955d011SMarcel MoolenaarThere are seven different types of lines in a makefile: file dependency
4133955d011SMarcel Moolenaarspecifications, shell commands, variable assignments, include statements,
4143955d011SMarcel Moolenaarconditional directives, for loops, and comments.
4153955d011SMarcel Moolenaar.Pp
4163955d011SMarcel MoolenaarIn general, lines may be continued from one line to the next by ending
4173955d011SMarcel Moolenaarthem with a backslash
4183955d011SMarcel Moolenaar.Pq Ql \e .
4193955d011SMarcel MoolenaarThe trailing newline character and initial whitespace on the following
4203955d011SMarcel Moolenaarline are compressed into a single space.
4213955d011SMarcel Moolenaar.Sh FILE DEPENDENCY SPECIFICATIONS
4223955d011SMarcel MoolenaarDependency lines consist of one or more targets, an operator, and zero
4233955d011SMarcel Moolenaaror more sources.
4243955d011SMarcel MoolenaarThis creates a relationship where the targets
4253955d011SMarcel Moolenaar.Dq depend
4263955d011SMarcel Moolenaaron the sources
4272c3632d1SSimon J. Gerratyand are customarily created from them.
4282c3632d1SSimon J. GerratyA target is considered out-of-date if it does not exist, or if its
4292c3632d1SSimon J. Gerratymodification time is less than that of any of its sources.
4302c3632d1SSimon J. GerratyAn out-of-date target will be re-created, but not until all sources
4312c3632d1SSimon J. Gerratyhave been examined and themselves re-created as needed.
4322c3632d1SSimon J. GerratyThree operators may be used:
4333955d011SMarcel Moolenaar.Bl -tag -width flag
4343955d011SMarcel Moolenaar.It Ic \&:
4352c3632d1SSimon J. GerratyMany dependency lines may name this target but only one may have
4362c3632d1SSimon J. Gerratyattached shell commands.
4372c3632d1SSimon J. GerratyAll sources named in all dependency lines are considered together,
4382c3632d1SSimon J. Gerratyand if needed the attached shell commands are run to create or
4392c3632d1SSimon J. Gerratyre-create the target.
4402c3632d1SSimon J. GerratyIf
4413955d011SMarcel Moolenaar.Nm
4422c3632d1SSimon J. Gerratyis interrupted, the target is removed.
4433955d011SMarcel Moolenaar.It Ic \&!
4442c3632d1SSimon J. GerratyThe same, but the target is always re-created whether or not it is out
4452c3632d1SSimon J. Gerratyof date.
4463955d011SMarcel Moolenaar.It Ic \&::
4472c3632d1SSimon J. GerratyAny dependency line may have attached shell commands, but each one
4482c3632d1SSimon J. Gerratyis handled independently: its sources are considered and the attached
4492c3632d1SSimon J. Gerratyshell commands are run if the target is out of date with respect to
4502c3632d1SSimon J. Gerraty(only) those sources.
4512c3632d1SSimon J. GerratyThus, different groups of the attached shell commands may be run
4522c3632d1SSimon J. Gerratydepending on the circumstances.
4532c3632d1SSimon J. GerratyFurthermore, unlike
4542c3632d1SSimon J. Gerraty.Ic \&:,
4552c3632d1SSimon J. Gerratyfor dependency lines with no sources, the attached shell
4562c3632d1SSimon J. Gerratycommands are always run.
4572c3632d1SSimon J. GerratyAlso unlike
4582c3632d1SSimon J. Gerraty.Ic \&:,
4592c3632d1SSimon J. Gerratythe target will not be removed if
4603955d011SMarcel Moolenaar.Nm
4613955d011SMarcel Moolenaaris interrupted.
4623955d011SMarcel Moolenaar.El
4632c3632d1SSimon J. GerratyAll dependency lines mentioning a particular target must use the same
4642c3632d1SSimon J. Gerratyoperator.
4653955d011SMarcel Moolenaar.Pp
4663955d011SMarcel MoolenaarTargets and sources may contain the shell wildcard values
4673955d011SMarcel Moolenaar.Ql \&? ,
4683955d011SMarcel Moolenaar.Ql * ,
4693955d011SMarcel Moolenaar.Ql [] ,
4703955d011SMarcel Moolenaarand
4713955d011SMarcel Moolenaar.Ql {} .
4723955d011SMarcel MoolenaarThe values
4733955d011SMarcel Moolenaar.Ql \&? ,
4743955d011SMarcel Moolenaar.Ql * ,
4753955d011SMarcel Moolenaarand
4763955d011SMarcel Moolenaar.Ql []
4773955d011SMarcel Moolenaarmay only be used as part of the final
4783955d011SMarcel Moolenaarcomponent of the target or source, and must be used to describe existing
4793955d011SMarcel Moolenaarfiles.
4803955d011SMarcel MoolenaarThe value
4813955d011SMarcel Moolenaar.Ql {}
4823955d011SMarcel Moolenaarneed not necessarily be used to describe existing files.
4833955d011SMarcel MoolenaarExpansion is in directory order, not alphabetically as done in the shell.
4843955d011SMarcel Moolenaar.Sh SHELL COMMANDS
485db29cad8SSimon J. GerratyEach target may have associated with it one or more lines of shell
486db29cad8SSimon J. Gerratycommands, normally
4873955d011SMarcel Moolenaarused to create the target.
488db29cad8SSimon J. GerratyEach of the lines in this script
4893955d011SMarcel Moolenaar.Em must
4903955d011SMarcel Moolenaarbe preceded by a tab.
491db29cad8SSimon J. Gerraty(For historical reasons, spaces are not accepted.)
492db29cad8SSimon J. GerratyWhile targets can appear in many dependency lines if desired, by
493db29cad8SSimon J. Gerratydefault only one of these rules may be followed by a creation
494db29cad8SSimon J. Gerratyscript.
495db29cad8SSimon J. GerratyIf the
496*954401e6SSimon J. Gerraty.Sq Ic \&::
497db29cad8SSimon J. Gerratyoperator is used, however, all rules may include scripts and the
498db29cad8SSimon J. Gerratyscripts are executed in the order found.
4993955d011SMarcel Moolenaar.Pp
500db29cad8SSimon J. GerratyEach line is treated as a separate shell command, unless the end of
501db29cad8SSimon J. Gerratyline is escaped with a backslash
502db29cad8SSimon J. Gerraty.Pq Ql \e
503db29cad8SSimon J. Gerratyin which case that line and the next are combined.
504db29cad8SSimon J. Gerraty.\" The escaped newline is retained and passed to the shell, which
505db29cad8SSimon J. Gerraty.\" normally ignores it.
506db29cad8SSimon J. Gerraty.\" However, the tab at the beginning of the following line is removed.
507db29cad8SSimon J. GerratyIf the first characters of the command are any combination of
508*954401e6SSimon J. Gerraty.Sq Ic @ ,
509*954401e6SSimon J. Gerraty.Sq Ic + ,
5103955d011SMarcel Moolenaaror
511*954401e6SSimon J. Gerraty.Sq Ic \- ,
5123955d011SMarcel Moolenaarthe command is treated specially.
5133955d011SMarcel MoolenaarA
514*954401e6SSimon J. Gerraty.Sq Ic @
5153955d011SMarcel Moolenaarcauses the command not to be echoed before it is executed.
5163955d011SMarcel MoolenaarA
517*954401e6SSimon J. Gerraty.Sq Ic +
5183955d011SMarcel Moolenaarcauses the command to be executed even when
5193955d011SMarcel Moolenaar.Fl n
5203955d011SMarcel Moolenaaris given.
5213955d011SMarcel MoolenaarThis is similar to the effect of the .MAKE special source,
5223955d011SMarcel Moolenaarexcept that the effect can be limited to a single line of a script.
5233955d011SMarcel MoolenaarA
524*954401e6SSimon J. Gerraty.Sq Ic \-
525db29cad8SSimon J. Gerratyin compatibility mode
5263955d011SMarcel Moolenaarcauses any non-zero exit status of the command line to be ignored.
5273cbdda60SSimon J. Gerraty.Pp
5283cbdda60SSimon J. GerratyWhen
5293cbdda60SSimon J. Gerraty.Nm
5303cbdda60SSimon J. Gerratyis run in jobs mode with
5313cbdda60SSimon J. Gerraty.Fl j Ar max_jobs ,
5323cbdda60SSimon J. Gerratythe entire script for the target is fed to a
5333cbdda60SSimon J. Gerratysingle instance of the shell.
5343cbdda60SSimon J. GerratyIn compatibility (non-jobs) mode, each command is run in a separate process.
5353cbdda60SSimon J. GerratyIf the command contains any shell meta characters
5363cbdda60SSimon J. Gerraty.Pq Ql #=|^(){};&<>*?[]:$`\e\en
537db29cad8SSimon J. Gerratyit will be passed to the shell; otherwise
5383cbdda60SSimon J. Gerraty.Nm
5393cbdda60SSimon J. Gerratywill attempt direct execution.
540db29cad8SSimon J. GerratyIf a line starts with
541*954401e6SSimon J. Gerraty.Sq Ic \-
542db29cad8SSimon J. Gerratyand the shell has ErrCtl enabled then failure of the command line
543db29cad8SSimon J. Gerratywill be ignored as in compatibility mode.
544db29cad8SSimon J. GerratyOtherwise
545*954401e6SSimon J. Gerraty.Sq Ic \-
546db29cad8SSimon J. Gerratyaffects the entire job;
547db29cad8SSimon J. Gerratythe script will stop at the first command line that fails,
548db29cad8SSimon J. Gerratybut the target will not be deemed to have failed.
549db29cad8SSimon J. Gerraty.Pp
550db29cad8SSimon J. GerratyMakefiles should be written so that the mode of
551db29cad8SSimon J. Gerraty.Nm
552db29cad8SSimon J. Gerratyoperation does not change their behavior.
553db29cad8SSimon J. GerratyFor example, any command which needs to use
554db29cad8SSimon J. Gerraty.Dq cd
555db29cad8SSimon J. Gerratyor
556db29cad8SSimon J. Gerraty.Dq chdir
557db29cad8SSimon J. Gerratywithout potentially changing the directory for subsequent commands
558db29cad8SSimon J. Gerratyshould be put in parentheses so it executes in a subshell.
559db29cad8SSimon J. GerratyTo force the use of one shell, escape the line breaks so as to make
560db29cad8SSimon J. Gerratythe whole script one command.
561db29cad8SSimon J. GerratyFor example:
562db29cad8SSimon J. Gerraty.Bd -literal -offset indent
563db29cad8SSimon J. Gerratyavoid-chdir-side-effects:
564db29cad8SSimon J. Gerraty	@echo Building $@ in `pwd`
565db29cad8SSimon J. Gerraty	@(cd ${.CURDIR} && ${MAKE} $@)
566db29cad8SSimon J. Gerraty	@echo Back in `pwd`
567db29cad8SSimon J. Gerraty
568db29cad8SSimon J. Gerratyensure-one-shell-regardless-of-mode:
569db29cad8SSimon J. Gerraty	@echo Building $@ in `pwd`; \e
570db29cad8SSimon J. Gerraty	(cd ${.CURDIR} && ${MAKE} $@); \e
571db29cad8SSimon J. Gerraty	echo Back in `pwd`
572db29cad8SSimon J. Gerraty.Ed
5733cbdda60SSimon J. Gerraty.Pp
5743cbdda60SSimon J. GerratySince
5753cbdda60SSimon J. Gerraty.Nm
5763cbdda60SSimon J. Gerratywill
5773cbdda60SSimon J. Gerraty.Xr chdir 2
5783cbdda60SSimon J. Gerratyto
579*954401e6SSimon J. Gerraty.Sq Va .OBJDIR
5803cbdda60SSimon J. Gerratybefore executing any targets, each child process
5813cbdda60SSimon J. Gerratystarts with that as its current working directory.
5823955d011SMarcel Moolenaar.Sh VARIABLE ASSIGNMENTS
583*954401e6SSimon J. GerratyVariables in make behave much like macros in the C preprocessor.
584*954401e6SSimon J. Gerraty.Pp
585*954401e6SSimon J. GerratyVariable assignments have the form
586*954401e6SSimon J. Gerraty.Sq Ar NAME Ar op Ar value ,
587*954401e6SSimon J. Gerratywhere:
588*954401e6SSimon J. Gerraty.Bl -tag -width Ds
589*954401e6SSimon J. Gerraty.It Ar NAME
590*954401e6SSimon J. Gerratyis a single-word variable name,
591*954401e6SSimon J. Gerratyconsisting, by tradition, of all upper-case letters,
592*954401e6SSimon J. Gerraty.It Ar op
593*954401e6SSimon J. Gerratyis one of the five variable assignment operators described below, and
594*954401e6SSimon J. Gerraty.It Ar value
595*954401e6SSimon J. Gerratyis interpreted according to the variable assignment operator.
596*954401e6SSimon J. Gerraty.El
597*954401e6SSimon J. Gerraty.Pp
598*954401e6SSimon J. GerratyWhitespace around
599*954401e6SSimon J. Gerraty.Ar NAME ,
600*954401e6SSimon J. Gerraty.Ar op
601*954401e6SSimon J. Gerratyand
602*954401e6SSimon J. Gerraty.Ar value
603*954401e6SSimon J. Gerratyis discarded.
604*954401e6SSimon J. Gerraty.Ss Variable assignment operators
605*954401e6SSimon J. GerratyThe five operators that can be used to assign values to variables are:
6063955d011SMarcel Moolenaar.Bl -tag -width Ds
6073955d011SMarcel Moolenaar.It Ic \&=
6083955d011SMarcel MoolenaarAssign the value to the variable.
609*954401e6SSimon J. GerratyAny previous value is overwritten.
6103955d011SMarcel Moolenaar.It Ic \&+=
611*954401e6SSimon J. GerratyAppend the value to the current value of the variable,
612*954401e6SSimon J. Gerratyseparating them by a single space.
6133955d011SMarcel Moolenaar.It Ic \&?=
6143955d011SMarcel MoolenaarAssign the value to the variable if it is not already defined.
6153955d011SMarcel Moolenaar.It Ic \&:=
6163955d011SMarcel MoolenaarAssign with expansion, i.e. expand the value before assigning it
6173955d011SMarcel Moolenaarto the variable.
6183955d011SMarcel MoolenaarNormally, expansion is not done until the variable is referenced.
619*954401e6SSimon J. Gerraty.Pp
6203955d011SMarcel Moolenaar.Em NOTE :
6213955d011SMarcel MoolenaarReferences to undefined variables are
6223955d011SMarcel Moolenaar.Em not
6233955d011SMarcel Moolenaarexpanded.
6243955d011SMarcel MoolenaarThis can cause problems when variable modifiers are used.
6253955d011SMarcel Moolenaar.It Ic \&!=
6263955d011SMarcel MoolenaarExpand the value and pass it to the shell for execution and assign
6273955d011SMarcel Moolenaarthe result to the variable.
6283955d011SMarcel MoolenaarAny newlines in the result are replaced with spaces.
6293955d011SMarcel Moolenaar.El
630*954401e6SSimon J. Gerraty.Ss Expansion of variables
631*954401e6SSimon J. GerratyIn contexts where variables are expanded,
632*954401e6SSimon J. Gerraty.Ql \&$$
633*954401e6SSimon J. Gerratyexpands to a single dollar sign.
634*954401e6SSimon J. GerratyReferences to variables have the form
635*954401e6SSimon J. Gerraty.Ql \&${ Ns Ar name Ns Oo \&: Ns Ar modifiers Oc Ns }
636*954401e6SSimon J. Gerratyor
637*954401e6SSimon J. Gerraty.Ql \&$( Ns Ar name Ns Oo \&: Ns Ar modifiers Oc Ns ) .
638*954401e6SSimon J. GerratyIf the variable name contains only a single character,
639*954401e6SSimon J. Gerratythe surrounding curly braces or parentheses are not required.
6403955d011SMarcel MoolenaarThis shorter form is not recommended.
6413955d011SMarcel Moolenaar.Pp
6423955d011SMarcel MoolenaarIf the variable name contains a dollar, then the name itself is expanded first.
6433955d011SMarcel MoolenaarThis allows almost arbitrary variable names, however names containing dollar,
644*954401e6SSimon J. Gerratybraces, parentheses, or whitespace are really best avoided.
6453955d011SMarcel Moolenaar.Pp
6463955d011SMarcel MoolenaarIf the result of expanding a variable contains a dollar sign
647*954401e6SSimon J. Gerraty.Pq Ql \&$ ,
6483955d011SMarcel Moolenaarthe string is expanded again.
6493955d011SMarcel Moolenaar.Pp
650*954401e6SSimon J. GerratyVariable substitution occurs at four distinct times, depending on where
6513955d011SMarcel Moolenaarthe variable is being used.
6523955d011SMarcel Moolenaar.Bl -enum
6533955d011SMarcel Moolenaar.It
6543955d011SMarcel MoolenaarVariables in dependency lines are expanded as the line is read.
6553955d011SMarcel Moolenaar.It
656*954401e6SSimon J. GerratyVariables in conditionals are expanded individually,
657*954401e6SSimon J. Gerratybut only as far as necessary to determine the result of the conditional.
658*954401e6SSimon J. Gerraty.It
6593955d011SMarcel MoolenaarVariables in shell commands are expanded when the shell command is
6603955d011SMarcel Moolenaarexecuted.
6613955d011SMarcel Moolenaar.It
6623955d011SMarcel Moolenaar.Dq .for
6633955d011SMarcel Moolenaarloop index variables are expanded on each loop iteration.
664*954401e6SSimon J. GerratyNote that other variables are not expanded when composing the body of a loop,
665*954401e6SSimon J. Gerratyso the following example code:
6663955d011SMarcel Moolenaar.Bd -literal -offset indent
6673955d011SMarcel Moolenaar
6683955d011SMarcel Moolenaar.Dv .for i in 1 2 3
6693955d011SMarcel Moolenaara+=     ${i}
6703955d011SMarcel Moolenaarj=      ${i}
6713955d011SMarcel Moolenaarb+=     ${j}
6723955d011SMarcel Moolenaar.Dv .endfor
6733955d011SMarcel Moolenaar
6743955d011SMarcel Moolenaarall:
6753955d011SMarcel Moolenaar	@echo ${a}
6763955d011SMarcel Moolenaar	@echo ${b}
6773955d011SMarcel Moolenaar
6783955d011SMarcel Moolenaar.Ed
6793955d011SMarcel Moolenaarwill print:
6803955d011SMarcel Moolenaar.Bd -literal -offset indent
6813955d011SMarcel Moolenaar1 2 3
6823955d011SMarcel Moolenaar3 3 3
6833955d011SMarcel Moolenaar
6843955d011SMarcel Moolenaar.Ed
6853955d011SMarcel MoolenaarBecause while ${a} contains
6863955d011SMarcel Moolenaar.Dq 1 2 3
6873955d011SMarcel Moolenaarafter the loop is executed, ${b}
6883955d011SMarcel Moolenaarcontains
6893955d011SMarcel Moolenaar.Dq ${j} ${j} ${j}
6903955d011SMarcel Moolenaarwhich expands to
6913955d011SMarcel Moolenaar.Dq 3 3 3
6923955d011SMarcel Moolenaarsince after the loop completes ${j} contains
6933955d011SMarcel Moolenaar.Dq 3 .
6943955d011SMarcel Moolenaar.El
6953955d011SMarcel Moolenaar.Ss Variable classes
6963955d011SMarcel MoolenaarThe four different classes of variables (in order of increasing precedence)
6973955d011SMarcel Moolenaarare:
6983955d011SMarcel Moolenaar.Bl -tag -width Ds
6993955d011SMarcel Moolenaar.It Environment variables
7003955d011SMarcel MoolenaarVariables defined as part of
7013955d011SMarcel Moolenaar.Nm Ns 's
7023955d011SMarcel Moolenaarenvironment.
7033955d011SMarcel Moolenaar.It Global variables
7043955d011SMarcel MoolenaarVariables defined in the makefile or in included makefiles.
7053955d011SMarcel Moolenaar.It Command line variables
7063955d011SMarcel MoolenaarVariables defined as part of the command line.
7073955d011SMarcel Moolenaar.It Local variables
7083955d011SMarcel MoolenaarVariables that are defined specific to a certain target.
709db29cad8SSimon J. Gerraty.El
710db29cad8SSimon J. Gerraty.Pp
7119f45a3c8SSimon J. GerratyLocal variables can be set on a dependency line, if
7121d3f2ddcSSimon J. Gerraty.Va .MAKE.TARGET_LOCAL_VARIABLES
7139f45a3c8SSimon J. Gerratyis not set to
7149f45a3c8SSimon J. Gerraty.Ql false .
7159f45a3c8SSimon J. GerratyThe rest of the line
7161d3f2ddcSSimon J. Gerraty(which will already have had global variables expanded)
7179f45a3c8SSimon J. Gerratyis the variable value.
7189f45a3c8SSimon J. GerratyFor example:
7199f45a3c8SSimon J. Gerraty.Bd -literal -offset indent
7201d3f2ddcSSimon J. GerratyCOMPILER_WRAPPERS= ccache distcc icecc
7219f45a3c8SSimon J. Gerraty
7229f45a3c8SSimon J. Gerraty${OBJS}: .MAKE.META.CMP_FILTER=${COMPILER_WRAPPERS:S,^,N,}
7239f45a3c8SSimon J. Gerraty.Ed
7249f45a3c8SSimon J. Gerraty.Pp
7259f45a3c8SSimon J. GerratyOnly the targets
7269f45a3c8SSimon J. Gerraty.Ql ${OBJS}
7279f45a3c8SSimon J. Gerratywill be impacted by that filter (in "meta" mode) and
7281d3f2ddcSSimon J. Gerratysimply enabling/disabling any of the compiler wrappers will not render all
7299f45a3c8SSimon J. Gerratyof those targets out-of-date.
7309f45a3c8SSimon J. Gerraty.Pp
7319f45a3c8SSimon J. Gerraty.Em NOTE :
7321d3f2ddcSSimon J. Gerratytarget-local variable assignments behave differently in that;
7339f45a3c8SSimon J. Gerraty.Bl -tag -width Ds -offset indent
7349f45a3c8SSimon J. Gerraty.It Ic \&+=
7359f45a3c8SSimon J. GerratyOnly appends to a previous local assignment
7369f45a3c8SSimon J. Gerratyfor the same target and variable.
7379f45a3c8SSimon J. Gerraty.It Ic \&:=
7381d3f2ddcSSimon J. GerratyIs redundant with respect to global variables,
7399f45a3c8SSimon J. Gerratywhich have already been expanded.
7409f45a3c8SSimon J. Gerraty.El
7419f45a3c8SSimon J. Gerraty.Pp
7429f45a3c8SSimon J. GerratyThe seven built-in local variables are as follows:
743db29cad8SSimon J. Gerraty.Bl -tag -width ".ARCHIVE" -offset indent
7443955d011SMarcel Moolenaar.It Va .ALLSRC
7453955d011SMarcel MoolenaarThe list of all sources for this target; also known as
746*954401e6SSimon J. Gerraty.Sq Va \&> .
7473955d011SMarcel Moolenaar.It Va .ARCHIVE
748db29cad8SSimon J. GerratyThe name of the archive file; also known as
749*954401e6SSimon J. Gerraty.Sq Va \&! .
7503955d011SMarcel Moolenaar.It Va .IMPSRC
7513955d011SMarcel MoolenaarIn suffix-transformation rules, the name/path of the source from which the
7523955d011SMarcel Moolenaartarget is to be transformed (the
7533955d011SMarcel Moolenaar.Dq implied
7543955d011SMarcel Moolenaarsource); also known as
755*954401e6SSimon J. Gerraty.Sq Va \&< .
7563955d011SMarcel MoolenaarIt is not defined in explicit rules.
7573955d011SMarcel Moolenaar.It Va .MEMBER
758db29cad8SSimon J. GerratyThe name of the archive member; also known as
759*954401e6SSimon J. Gerraty.Sq Va % .
7603955d011SMarcel Moolenaar.It Va .OODATE
7613955d011SMarcel MoolenaarThe list of sources for this target that were deemed out-of-date; also
7623955d011SMarcel Moolenaarknown as
763*954401e6SSimon J. Gerraty.Sq Va \&? .
7643955d011SMarcel Moolenaar.It Va .PREFIX
7653955d011SMarcel MoolenaarThe file prefix of the target, containing only the file portion, no suffix
7663955d011SMarcel Moolenaaror preceding directory components; also known as
767*954401e6SSimon J. Gerraty.Sq Va * .
768db29cad8SSimon J. GerratyThe suffix must be one of the known suffixes declared with
769db29cad8SSimon J. Gerraty.Ic .SUFFIXES
770db29cad8SSimon J. Gerratyor it will not be recognized.
7713955d011SMarcel Moolenaar.It Va .TARGET
7723955d011SMarcel MoolenaarThe name of the target; also known as
773*954401e6SSimon J. Gerraty.Sq Va @ .
7743bebe729SSimon J. GerratyFor compatibility with other makes this is an alias for
7753bebe729SSimon J. Gerraty.Ic .ARCHIVE
7763bebe729SSimon J. Gerratyin archive member rules.
7773955d011SMarcel Moolenaar.El
7783955d011SMarcel Moolenaar.Pp
7793955d011SMarcel MoolenaarThe shorter forms
7808695518cSSimon J. Gerraty.Ql ( Va > ,
781*954401e6SSimon J. Gerraty.Sq Va \&! ,
782*954401e6SSimon J. Gerraty.Sq Va < ,
783*954401e6SSimon J. Gerraty.Sq Va % ,
784*954401e6SSimon J. Gerraty.Sq Va \&? ,
785*954401e6SSimon J. Gerraty.Sq Va * ,
7863955d011SMarcel Moolenaarand
787*954401e6SSimon J. Gerraty.Sq Va @ )
7883955d011SMarcel Moolenaarare permitted for backward
789db29cad8SSimon J. Gerratycompatibility with historical makefiles and legacy POSIX make and are
790db29cad8SSimon J. Gerratynot recommended.
791db29cad8SSimon J. Gerraty.Pp
792db29cad8SSimon J. GerratyVariants of these variables with the punctuation followed immediately by
793db29cad8SSimon J. Gerraty.Ql D
794db29cad8SSimon J. Gerratyor
795db29cad8SSimon J. Gerraty.Ql F ,
796*954401e6SSimon J. Gerratye.g.\&
797*954401e6SSimon J. Gerraty.Sq Va $(@D) ,
798db29cad8SSimon J. Gerratyare legacy forms equivalent to using the
799db29cad8SSimon J. Gerraty.Ql :H
8003955d011SMarcel Moolenaarand
801db29cad8SSimon J. Gerraty.Ql :T
802db29cad8SSimon J. Gerratymodifiers.
803db29cad8SSimon J. GerratyThese forms are accepted for compatibility with
8043955d011SMarcel Moolenaar.At V
805db29cad8SSimon J. Gerratymakefiles and POSIX but are not recommended.
8063955d011SMarcel Moolenaar.Pp
8073955d011SMarcel MoolenaarFour of the local variables may be used in sources on dependency lines
8083955d011SMarcel Moolenaarbecause they expand to the proper value for each target on the line.
8093955d011SMarcel MoolenaarThese variables are
810*954401e6SSimon J. Gerraty.Sq Va .TARGET ,
811*954401e6SSimon J. Gerraty.Sq Va .PREFIX ,
812*954401e6SSimon J. Gerraty.Sq Va .ARCHIVE ,
8133955d011SMarcel Moolenaarand
814*954401e6SSimon J. Gerraty.Sq Va .MEMBER .
8153955d011SMarcel Moolenaar.Ss Additional built-in variables
8163955d011SMarcel MoolenaarIn addition,
8173955d011SMarcel Moolenaar.Nm
8183955d011SMarcel Moolenaarsets or knows about the following variables:
8193955d011SMarcel Moolenaar.Bl -tag -width .MAKEOVERRIDES
8203955d011SMarcel Moolenaar.It Va .ALLTARGETS
8213955d011SMarcel MoolenaarThe list of all targets encountered in the Makefile.
8223955d011SMarcel MoolenaarIf evaluated during
8233955d011SMarcel MoolenaarMakefile parsing, lists only those targets encountered thus far.
8243955d011SMarcel Moolenaar.It Va .CURDIR
8253955d011SMarcel MoolenaarA path to the directory where
8263955d011SMarcel Moolenaar.Nm
8273955d011SMarcel Moolenaarwas executed.
8283955d011SMarcel MoolenaarRefer to the description of
829*954401e6SSimon J. Gerraty.Sq Ev PWD
8303955d011SMarcel Moolenaarfor more details.
8315bcb7424SSimon J. Gerraty.It Va .INCLUDEDFROMDIR
8325bcb7424SSimon J. GerratyThe directory of the file this Makefile was included from.
8335bcb7424SSimon J. Gerraty.It Va .INCLUDEDFROMFILE
8345bcb7424SSimon J. GerratyThe filename of the file this Makefile was included from.
8353955d011SMarcel Moolenaar.It Ev MAKE
8363955d011SMarcel MoolenaarThe name that
8373955d011SMarcel Moolenaar.Nm
8383955d011SMarcel Moolenaarwas executed with
8393955d011SMarcel Moolenaar.Pq Va argv[0] .
8403955d011SMarcel MoolenaarFor compatibility
8413955d011SMarcel Moolenaar.Nm
8423955d011SMarcel Moolenaaralso sets
8433955d011SMarcel Moolenaar.Va .MAKE
8443955d011SMarcel Moolenaarwith the same value.
8453955d011SMarcel MoolenaarThe preferred variable to use is the environment variable
8463955d011SMarcel Moolenaar.Ev MAKE
8473955d011SMarcel Moolenaarbecause it is more compatible with other versions of
8483955d011SMarcel Moolenaar.Nm
8493955d011SMarcel Moolenaarand cannot be confused with the special target with the same name.
8509a4bc556SSimon J. Gerraty.It Va .MAKE.ALWAYS_PASS_JOB_QUEUE
8519a4bc556SSimon J. GerratyTells
8529a4bc556SSimon J. Gerraty.Nm
8539a4bc556SSimon J. Gerratywhether to pass the descriptors of the job token queue
8549a4bc556SSimon J. Gerratyeven if the target is not tagged with
8559a4bc556SSimon J. Gerraty.Ic .MAKE
8569a4bc556SSimon J. GerratyThe default is
8579a4bc556SSimon J. Gerraty.Ql Pa yes
8589a4bc556SSimon J. Gerratyfor backwards compatability with
859a0774d09SSimon J. Gerraty.Fx 9.0
8609a4bc556SSimon J. Gerratyand earlier.
8613955d011SMarcel Moolenaar.It Va .MAKE.DEPENDFILE
8623955d011SMarcel MoolenaarNames the makefile (default
863*954401e6SSimon J. Gerraty.Sq Pa .depend )
8643955d011SMarcel Moolenaarfrom which generated dependencies are read.
8653955d011SMarcel Moolenaar.It Va .MAKE.EXPAND_VARIABLES
8663955d011SMarcel MoolenaarA boolean that controls the default behavior of the
8673955d011SMarcel Moolenaar.Fl V
8683955d011SMarcel Moolenaaroption.
8698695518cSSimon J. GerratyIf true, variable values printed with
8708695518cSSimon J. Gerraty.Fl V
8718695518cSSimon J. Gerratyare fully expanded; if false, the raw variable contents (which may
8728695518cSSimon J. Gerratyinclude additional unexpanded variable references) are shown.
8733955d011SMarcel Moolenaar.It Va .MAKE.EXPORTED
8743955d011SMarcel MoolenaarThe list of variables exported by
8753955d011SMarcel Moolenaar.Nm .
8763955d011SMarcel Moolenaar.It Va .MAKE.JOBS
8773955d011SMarcel MoolenaarThe argument to the
8783955d011SMarcel Moolenaar.Fl j
8793955d011SMarcel Moolenaaroption.
8803955d011SMarcel Moolenaar.It Va .MAKE.JOB.PREFIX
8813955d011SMarcel MoolenaarIf
8823955d011SMarcel Moolenaar.Nm
8833955d011SMarcel Moolenaaris run with
884*954401e6SSimon J. Gerraty.Fl j ,
885*954401e6SSimon J. Gerratythe output for each target is prefixed with a token
8863955d011SMarcel Moolenaar.Ql --- target ---
8873955d011SMarcel Moolenaarthe first part of which can be controlled via
8883955d011SMarcel Moolenaar.Va .MAKE.JOB.PREFIX .
88951ee2c1cSSimon J. GerratyIf
89051ee2c1cSSimon J. Gerraty.Va .MAKE.JOB.PREFIX
89151ee2c1cSSimon J. Gerratyis empty, no token is printed.
892*954401e6SSimon J. GerratyFor example, setting
893*954401e6SSimon J. Gerraty.Va .MAKE.JOB.PREFIX
894*954401e6SSimon J. Gerratyto
895*954401e6SSimon J. Gerraty.Li ${.newline}---${.MAKE:T}[${.MAKE.PID}]
8963955d011SMarcel Moolenaarwould produce tokens like
8973955d011SMarcel Moolenaar.Ql ---make[1234] target ---
8983955d011SMarcel Moolenaarmaking it easier to track the degree of parallelism being achieved.
8999f45a3c8SSimon J. Gerraty.It .MAKE.TARGET_LOCAL_VARIABLES
9009f45a3c8SSimon J. GerratyIf set to
9019f45a3c8SSimon J. Gerraty.Ql false ,
9029f45a3c8SSimon J. Gerratyapparent variable assignments in dependency lines are
9039f45a3c8SSimon J. Gerratytreated as normal sources.
9043955d011SMarcel Moolenaar.It Ev MAKEFLAGS
9053955d011SMarcel MoolenaarThe environment variable
906*954401e6SSimon J. Gerraty.Sq Ev MAKEFLAGS
9073955d011SMarcel Moolenaarmay contain anything that
9083955d011SMarcel Moolenaarmay be specified on
9093955d011SMarcel Moolenaar.Nm Ns 's
9103955d011SMarcel Moolenaarcommand line.
9113955d011SMarcel MoolenaarAnything specified on
9123955d011SMarcel Moolenaar.Nm Ns 's
9133955d011SMarcel Moolenaarcommand line is appended to the
914*954401e6SSimon J. Gerraty.Sq Ev MAKEFLAGS
9153955d011SMarcel Moolenaarvariable which is then
9163955d011SMarcel Moolenaarentered into the environment for all programs which
9173955d011SMarcel Moolenaar.Nm
9183955d011SMarcel Moolenaarexecutes.
9193955d011SMarcel Moolenaar.It Va .MAKE.LEVEL
9203955d011SMarcel MoolenaarThe recursion depth of
9213955d011SMarcel Moolenaar.Nm .
9223955d011SMarcel MoolenaarThe initial instance of
9233955d011SMarcel Moolenaar.Nm
9243955d011SMarcel Moolenaarwill be 0, and an incremented value is put into the environment
9253955d011SMarcel Moolenaarto be seen by the next generation.
9263955d011SMarcel MoolenaarThis allows tests like:
9273955d011SMarcel Moolenaar.Li .if ${.MAKE.LEVEL} == 0
9283955d011SMarcel Moolenaarto protect things which should only be evaluated in the initial instance of
9293955d011SMarcel Moolenaar.Nm .
9303955d011SMarcel Moolenaar.It Va .MAKE.MAKEFILE_PREFERENCE
9313955d011SMarcel MoolenaarThe ordered list of makefile names
9323955d011SMarcel Moolenaar(default
933*954401e6SSimon J. Gerraty.Sq Pa makefile ,
934*954401e6SSimon J. Gerraty.Sq Pa Makefile )
9353955d011SMarcel Moolenaarthat
9363955d011SMarcel Moolenaar.Nm
9373955d011SMarcel Moolenaarwill look for.
9383955d011SMarcel Moolenaar.It Va .MAKE.MAKEFILES
9393955d011SMarcel MoolenaarThe list of makefiles read by
9403955d011SMarcel Moolenaar.Nm ,
9413955d011SMarcel Moolenaarwhich is useful for tracking dependencies.
9423955d011SMarcel MoolenaarEach makefile is recorded only once, regardless of the number of times read.
9433955d011SMarcel Moolenaar.It Va .MAKE.MODE
9443955d011SMarcel MoolenaarProcessed after reading all makefiles.
9453955d011SMarcel MoolenaarCan affect the mode that
9463955d011SMarcel Moolenaar.Nm
9473955d011SMarcel Moolenaarruns in.
9483955d011SMarcel MoolenaarIt can contain a number of keywords:
949b778b302SSimon J. Gerraty.Bl -hang -width missing-filemon=bf.
9503955d011SMarcel Moolenaar.It Pa compat
9513955d011SMarcel MoolenaarLike
9523955d011SMarcel Moolenaar.Fl B ,
9533955d011SMarcel Moolenaarputs
9543955d011SMarcel Moolenaar.Nm
9553955d011SMarcel Moolenaarinto "compat" mode.
9563955d011SMarcel Moolenaar.It Pa meta
9573955d011SMarcel MoolenaarPuts
9583955d011SMarcel Moolenaar.Nm
9593955d011SMarcel Moolenaarinto "meta" mode, where meta files are created for each target
9603955d011SMarcel Moolenaarto capture the command run, the output generated and if
9613955d011SMarcel Moolenaar.Xr filemon 4
9623955d011SMarcel Moolenaaris available, the system calls which are of interest to
9633955d011SMarcel Moolenaar.Nm .
9643955d011SMarcel MoolenaarThe captured output can be very useful when diagnosing errors.
9653955d011SMarcel Moolenaar.It Pa curdirOk= Ar bf
9663955d011SMarcel MoolenaarNormally
9673955d011SMarcel Moolenaar.Nm
9683955d011SMarcel Moolenaarwill not create .meta files in
969*954401e6SSimon J. Gerraty.Sq Va .CURDIR .
9703955d011SMarcel MoolenaarThis can be overridden by setting
9713955d011SMarcel Moolenaar.Va bf
9723955d011SMarcel Moolenaarto a value which represents True.
973b778b302SSimon J. Gerraty.It Pa missing-meta= Ar bf
974b778b302SSimon J. GerratyIf
975b778b302SSimon J. Gerraty.Va bf
976b778b302SSimon J. Gerratyis True, then a missing .meta file makes the target out-of-date.
977b778b302SSimon J. Gerraty.It Pa missing-filemon= Ar bf
978b778b302SSimon J. GerratyIf
979b778b302SSimon J. Gerraty.Va bf
980b778b302SSimon J. Gerratyis True, then missing filemon data makes the target out-of-date.
981b778b302SSimon J. Gerraty.It Pa nofilemon
982b778b302SSimon J. GerratyDo not use
983b778b302SSimon J. Gerraty.Xr filemon 4 .
9843955d011SMarcel Moolenaar.It Pa env
985be19d90bSSimon J. GerratyFor debugging, it can be useful to include the environment
9863955d011SMarcel Moolenaarin the .meta file.
9873955d011SMarcel Moolenaar.It Pa verbose
9883955d011SMarcel MoolenaarIf in "meta" mode, print a clue about the target being built.
9893955d011SMarcel MoolenaarThis is useful if the build is otherwise running silently.
9903955d011SMarcel MoolenaarThe message printed the value of:
9913955d011SMarcel Moolenaar.Va .MAKE.META.PREFIX .
9923955d011SMarcel Moolenaar.It Pa ignore-cmd
9933955d011SMarcel MoolenaarSome makefiles have commands which are simply not stable.
9943955d011SMarcel MoolenaarThis keyword causes them to be ignored for
9953955d011SMarcel Moolenaardetermining whether a target is out of date in "meta" mode.
9963955d011SMarcel MoolenaarSee also
9973955d011SMarcel Moolenaar.Ic .NOMETA_CMP .
9983955d011SMarcel Moolenaar.It Pa silent= Ar bf
9993955d011SMarcel MoolenaarIf
10003955d011SMarcel Moolenaar.Va bf
10013955d011SMarcel Moolenaaris True, when a .meta file is created, mark the target
10023955d011SMarcel Moolenaar.Ic .SILENT .
1003*954401e6SSimon J. Gerraty.It Pa randomize-targets
1004*954401e6SSimon J. GerratyIn both compat and parallel mode, do not make the targets in the usual order,
1005*954401e6SSimon J. Gerratybut instead randomize their order.
1006*954401e6SSimon J. GerratyThis mode can be used to detect undeclared dependencies between files.
10073955d011SMarcel Moolenaar.El
10083955d011SMarcel Moolenaar.It Va .MAKE.META.BAILIWICK
10093955d011SMarcel MoolenaarIn "meta" mode, provides a list of prefixes which
10103955d011SMarcel Moolenaarmatch the directories controlled by
10113955d011SMarcel Moolenaar.Nm .
10123955d011SMarcel MoolenaarIf a file that was generated outside of
10133955d011SMarcel Moolenaar.Va .OBJDIR
10143955d011SMarcel Moolenaarbut within said bailiwick is missing,
10153955d011SMarcel Moolenaarthe current target is considered out-of-date.
10169f45a3c8SSimon J. Gerraty.It Va .MAKE.META.CMP_FILTER
10179f45a3c8SSimon J. GerratyIn "meta" mode, it can (very rarely!) be useful to filter command
10189f45a3c8SSimon J. Gerratylines before comparison.
10199f45a3c8SSimon J. GerratyThis variable can be set to a set of modifiers that will be applied to
10209f45a3c8SSimon J. Gerratyeach line of the old and new command that differ, if the filtered
10219f45a3c8SSimon J. Gerratycommands still differ, the target is considered out-of-date.
10223955d011SMarcel Moolenaar.It Va .MAKE.META.CREATED
10233955d011SMarcel MoolenaarIn "meta" mode, this variable contains a list of all the meta files
10243955d011SMarcel Moolenaarupdated.
10253955d011SMarcel MoolenaarIf not empty, it can be used to trigger processing of
10263955d011SMarcel Moolenaar.Va .MAKE.META.FILES .
10273955d011SMarcel Moolenaar.It Va .MAKE.META.FILES
10283955d011SMarcel MoolenaarIn "meta" mode, this variable contains a list of all the meta files
10293955d011SMarcel Moolenaarused (updated or not).
10303955d011SMarcel MoolenaarThis list can be used to process the meta files to extract dependency
10313955d011SMarcel Moolenaarinformation.
103251ee2c1cSSimon J. Gerraty.It Va .MAKE.META.IGNORE_PATHS
103351ee2c1cSSimon J. GerratyProvides a list of path prefixes that should be ignored;
103451ee2c1cSSimon J. Gerratybecause the contents are expected to change over time.
103551ee2c1cSSimon J. GerratyThe default list includes:
1036*954401e6SSimon J. Gerraty.Sq Pa /dev /etc /proc /tmp /var/run /var/tmp
1037e48f47ddSSimon J. Gerraty.It Va .MAKE.META.IGNORE_PATTERNS
1038e48f47ddSSimon J. GerratyProvides a list of patterns to match against pathnames.
1039e48f47ddSSimon J. GerratyIgnore any that match.
104095e3ed2cSSimon J. Gerraty.It Va .MAKE.META.IGNORE_FILTER
104195e3ed2cSSimon J. GerratyProvides a list of variable modifiers to apply to each pathname.
104295e3ed2cSSimon J. GerratyIgnore if the expansion is an empty string.
10433955d011SMarcel Moolenaar.It Va .MAKE.META.PREFIX
10443955d011SMarcel MoolenaarDefines the message printed for each meta file updated in "meta verbose" mode.
10453955d011SMarcel MoolenaarThe default value is:
10463955d011SMarcel Moolenaar.Dl Building ${.TARGET:H:tA}/${.TARGET:T}
10473955d011SMarcel Moolenaar.It Va .MAKEOVERRIDES
10483955d011SMarcel MoolenaarThis variable is used to record the names of variables assigned to
10493955d011SMarcel Moolenaaron the command line, so that they may be exported as part of
1050*954401e6SSimon J. Gerraty.Sq Ev MAKEFLAGS .
1051be19d90bSSimon J. GerratyThis behavior can be disabled by assigning an empty value to
1052*954401e6SSimon J. Gerraty.Sq Va .MAKEOVERRIDES
10533955d011SMarcel Moolenaarwithin a makefile.
10543955d011SMarcel MoolenaarExtra variables can be exported from a makefile
10553955d011SMarcel Moolenaarby appending their names to
1056*954401e6SSimon J. Gerraty.Sq Va .MAKEOVERRIDES .
1057*954401e6SSimon J. Gerraty.Sq Ev MAKEFLAGS
10583955d011SMarcel Moolenaaris re-exported whenever
1059*954401e6SSimon J. Gerraty.Sq Va .MAKEOVERRIDES
10603955d011SMarcel Moolenaaris modified.
10611748de26SSimon J. Gerraty.It Va .MAKE.PATH_FILEMON
10621748de26SSimon J. GerratyIf
10631748de26SSimon J. Gerraty.Nm
10641748de26SSimon J. Gerratywas built with
10651748de26SSimon J. Gerraty.Xr filemon 4
10661748de26SSimon J. Gerratysupport, this is set to the path of the device node.
10671748de26SSimon J. GerratyThis allows makefiles to test for this support.
10683955d011SMarcel Moolenaar.It Va .MAKE.PID
10693955d011SMarcel MoolenaarThe process-id of
10703955d011SMarcel Moolenaar.Nm .
10713955d011SMarcel Moolenaar.It Va .MAKE.PPID
10723955d011SMarcel MoolenaarThe parent process-id of
10733955d011SMarcel Moolenaar.Nm .
1074be19d90bSSimon J. Gerraty.It Va .MAKE.SAVE_DOLLARS
1075be19d90bSSimon J. Gerratyvalue should be a boolean that controls whether
1076be19d90bSSimon J. Gerraty.Ql $$
1077be19d90bSSimon J. Gerratyare preserved when doing
1078be19d90bSSimon J. Gerraty.Ql :=
1079be19d90bSSimon J. Gerratyassignments.
1080be19d90bSSimon J. GerratyThe default is false, for backwards compatibility.
1081be19d90bSSimon J. GerratySet to true for compatability with other makes.
1082be19d90bSSimon J. GerratyIf set to false,
1083be19d90bSSimon J. Gerraty.Ql $$
1084be19d90bSSimon J. Gerratybecomes
1085be19d90bSSimon J. Gerraty.Ql $
1086be19d90bSSimon J. Gerratyper normal evaluation rules.
108706b9b3e0SSimon J. Gerraty.It Va .MAKE.UID
108806b9b3e0SSimon J. GerratyThe user-id running
108906b9b3e0SSimon J. Gerraty.Nm .
109006b9b3e0SSimon J. Gerraty.It Va .MAKE.GID
109106b9b3e0SSimon J. GerratyThe group-id running
109206b9b3e0SSimon J. Gerraty.Nm .
10933955d011SMarcel Moolenaar.It Va MAKE_PRINT_VAR_ON_ERROR
10943955d011SMarcel MoolenaarWhen
10953955d011SMarcel Moolenaar.Nm
109695e3ed2cSSimon J. Gerratystops due to an error, it sets
1097*954401e6SSimon J. Gerraty.Sq Va .ERROR_TARGET
109895e3ed2cSSimon J. Gerratyto the name of the target that failed,
1099*954401e6SSimon J. Gerraty.Sq Va .ERROR_CMD
110095e3ed2cSSimon J. Gerratyto the commands of the failed target,
110195e3ed2cSSimon J. Gerratyand in "meta" mode, it also sets
1102*954401e6SSimon J. Gerraty.Sq Va .ERROR_CWD
110395e3ed2cSSimon J. Gerratyto the
110495e3ed2cSSimon J. Gerraty.Xr getcwd 3 ,
110595e3ed2cSSimon J. Gerratyand
1106*954401e6SSimon J. Gerraty.Sq Va .ERROR_META_FILE
110795e3ed2cSSimon J. Gerratyto the path of the meta file (if any) describing the failed target.
110895e3ed2cSSimon J. GerratyIt then prints its name and the value of
1109*954401e6SSimon J. Gerraty.Sq Va .CURDIR
11103955d011SMarcel Moolenaaras well as the value of any variables named in
1111*954401e6SSimon J. Gerraty.Sq Va MAKE_PRINT_VAR_ON_ERROR .
11123955d011SMarcel Moolenaar.It Va .newline
11133955d011SMarcel MoolenaarThis variable is simply assigned a newline character as its value.
11143955d011SMarcel MoolenaarThis allows expansions using the
11153955d011SMarcel Moolenaar.Cm \&:@
11163955d011SMarcel Moolenaarmodifier to put a newline between
11173955d011SMarcel Moolenaariterations of the loop rather than a space.
11183955d011SMarcel MoolenaarFor example, the printing of
1119*954401e6SSimon J. Gerraty.Sq Va MAKE_PRINT_VAR_ON_ERROR
11203955d011SMarcel Moolenaarcould be done as ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@}.
11213955d011SMarcel Moolenaar.It Va .OBJDIR
11223955d011SMarcel MoolenaarA path to the directory where the targets are built.
11233955d011SMarcel MoolenaarIts value is determined by trying to
11243955d011SMarcel Moolenaar.Xr chdir 2
11253955d011SMarcel Moolenaarto the following directories in order and using the first match:
11263955d011SMarcel Moolenaar.Bl -enum
11273955d011SMarcel Moolenaar.It
11283955d011SMarcel Moolenaar.Ev ${MAKEOBJDIRPREFIX}${.CURDIR}
11293955d011SMarcel Moolenaar.Pp
11303955d011SMarcel Moolenaar(Only if
1131*954401e6SSimon J. Gerraty.Sq Ev MAKEOBJDIRPREFIX
11323955d011SMarcel Moolenaaris set in the environment or on the command line.)
11333955d011SMarcel Moolenaar.It
11343955d011SMarcel Moolenaar.Ev ${MAKEOBJDIR}
11353955d011SMarcel Moolenaar.Pp
11363955d011SMarcel Moolenaar(Only if
1137*954401e6SSimon J. Gerraty.Sq Ev MAKEOBJDIR
11383955d011SMarcel Moolenaaris set in the environment or on the command line.)
11393955d011SMarcel Moolenaar.It
11403955d011SMarcel Moolenaar.Ev ${.CURDIR} Ns Pa /obj. Ns Ev ${MACHINE}
11413955d011SMarcel Moolenaar.It
11423955d011SMarcel Moolenaar.Ev ${.CURDIR} Ns Pa /obj
11433955d011SMarcel Moolenaar.It
11443955d011SMarcel Moolenaar.Pa /usr/obj/ Ns Ev ${.CURDIR}
11453955d011SMarcel Moolenaar.It
11463955d011SMarcel Moolenaar.Ev ${.CURDIR}
11473955d011SMarcel Moolenaar.El
11483955d011SMarcel Moolenaar.Pp
11493955d011SMarcel MoolenaarVariable expansion is performed on the value before it's used,
11503955d011SMarcel Moolenaarso expressions such as
11513955d011SMarcel Moolenaar.Dl ${.CURDIR:S,^/usr/src,/var/obj,}
11523955d011SMarcel Moolenaarmay be used.
11533955d011SMarcel MoolenaarThis is especially useful with
1154*954401e6SSimon J. Gerraty.Sq Ev MAKEOBJDIR .
11553955d011SMarcel Moolenaar.Pp
1156*954401e6SSimon J. Gerraty.Sq Va .OBJDIR
1157128a4105SSimon J. Gerratymay be modified in the makefile via the special target
1158*954401e6SSimon J. Gerraty.Sq Ic .OBJDIR .
11593955d011SMarcel MoolenaarIn all cases,
11603955d011SMarcel Moolenaar.Nm
11613955d011SMarcel Moolenaarwill
11623955d011SMarcel Moolenaar.Xr chdir 2
1163128a4105SSimon J. Gerratyto the specified directory if it exists, and set
1164*954401e6SSimon J. Gerraty.Sq Va .OBJDIR
1165128a4105SSimon J. Gerratyand
1166*954401e6SSimon J. Gerraty.Sq Ev PWD
11673955d011SMarcel Moolenaarto that directory before executing any targets.
1168e2eeea75SSimon J. Gerraty.Pp
1169e2eeea75SSimon J. GerratyExcept in the case of an explicit
1170*954401e6SSimon J. Gerraty.Sq Ic .OBJDIR
1171e2eeea75SSimon J. Gerratytarget,
1172e2eeea75SSimon J. Gerraty.Nm
1173e2eeea75SSimon J. Gerratywill check that the specified directory is writable and ignore it if not.
1174e2eeea75SSimon J. GerratyThis check can be skipped by setting the environment variable
1175*954401e6SSimon J. Gerraty.Sq Ev MAKE_OBJDIR_CHECK_WRITABLE
1176e2eeea75SSimon J. Gerratyto "no".
11773955d011SMarcel Moolenaar.
11783955d011SMarcel Moolenaar.It Va .PARSEDIR
11793955d011SMarcel MoolenaarA path to the directory of the current
1180*954401e6SSimon J. Gerraty.Sq Pa Makefile
11813955d011SMarcel Moolenaarbeing parsed.
11823955d011SMarcel Moolenaar.It Va .PARSEFILE
11833955d011SMarcel MoolenaarThe basename of the current
1184*954401e6SSimon J. Gerraty.Sq Pa Makefile
11853955d011SMarcel Moolenaarbeing parsed.
11863955d011SMarcel MoolenaarThis variable and
1187*954401e6SSimon J. Gerraty.Sq Va .PARSEDIR
11883955d011SMarcel Moolenaarare both set only while the
1189*954401e6SSimon J. Gerraty.Sq Pa Makefiles
11903955d011SMarcel Moolenaarare being parsed.
11913955d011SMarcel MoolenaarIf you want to retain their current values, assign them to a variable
1192*954401e6SSimon J. Gerratyusing assignment with expansion
1193*954401e6SSimon J. Gerraty.Sq Cm \&:= .
11943955d011SMarcel Moolenaar.It Va .PATH
11953955d011SMarcel MoolenaarA variable that represents the list of directories that
11963955d011SMarcel Moolenaar.Nm
11973955d011SMarcel Moolenaarwill search for files.
11983955d011SMarcel MoolenaarThe search list should be updated using the target
1199*954401e6SSimon J. Gerraty.Sq Va .PATH
12003955d011SMarcel Moolenaarrather than the variable.
12013955d011SMarcel Moolenaar.It Ev PWD
12023955d011SMarcel MoolenaarAlternate path to the current directory.
12033955d011SMarcel Moolenaar.Nm
12043955d011SMarcel Moolenaarnormally sets
1205*954401e6SSimon J. Gerraty.Sq Va .CURDIR
12063955d011SMarcel Moolenaarto the canonical path given by
12073955d011SMarcel Moolenaar.Xr getcwd 3 .
12083955d011SMarcel MoolenaarHowever, if the environment variable
1209*954401e6SSimon J. Gerraty.Sq Ev PWD
12103955d011SMarcel Moolenaaris set and gives a path to the current directory, then
12113955d011SMarcel Moolenaar.Nm
12123955d011SMarcel Moolenaarsets
1213*954401e6SSimon J. Gerraty.Sq Va .CURDIR
12143955d011SMarcel Moolenaarto the value of
1215*954401e6SSimon J. Gerraty.Sq Ev PWD
12163955d011SMarcel Moolenaarinstead.
1217be19d90bSSimon J. GerratyThis behavior is disabled if
1218*954401e6SSimon J. Gerraty.Sq Ev MAKEOBJDIRPREFIX
12193955d011SMarcel Moolenaaris set or
1220*954401e6SSimon J. Gerraty.Sq Ev MAKEOBJDIR
12213955d011SMarcel Moolenaarcontains a variable transform.
1222*954401e6SSimon J. Gerraty.Sq Ev PWD
12233955d011SMarcel Moolenaaris set to the value of
1224*954401e6SSimon J. Gerraty.Sq Va .OBJDIR
12253955d011SMarcel Moolenaarfor all programs which
12263955d011SMarcel Moolenaar.Nm
12273955d011SMarcel Moolenaarexecutes.
12282c3632d1SSimon J. Gerraty.It Ev .SHELL
12292c3632d1SSimon J. GerratyThe pathname of the shell used to run target scripts.
12302c3632d1SSimon J. GerratyIt is read-only.
123112904384SSimon J. Gerraty.It Ev .SUFFIXES
123212904384SSimon J. GerratyThe list of known suffixes.
123312904384SSimon J. GerratyIt is read-only.
12343955d011SMarcel Moolenaar.It Ev .TARGETS
12353955d011SMarcel MoolenaarThe list of targets explicitly specified on the command line, if any.
12363955d011SMarcel Moolenaar.It Ev VPATH
12373955d011SMarcel MoolenaarColon-separated
12383955d011SMarcel Moolenaar.Pq Dq \&:
12393955d011SMarcel Moolenaarlists of directories that
12403955d011SMarcel Moolenaar.Nm
12413955d011SMarcel Moolenaarwill search for files.
12423955d011SMarcel MoolenaarThe variable is supported for compatibility with old make programs only,
12433955d011SMarcel Moolenaaruse
1244*954401e6SSimon J. Gerraty.Sq Va .PATH
12453955d011SMarcel Moolenaarinstead.
12463955d011SMarcel Moolenaar.El
12473955d011SMarcel Moolenaar.Ss Variable modifiers
12483955d011SMarcel MoolenaarVariable expansion may be modified to select or modify each word of the
12493955d011SMarcel Moolenaarvariable (where a
12503955d011SMarcel Moolenaar.Dq word
12513955d011SMarcel Moolenaaris white-space delimited sequence of characters).
12523955d011SMarcel MoolenaarThe general format of a variable expansion is as follows:
12533955d011SMarcel Moolenaar.Pp
12543955d011SMarcel Moolenaar.Dl ${variable[:modifier[:...]]}
12553955d011SMarcel Moolenaar.Pp
12563955d011SMarcel MoolenaarEach modifier begins with a colon,
12573955d011SMarcel Moolenaarwhich may be escaped with a backslash
12583955d011SMarcel Moolenaar.Pq Ql \e .
12593955d011SMarcel Moolenaar.Pp
12603955d011SMarcel MoolenaarA set of modifiers can be specified via a variable, as follows:
12613955d011SMarcel Moolenaar.Pp
12623955d011SMarcel Moolenaar.Dl modifier_variable=modifier[:...]
12633955d011SMarcel Moolenaar.Dl ${variable:${modifier_variable}[:...]}
12643955d011SMarcel Moolenaar.Pp
12653955d011SMarcel MoolenaarIn this case the first modifier in the modifier_variable does not
12663955d011SMarcel Moolenaarstart with a colon, since that must appear in the referencing
12673955d011SMarcel Moolenaarvariable.
12683955d011SMarcel MoolenaarIf any of the modifiers in the modifier_variable contain a dollar sign
12693955d011SMarcel Moolenaar.Pq Ql $ ,
12703955d011SMarcel Moolenaarthese must be doubled to avoid early expansion.
12713955d011SMarcel Moolenaar.Pp
12723955d011SMarcel MoolenaarThe supported modifiers are:
12733955d011SMarcel Moolenaar.Bl -tag -width EEE
12743955d011SMarcel Moolenaar.It Cm \&:E
12753955d011SMarcel MoolenaarReplaces each word in the variable with its suffix.
12763955d011SMarcel Moolenaar.It Cm \&:H
12773955d011SMarcel MoolenaarReplaces each word in the variable with everything but the last component.
1278*954401e6SSimon J. Gerraty.It Cm \&:M\| Ns Ar pattern
12792c3632d1SSimon J. GerratySelects only those words that match
12803955d011SMarcel Moolenaar.Ar pattern .
12813955d011SMarcel MoolenaarThe standard shell wildcard characters
12823955d011SMarcel Moolenaar.Pf ( Ql * ,
12833955d011SMarcel Moolenaar.Ql \&? ,
12843955d011SMarcel Moolenaarand
1285*954401e6SSimon J. Gerraty.Ql \&[] )
12863955d011SMarcel Moolenaarmay
12873955d011SMarcel Moolenaarbe used.
12883955d011SMarcel MoolenaarThe wildcard characters may be escaped with a backslash
12893955d011SMarcel Moolenaar.Pq Ql \e .
12900dede8b0SSimon J. GerratyAs a consequence of the way values are split into words, matched,
12910dede8b0SSimon J. Gerratyand then joined, a construct like
12920dede8b0SSimon J. Gerraty.Dl ${VAR:M*}
1293be19d90bSSimon J. Gerratywill normalize the inter-word spacing, removing all leading and
12940dede8b0SSimon J. Gerratytrailing space, and converting multiple consecutive spaces
12950dede8b0SSimon J. Gerratyto single spaces.
12960dede8b0SSimon J. Gerraty.
1297*954401e6SSimon J. Gerraty.It Cm \&:N\| Ns Ar pattern
12983955d011SMarcel MoolenaarThis is identical to
1299*954401e6SSimon J. Gerraty.Sq Cm \&:M ,
13003955d011SMarcel Moolenaarbut selects all words which do not match
13013955d011SMarcel Moolenaar.Ar pattern .
13023955d011SMarcel Moolenaar.It Cm \&:O
13032c3632d1SSimon J. GerratyOrders every word in variable alphabetically.
130412904384SSimon J. Gerraty.It Cm \&:On
130512904384SSimon J. GerratyOrders every word in variable numerically.
130612904384SSimon J. GerratyA number followed by one of
130712904384SSimon J. Gerraty.Ql k ,
130812904384SSimon J. Gerraty.Ql M
130912904384SSimon J. Gerratyor
131012904384SSimon J. Gerraty.Ql G
131112904384SSimon J. Gerratyis multiplied by the appropriate factor (1024 (k), 1048576 (M), or
131212904384SSimon J. Gerraty1073741824 (G)).
131312904384SSimon J. GerratyBoth upper- and lower-case letters are accepted.
1314ef0b2538SSimon J. Gerraty.It Cm \&:Or
13152c3632d1SSimon J. GerratyOrders every word in variable in reverse alphabetical order.
131612904384SSimon J. Gerraty.It Cm \&:Orn
131712904384SSimon J. GerratyOrders every word in variable in reverse numerical order.
13183955d011SMarcel Moolenaar.It Cm \&:Ox
13192c3632d1SSimon J. GerratyShuffles the words in variable.
13203955d011SMarcel MoolenaarThe results will be different each time you are referring to the
13213955d011SMarcel Moolenaarmodified variable; use the assignment with expansion
1322*954401e6SSimon J. Gerraty.Sq Cm \&:=
1323be19d90bSSimon J. Gerratyto prevent such behavior.
13243955d011SMarcel MoolenaarFor example,
13253955d011SMarcel Moolenaar.Bd -literal -offset indent
13263955d011SMarcel MoolenaarLIST=			uno due tre quattro
13273955d011SMarcel MoolenaarRANDOM_LIST=		${LIST:Ox}
13283955d011SMarcel MoolenaarSTATIC_RANDOM_LIST:=	${LIST:Ox}
13293955d011SMarcel Moolenaar
13303955d011SMarcel Moolenaarall:
13313955d011SMarcel Moolenaar	@echo "${RANDOM_LIST}"
13323955d011SMarcel Moolenaar	@echo "${RANDOM_LIST}"
13333955d011SMarcel Moolenaar	@echo "${STATIC_RANDOM_LIST}"
13343955d011SMarcel Moolenaar	@echo "${STATIC_RANDOM_LIST}"
13353955d011SMarcel Moolenaar.Ed
13363955d011SMarcel Moolenaarmay produce output similar to:
13373955d011SMarcel Moolenaar.Bd -literal -offset indent
13383955d011SMarcel Moolenaarquattro due tre uno
13393955d011SMarcel Moolenaartre due quattro uno
13403955d011SMarcel Moolenaardue uno quattro tre
13413955d011SMarcel Moolenaardue uno quattro tre
13423955d011SMarcel Moolenaar.Ed
13433955d011SMarcel Moolenaar.It Cm \&:Q
13443955d011SMarcel MoolenaarQuotes every shell meta-character in the variable, so that it can be passed
13452eae894cSSimon J. Gerratysafely to the shell.
13462eae894cSSimon J. Gerraty.It Cm \&:q
13472eae894cSSimon J. GerratyQuotes every shell meta-character in the variable, and also doubles
13482eae894cSSimon J. Gerraty.Sq $
13492eae894cSSimon J. Gerratycharacters so that it can be passed
13503955d011SMarcel Moolenaarsafely through recursive invocations of
13513955d011SMarcel Moolenaar.Nm .
13522eae894cSSimon J. GerratyThis is equivalent to:
13532eae894cSSimon J. Gerraty.Sq \&:S/\e\&$/&&/g:Q .
13543955d011SMarcel Moolenaar.It Cm \&:R
13553955d011SMarcel MoolenaarReplaces each word in the variable with everything but its suffix.
1356*954401e6SSimon J. Gerraty.It Cm \&:range Ns Oo = Ns Ar count Oc
13571ce939a7SSimon J. GerratyThe value is an integer sequence representing the words of the original
13581ce939a7SSimon J. Gerratyvalue, or the supplied
13591ce939a7SSimon J. Gerraty.Va count .
1360*954401e6SSimon J. Gerraty.It Cm \&:gmtime Ns Oo = Ns Ar utc Oc
13613955d011SMarcel MoolenaarThe value is a format string for
13623955d011SMarcel Moolenaar.Xr strftime 3 ,
13631ce939a7SSimon J. Gerratyusing
13643955d011SMarcel Moolenaar.Xr gmtime 3 .
13651ce939a7SSimon J. GerratyIf a
13661ce939a7SSimon J. Gerraty.Va utc
13671ce939a7SSimon J. Gerratyvalue is not provided or is 0, the current time is used.
13683955d011SMarcel Moolenaar.It Cm \&:hash
13692c3632d1SSimon J. GerratyComputes a 32-bit hash of the value and encode it as hex digits.
1370*954401e6SSimon J. Gerraty.It Cm \&:localtime Ns Oo = Ns Ar utc Oc
13713955d011SMarcel MoolenaarThe value is a format string for
13723955d011SMarcel Moolenaar.Xr strftime 3 ,
13731ce939a7SSimon J. Gerratyusing
13743955d011SMarcel Moolenaar.Xr localtime 3 .
13751ce939a7SSimon J. GerratyIf a
13761ce939a7SSimon J. Gerraty.Va utc
13771ce939a7SSimon J. Gerratyvalue is not provided or is 0, the current time is used.
13783955d011SMarcel Moolenaar.It Cm \&:tA
13792c3632d1SSimon J. GerratyAttempts to convert variable to an absolute path using
13803955d011SMarcel Moolenaar.Xr realpath 3 ,
13813955d011SMarcel Moolenaarif that fails, the value is unchanged.
13823955d011SMarcel Moolenaar.It Cm \&:tl
13833955d011SMarcel MoolenaarConverts variable to lower-case letters.
13843955d011SMarcel Moolenaar.It Cm \&:ts Ns Ar c
13853955d011SMarcel MoolenaarWords in the variable are normally separated by a space on expansion.
13863955d011SMarcel MoolenaarThis modifier sets the separator to the character
13873955d011SMarcel Moolenaar.Ar c .
13883955d011SMarcel MoolenaarIf
13893955d011SMarcel Moolenaar.Ar c
13903955d011SMarcel Moolenaaris omitted, then no separator is used.
13912c3632d1SSimon J. GerratyThe common escapes (including octal numeric codes) work as expected.
13923955d011SMarcel Moolenaar.It Cm \&:tu
13933955d011SMarcel MoolenaarConverts variable to upper-case letters.
13943955d011SMarcel Moolenaar.It Cm \&:tW
13953955d011SMarcel MoolenaarCauses the value to be treated as a single word
13963955d011SMarcel Moolenaar(possibly containing embedded white space).
13973955d011SMarcel MoolenaarSee also
1398*954401e6SSimon J. Gerraty.Sq Cm \&:[*] .
13993955d011SMarcel Moolenaar.It Cm \&:tw
14003955d011SMarcel MoolenaarCauses the value to be treated as a sequence of
14013955d011SMarcel Moolenaarwords delimited by white space.
14023955d011SMarcel MoolenaarSee also
1403*954401e6SSimon J. Gerraty.Sq Cm \&:[@] .
14043955d011SMarcel Moolenaar.Sm off
1405*954401e6SSimon J. Gerraty.It Cm \&:S\| No \&/ Ar old_string\| No \&/ Ar new_string\| No \&/ Op Cm 1gW
14063955d011SMarcel Moolenaar.Sm on
14072c3632d1SSimon J. GerratyModifies the first occurrence of
14083955d011SMarcel Moolenaar.Ar old_string
14092c3632d1SSimon J. Gerratyin each word of the variable's value, replacing it with
14103955d011SMarcel Moolenaar.Ar new_string .
14113955d011SMarcel MoolenaarIf a
14123955d011SMarcel Moolenaar.Ql g
14132c3632d1SSimon J. Gerratyis appended to the last delimiter of the pattern, all occurrences
14143955d011SMarcel Moolenaarin each word are replaced.
14153955d011SMarcel MoolenaarIf a
14163955d011SMarcel Moolenaar.Ql 1
14172c3632d1SSimon J. Gerratyis appended to the last delimiter of the pattern, only the first occurrence
14183955d011SMarcel Moolenaaris affected.
14193955d011SMarcel MoolenaarIf a
14203955d011SMarcel Moolenaar.Ql W
14212c3632d1SSimon J. Gerratyis appended to the last delimiter of the pattern,
14223955d011SMarcel Moolenaarthen the value is treated as a single word
14233955d011SMarcel Moolenaar(possibly containing embedded white space).
14243955d011SMarcel MoolenaarIf
14253955d011SMarcel Moolenaar.Ar old_string
14263955d011SMarcel Moolenaarbegins with a caret
14273955d011SMarcel Moolenaar.Pq Ql ^ ,
14283955d011SMarcel Moolenaar.Ar old_string
14293955d011SMarcel Moolenaaris anchored at the beginning of each word.
14303955d011SMarcel MoolenaarIf
14313955d011SMarcel Moolenaar.Ar old_string
14323955d011SMarcel Moolenaarends with a dollar sign
14333955d011SMarcel Moolenaar.Pq Ql \&$ ,
14343955d011SMarcel Moolenaarit is anchored at the end of each word.
14353955d011SMarcel MoolenaarInside
14363955d011SMarcel Moolenaar.Ar new_string ,
14373955d011SMarcel Moolenaaran ampersand
14388695518cSSimon J. Gerraty.Pq Ql &
14393955d011SMarcel Moolenaaris replaced by
14403955d011SMarcel Moolenaar.Ar old_string
14413955d011SMarcel Moolenaar(without any
14423955d011SMarcel Moolenaar.Ql ^
14433955d011SMarcel Moolenaaror
14443955d011SMarcel Moolenaar.Ql \&$ ) .
14453955d011SMarcel MoolenaarAny character may be used as a delimiter for the parts of the modifier
14463955d011SMarcel Moolenaarstring.
14473955d011SMarcel MoolenaarThe anchoring, ampersand and delimiter characters may be escaped with a
14483955d011SMarcel Moolenaarbackslash
14493955d011SMarcel Moolenaar.Pq Ql \e .
14503955d011SMarcel Moolenaar.Pp
14513955d011SMarcel MoolenaarVariable expansion occurs in the normal fashion inside both
14523955d011SMarcel Moolenaar.Ar old_string
14533955d011SMarcel Moolenaarand
14543955d011SMarcel Moolenaar.Ar new_string
14553955d011SMarcel Moolenaarwith the single exception that a backslash is used to prevent the expansion
14563955d011SMarcel Moolenaarof a dollar sign
14573955d011SMarcel Moolenaar.Pq Ql \&$ ,
14583955d011SMarcel Moolenaarnot a preceding dollar sign as is usual.
14593955d011SMarcel Moolenaar.Sm off
1460*954401e6SSimon J. Gerraty.It Cm \&:C\| No \&/ Ar pattern\| No \&/ Ar replacement\| No \&/ Op Cm 1gW
14613955d011SMarcel Moolenaar.Sm on
14623955d011SMarcel MoolenaarThe
14633955d011SMarcel Moolenaar.Cm \&:C
14643955d011SMarcel Moolenaarmodifier is just like the
14653955d011SMarcel Moolenaar.Cm \&:S
14663955d011SMarcel Moolenaarmodifier except that the old and new strings, instead of being
14670dede8b0SSimon J. Gerratysimple strings, are an extended regular expression (see
14683955d011SMarcel Moolenaar.Xr regex 3 )
14693955d011SMarcel Moolenaarstring
14703955d011SMarcel Moolenaar.Ar pattern
14713955d011SMarcel Moolenaarand an
14723955d011SMarcel Moolenaar.Xr ed 1 Ns \-style
14733955d011SMarcel Moolenaarstring
14743955d011SMarcel Moolenaar.Ar replacement .
14753955d011SMarcel MoolenaarNormally, the first occurrence of the pattern
14763955d011SMarcel Moolenaar.Ar pattern
14773955d011SMarcel Moolenaarin each word of the value is substituted with
14783955d011SMarcel Moolenaar.Ar replacement .
14793955d011SMarcel MoolenaarThe
14803955d011SMarcel Moolenaar.Ql 1
14813955d011SMarcel Moolenaarmodifier causes the substitution to apply to at most one word; the
14823955d011SMarcel Moolenaar.Ql g
14833955d011SMarcel Moolenaarmodifier causes the substitution to apply to as many instances of the
14843955d011SMarcel Moolenaarsearch pattern
14853955d011SMarcel Moolenaar.Ar pattern
14863955d011SMarcel Moolenaaras occur in the word or words it is found in; the
14873955d011SMarcel Moolenaar.Ql W
14883955d011SMarcel Moolenaarmodifier causes the value to be treated as a single word
14893955d011SMarcel Moolenaar(possibly containing embedded white space).
14905bcb7424SSimon J. Gerraty.Pp
14915bcb7424SSimon J. GerratyAs for the
14925bcb7424SSimon J. Gerraty.Cm \&:S
14935bcb7424SSimon J. Gerratymodifier, the
14945bcb7424SSimon J. Gerraty.Ar pattern
14955bcb7424SSimon J. Gerratyand
14965bcb7424SSimon J. Gerraty.Ar replacement
14975bcb7424SSimon J. Gerratyare subjected to variable expansion before being parsed as
14985bcb7424SSimon J. Gerratyregular expressions.
14993955d011SMarcel Moolenaar.It Cm \&:T
15002c3632d1SSimon J. GerratyReplaces each word in the variable with its last path component.
15013955d011SMarcel Moolenaar.It Cm \&:u
15022c3632d1SSimon J. GerratyRemoves adjacent duplicate words (like
15033955d011SMarcel Moolenaar.Xr uniq 1 ) .
15043955d011SMarcel Moolenaar.Sm off
1505*954401e6SSimon J. Gerraty.It Cm \&:\&?\| Ar true_string\| Cm \&: Ar false_string
15063955d011SMarcel Moolenaar.Sm on
15073955d011SMarcel MoolenaarIf the variable name (not its value), when parsed as a .if conditional
15083955d011SMarcel Moolenaarexpression, evaluates to true, return as its value the
15093955d011SMarcel Moolenaar.Ar true_string ,
15103955d011SMarcel Moolenaarotherwise return the
15113955d011SMarcel Moolenaar.Ar false_string .
15123955d011SMarcel MoolenaarSince the variable name is used as the expression, \&:\&? must be the
15133955d011SMarcel Moolenaarfirst modifier after the variable name itself - which will, of course,
15143955d011SMarcel Moolenaarusually contain variable expansions.
15153955d011SMarcel MoolenaarA common error is trying to use expressions like
15163955d011SMarcel Moolenaar.Dl ${NUMBERS:M42:?match:no}
15173955d011SMarcel Moolenaarwhich actually tests defined(NUMBERS),
15182c3632d1SSimon J. Gerratyto determine if any words match "42" you need to use something like:
15193955d011SMarcel Moolenaar.Dl ${"${NUMBERS:M42}" != \&"\&":?match:no} .
1520*954401e6SSimon J. Gerraty.It Cm :\| Ns Ar old_string\| Ns Cm = Ns Ar new_string
15213955d011SMarcel MoolenaarThis is the
15223955d011SMarcel Moolenaar.At V
15233955d011SMarcel Moolenaarstyle variable substitution.
15243955d011SMarcel MoolenaarIt must be the last modifier specified.
15253955d011SMarcel MoolenaarIf
15263955d011SMarcel Moolenaar.Ar old_string
15273955d011SMarcel Moolenaaror
15283955d011SMarcel Moolenaar.Ar new_string
15293955d011SMarcel Moolenaardo not contain the pattern matching character
15303955d011SMarcel Moolenaar.Ar %
15313955d011SMarcel Moolenaarthen it is assumed that they are
15323955d011SMarcel Moolenaaranchored at the end of each word, so only suffixes or entire
15333955d011SMarcel Moolenaarwords may be replaced.
15343955d011SMarcel MoolenaarOtherwise
15353955d011SMarcel Moolenaar.Ar %
15363955d011SMarcel Moolenaaris the substring of
15373955d011SMarcel Moolenaar.Ar old_string
15383955d011SMarcel Moolenaarto be replaced in
15393955d011SMarcel Moolenaar.Ar new_string .
154049caa483SSimon J. GerratyIf only
154149caa483SSimon J. Gerraty.Ar old_string
154249caa483SSimon J. Gerratycontains the pattern matching character
154349caa483SSimon J. Gerraty.Ar % ,
154449caa483SSimon J. Gerratyand
154549caa483SSimon J. Gerraty.Ar old_string
154649caa483SSimon J. Gerratymatches, then the result is the
154749caa483SSimon J. Gerraty.Ar new_string .
154849caa483SSimon J. GerratyIf only the
154949caa483SSimon J. Gerraty.Ar new_string
155049caa483SSimon J. Gerratycontains the pattern matching character
155149caa483SSimon J. Gerraty.Ar % ,
155249caa483SSimon J. Gerratythen it is not treated specially and it is printed as a literal
155349caa483SSimon J. Gerraty.Ar %
155449caa483SSimon J. Gerratyon match.
155549caa483SSimon J. GerratyIf there is more than one pattern matching character
155649caa483SSimon J. Gerraty.Ar ( % )
155749caa483SSimon J. Gerratyin either the
155849caa483SSimon J. Gerraty.Ar new_string
155949caa483SSimon J. Gerratyor
156049caa483SSimon J. Gerraty.Ar old_string ,
156149caa483SSimon J. Gerratyonly the first instance is treated specially (as the pattern character);
15622c3632d1SSimon J. Gerratyall subsequent instances are treated as regular characters.
15633955d011SMarcel Moolenaar.Pp
15643955d011SMarcel MoolenaarVariable expansion occurs in the normal fashion inside both
15653955d011SMarcel Moolenaar.Ar old_string
15663955d011SMarcel Moolenaarand
15673955d011SMarcel Moolenaar.Ar new_string
15683955d011SMarcel Moolenaarwith the single exception that a backslash is used to prevent the
15693955d011SMarcel Moolenaarexpansion of a dollar sign
15703955d011SMarcel Moolenaar.Pq Ql \&$ ,
15713955d011SMarcel Moolenaarnot a preceding dollar sign as is usual.
15723955d011SMarcel Moolenaar.Sm off
1573*954401e6SSimon J. Gerraty.It Cm \&:@ Ar temp\| Cm @ Ar string\| Cm @
15743955d011SMarcel Moolenaar.Sm on
15753955d011SMarcel MoolenaarThis is the loop expansion mechanism from the OSF Development
15763955d011SMarcel MoolenaarEnvironment (ODE) make.
15773955d011SMarcel MoolenaarUnlike
15783955d011SMarcel Moolenaar.Cm \&.for
15792c3632d1SSimon J. Gerratyloops, expansion occurs at the time of reference.
15802c3632d1SSimon J. GerratyAssigns
15813955d011SMarcel Moolenaar.Ar temp
15822c3632d1SSimon J. Gerratyto each word in the variable and evaluates
15833955d011SMarcel Moolenaar.Ar string .
15843955d011SMarcel MoolenaarThe ODE convention is that
15853955d011SMarcel Moolenaar.Ar temp
15863955d011SMarcel Moolenaarshould start and end with a period.
15873955d011SMarcel MoolenaarFor example.
15883955d011SMarcel Moolenaar.Dl ${LINKS:@.LINK.@${LN} ${TARGET} ${.LINK.}@}
15893955d011SMarcel Moolenaar.Pp
159051ee2c1cSSimon J. GerratyHowever a single character variable is often more readable:
15913955d011SMarcel Moolenaar.Dl ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@}
1592*954401e6SSimon J. Gerraty.It Cm \&:_ Ns Oo Cm = Ns Ar var Oc
15932c3632d1SSimon J. GerratySaves the current variable value in
15941ce939a7SSimon J. Gerraty.Ql $_
15951ce939a7SSimon J. Gerratyor the named
15961ce939a7SSimon J. Gerraty.Va var
15971ce939a7SSimon J. Gerratyfor later reference.
15981ce939a7SSimon J. GerratyExample usage:
15991ce939a7SSimon J. Gerraty.Bd -literal -offset indent
16001ce939a7SSimon J. GerratyM_cmpv.units = 1 1000 1000000
16011ce939a7SSimon J. GerratyM_cmpv = S,., ,g:_:range:@i@+ $${_:[-$$i]} \&\\
16021ce939a7SSimon J. Gerraty\\* $${M_cmpv.units:[$$i]}@:S,^,expr 0 ,1:sh
16031ce939a7SSimon J. Gerraty
16041ce939a7SSimon J. Gerraty.Dv .if ${VERSION:${M_cmpv}} < ${3.1.12:L:${M_cmpv}}
16051ce939a7SSimon J. Gerraty
16061ce939a7SSimon J. Gerraty.Ed
16071ce939a7SSimon J. GerratyHere
16081ce939a7SSimon J. Gerraty.Ql $_
16091ce939a7SSimon J. Gerratyis used to save the result of the
16101ce939a7SSimon J. Gerraty.Ql :S
16111ce939a7SSimon J. Gerratymodifier which is later referenced using the index values from
16121ce939a7SSimon J. Gerraty.Ql :range .
1613*954401e6SSimon J. Gerraty.It Cm \&:U\| Ns Ar newval
16142c3632d1SSimon J. GerratyIf the variable is undefined,
16153955d011SMarcel Moolenaar.Ar newval
16163955d011SMarcel Moolenaaris the value.
16173955d011SMarcel MoolenaarIf the variable is defined, the existing value is returned.
16183955d011SMarcel MoolenaarThis is another ODE make feature.
16193955d011SMarcel MoolenaarIt is handy for setting per-target CFLAGS for instance:
16203955d011SMarcel Moolenaar.Dl ${_${.TARGET:T}_CFLAGS:U${DEF_CFLAGS}}
16213955d011SMarcel MoolenaarIf a value is only required if the variable is undefined, use:
16223955d011SMarcel Moolenaar.Dl ${VAR:D:Unewval}
1623*954401e6SSimon J. Gerraty.It Cm \&:D\| Ns Ar newval
16242c3632d1SSimon J. GerratyIf the variable is defined,
16253955d011SMarcel Moolenaar.Ar newval
16263955d011SMarcel Moolenaaris the value.
16273955d011SMarcel Moolenaar.It Cm \&:L
16283955d011SMarcel MoolenaarThe name of the variable is the value.
16293955d011SMarcel Moolenaar.It Cm \&:P
16303955d011SMarcel MoolenaarThe path of the node which has the same name as the variable
16313955d011SMarcel Moolenaaris the value.
16323955d011SMarcel MoolenaarIf no such node exists or its path is null, then the
16333955d011SMarcel Moolenaarname of the variable is used.
16343955d011SMarcel MoolenaarIn order for this modifier to work, the name (node) must at least have
16353955d011SMarcel Moolenaarappeared on the rhs of a dependency.
16363955d011SMarcel Moolenaar.Sm off
1637*954401e6SSimon J. Gerraty.It Cm \&:\&! Ar cmd\| Cm \&!
16383955d011SMarcel Moolenaar.Sm on
16393955d011SMarcel MoolenaarThe output of running
16403955d011SMarcel Moolenaar.Ar cmd
16413955d011SMarcel Moolenaaris the value.
16423955d011SMarcel Moolenaar.It Cm \&:sh
16433955d011SMarcel MoolenaarIf the variable is non-empty it is run as a command and the output
16443955d011SMarcel Moolenaarbecomes the new value.
16453955d011SMarcel Moolenaar.It Cm \&::= Ns Ar str
16463955d011SMarcel MoolenaarThe variable is assigned the value
16473955d011SMarcel Moolenaar.Ar str
16483955d011SMarcel Moolenaarafter substitution.
16493955d011SMarcel MoolenaarThis modifier and its variations are useful in
16503955d011SMarcel Moolenaarobscure situations such as wanting to set a variable when shell commands
16513955d011SMarcel Moolenaarare being parsed.
16523955d011SMarcel MoolenaarThese assignment modifiers always expand to
16533955d011SMarcel Moolenaarnothing, so if appearing in a rule line by themselves should be
16543955d011SMarcel Moolenaarpreceded with something to keep
16553955d011SMarcel Moolenaar.Nm
16563955d011SMarcel Moolenaarhappy.
16573955d011SMarcel Moolenaar.Pp
16583955d011SMarcel MoolenaarThe
1659*954401e6SSimon J. Gerraty.Sq Cm \&::
16603955d011SMarcel Moolenaarhelps avoid false matches with the
16613955d011SMarcel Moolenaar.At V
16623955d011SMarcel Moolenaarstyle
16633955d011SMarcel Moolenaar.Cm \&:=
16643955d011SMarcel Moolenaarmodifier and since substitution always occurs the
16653955d011SMarcel Moolenaar.Cm \&::=
16663955d011SMarcel Moolenaarform is vaguely appropriate.
16673955d011SMarcel Moolenaar.It Cm \&::?= Ns Ar str
16683955d011SMarcel MoolenaarAs for
16693955d011SMarcel Moolenaar.Cm \&::=
16703955d011SMarcel Moolenaarbut only if the variable does not already have a value.
16713955d011SMarcel Moolenaar.It Cm \&::+= Ns Ar str
16723955d011SMarcel MoolenaarAppend
16733955d011SMarcel Moolenaar.Ar str
16743955d011SMarcel Moolenaarto the variable.
16753955d011SMarcel Moolenaar.It Cm \&::!= Ns Ar cmd
16763955d011SMarcel MoolenaarAssign the output of
16773955d011SMarcel Moolenaar.Ar cmd
16783955d011SMarcel Moolenaarto the variable.
16793955d011SMarcel Moolenaar.It Cm \&:\&[ Ns Ar range Ns Cm \&]
16803955d011SMarcel MoolenaarSelects one or more words from the value,
16813955d011SMarcel Moolenaaror performs other operations related to the way in which the
16823955d011SMarcel Moolenaarvalue is divided into words.
16833955d011SMarcel Moolenaar.Pp
16843955d011SMarcel MoolenaarOrdinarily, a value is treated as a sequence of words
16853955d011SMarcel Moolenaardelimited by white space.
1686be19d90bSSimon J. GerratySome modifiers suppress this behavior,
16873955d011SMarcel Moolenaarcausing a value to be treated as a single word
16883955d011SMarcel Moolenaar(possibly containing embedded white space).
16893955d011SMarcel MoolenaarAn empty value, or a value that consists entirely of white-space,
16903955d011SMarcel Moolenaaris treated as a single word.
16913955d011SMarcel MoolenaarFor the purposes of the
1692*954401e6SSimon J. Gerraty.Sq Cm \&:[]
16933955d011SMarcel Moolenaarmodifier, the words are indexed both forwards using positive integers
16943955d011SMarcel Moolenaar(where index 1 represents the first word),
16953955d011SMarcel Moolenaarand backwards using negative integers
16963955d011SMarcel Moolenaar(where index \-1 represents the last word).
16973955d011SMarcel Moolenaar.Pp
16983955d011SMarcel MoolenaarThe
16993955d011SMarcel Moolenaar.Ar range
17003955d011SMarcel Moolenaaris subjected to variable expansion, and the expanded result is
17013955d011SMarcel Moolenaarthen interpreted as follows:
17023955d011SMarcel Moolenaar.Bl -tag -width index
17033955d011SMarcel Moolenaar.\" :[n]
17043955d011SMarcel Moolenaar.It Ar index
17053955d011SMarcel MoolenaarSelects a single word from the value.
17063955d011SMarcel Moolenaar.\" :[start..end]
17073955d011SMarcel Moolenaar.It Ar start Ns Cm \&.. Ns Ar end
17083955d011SMarcel MoolenaarSelects all words from
17093955d011SMarcel Moolenaar.Ar start
17103955d011SMarcel Moolenaarto
17113955d011SMarcel Moolenaar.Ar end ,
17123955d011SMarcel Moolenaarinclusive.
17133955d011SMarcel MoolenaarFor example,
1714*954401e6SSimon J. Gerraty.Sq Cm \&:[2..-1]
17153955d011SMarcel Moolenaarselects all words from the second word to the last word.
17163955d011SMarcel MoolenaarIf
17173955d011SMarcel Moolenaar.Ar start
17183955d011SMarcel Moolenaaris greater than
17193955d011SMarcel Moolenaar.Ar end ,
17203955d011SMarcel Moolenaarthen the words are output in reverse order.
17213955d011SMarcel MoolenaarFor example,
1722*954401e6SSimon J. Gerraty.Sq Cm \&:[-1..1]
17233955d011SMarcel Moolenaarselects all the words from last to first.
1724ef0b2538SSimon J. GerratyIf the list is already ordered, then this effectively reverses
1725ef0b2538SSimon J. Gerratythe list, but it is more efficient to use
1726*954401e6SSimon J. Gerraty.Sq Cm \&:Or
1727ef0b2538SSimon J. Gerratyinstead of
1728*954401e6SSimon J. Gerraty.Sq Cm \&:O:[-1..1] .
17293955d011SMarcel Moolenaar.\" :[*]
17303955d011SMarcel Moolenaar.It Cm \&*
17313955d011SMarcel MoolenaarCauses subsequent modifiers to treat the value as a single word
17323955d011SMarcel Moolenaar(possibly containing embedded white space).
17333955d011SMarcel MoolenaarAnalogous to the effect of
17343955d011SMarcel Moolenaar\&"$*\&"
17353955d011SMarcel Moolenaarin Bourne shell.
17363955d011SMarcel Moolenaar.\" :[0]
17373955d011SMarcel Moolenaar.It 0
17383955d011SMarcel MoolenaarMeans the same as
1739*954401e6SSimon J. Gerraty.Sq Cm \&:[*] .
17403955d011SMarcel Moolenaar.\" :[*]
17413955d011SMarcel Moolenaar.It Cm \&@
17423955d011SMarcel MoolenaarCauses subsequent modifiers to treat the value as a sequence of words
17433955d011SMarcel Moolenaardelimited by white space.
17443955d011SMarcel MoolenaarAnalogous to the effect of
17453955d011SMarcel Moolenaar\&"$@\&"
17463955d011SMarcel Moolenaarin Bourne shell.
17473955d011SMarcel Moolenaar.\" :[#]
17483955d011SMarcel Moolenaar.It Cm \&#
17493955d011SMarcel MoolenaarReturns the number of words in the value.
17503955d011SMarcel Moolenaar.El \" :[range]
17513955d011SMarcel Moolenaar.El
17523955d011SMarcel Moolenaar.Sh INCLUDE STATEMENTS, CONDITIONALS AND FOR LOOPS
17533955d011SMarcel MoolenaarMakefile inclusion, conditional structures and for loops reminiscent
17543955d011SMarcel Moolenaarof the C programming language are provided in
17553955d011SMarcel Moolenaar.Nm .
17563955d011SMarcel MoolenaarAll such structures are identified by a line beginning with a single
17573955d011SMarcel Moolenaardot
17583955d011SMarcel Moolenaar.Pq Ql \&.
17593955d011SMarcel Moolenaarcharacter.
17603955d011SMarcel MoolenaarFiles are included with either
176149caa483SSimon J. Gerraty.Cm \&.include \&< Ns Ar file Ns Cm \&>
17623955d011SMarcel Moolenaaror
176349caa483SSimon J. Gerraty.Cm \&.include \&\*q Ns Ar file Ns Cm \&\*q .
17643955d011SMarcel MoolenaarVariables between the angle brackets or double quotes are expanded
17653955d011SMarcel Moolenaarto form the file name.
17663955d011SMarcel MoolenaarIf angle brackets are used, the included makefile is expected to be in
17673955d011SMarcel Moolenaarthe system makefile directory.
17683955d011SMarcel MoolenaarIf double quotes are used, the including makefile's directory and any
17693955d011SMarcel Moolenaardirectories specified using the
17703955d011SMarcel Moolenaar.Fl I
17713955d011SMarcel Moolenaaroption are searched before the system
17723955d011SMarcel Moolenaarmakefile directory.
17733955d011SMarcel MoolenaarFor compatibility with other versions of
17743955d011SMarcel Moolenaar.Nm
17753955d011SMarcel Moolenaar.Ql include file ...
17763955d011SMarcel Moolenaaris also accepted.
1777be19d90bSSimon J. Gerraty.Pp
17783955d011SMarcel MoolenaarIf the include statement is written as
17793955d011SMarcel Moolenaar.Cm .-include
17803955d011SMarcel Moolenaaror as
17813955d011SMarcel Moolenaar.Cm .sinclude
17823955d011SMarcel Moolenaarthen errors locating and/or opening include files are ignored.
17833955d011SMarcel Moolenaar.Pp
1784be19d90bSSimon J. GerratyIf the include statement is written as
1785be19d90bSSimon J. Gerraty.Cm .dinclude
1786be19d90bSSimon J. Gerratynot only are errors locating and/or opening include files ignored,
1787be19d90bSSimon J. Gerratybut stale dependencies within the included file will be ignored
1788be19d90bSSimon J. Gerratyjust like
1789be19d90bSSimon J. Gerraty.Va .MAKE.DEPENDFILE .
1790be19d90bSSimon J. Gerraty.Pp
17913955d011SMarcel MoolenaarConditional expressions are also preceded by a single dot as the first
17923955d011SMarcel Moolenaarcharacter of a line.
17933955d011SMarcel MoolenaarThe possible conditionals are as follows:
17943955d011SMarcel Moolenaar.Bl -tag -width Ds
17953955d011SMarcel Moolenaar.It Ic .error Ar message
17963955d011SMarcel MoolenaarThe message is printed along with the name of the makefile and line number,
17973955d011SMarcel Moolenaarthen
17983955d011SMarcel Moolenaar.Nm
17992c3632d1SSimon J. Gerratywill exit immediately.
18003955d011SMarcel Moolenaar.It Ic .export Ar variable ...
18013955d011SMarcel MoolenaarExport the specified global variable.
18023955d011SMarcel MoolenaarIf no variable list is provided, all globals are exported
18033955d011SMarcel Moolenaarexcept for internal variables (those that start with
18043955d011SMarcel Moolenaar.Ql \&. ) .
18053955d011SMarcel MoolenaarThis is not affected by the
18063955d011SMarcel Moolenaar.Fl X
18073955d011SMarcel Moolenaarflag, so should be used with caution.
18083955d011SMarcel MoolenaarFor compatibility with other
18093955d011SMarcel Moolenaar.Nm
18103955d011SMarcel Moolenaarprograms
18113955d011SMarcel Moolenaar.Ql export variable=value
18123955d011SMarcel Moolenaaris also accepted.
18133955d011SMarcel Moolenaar.Pp
18143955d011SMarcel MoolenaarAppending a variable name to
18153955d011SMarcel Moolenaar.Va .MAKE.EXPORTED
18163955d011SMarcel Moolenaaris equivalent to exporting a variable.
18173955d011SMarcel Moolenaar.It Ic .export-env Ar variable ...
18183955d011SMarcel MoolenaarThe same as
18193955d011SMarcel Moolenaar.Ql .export ,
18203955d011SMarcel Moolenaarexcept that the variable is not appended to
18213955d011SMarcel Moolenaar.Va .MAKE.EXPORTED .
18223955d011SMarcel MoolenaarThis allows exporting a value to the environment which is different from that
18233955d011SMarcel Moolenaarused by
18243955d011SMarcel Moolenaar.Nm
18253955d011SMarcel Moolenaarinternally.
1826be19d90bSSimon J. Gerraty.It Ic .export-literal Ar variable ...
1827be19d90bSSimon J. GerratyThe same as
1828be19d90bSSimon J. Gerraty.Ql .export-env ,
1829be19d90bSSimon J. Gerratyexcept that variables in the value are not expanded.
18303955d011SMarcel Moolenaar.It Ic .info Ar message
18313955d011SMarcel MoolenaarThe message is printed along with the name of the makefile and line number.
183206b9b3e0SSimon J. Gerraty.It Ic .undef Ar variable ...
183306b9b3e0SSimon J. GerratyUn-define the specified global variables.
183406b9b3e0SSimon J. GerratyOnly global variables can be un-defined.
18353955d011SMarcel Moolenaar.It Ic .unexport Ar variable ...
18363955d011SMarcel MoolenaarThe opposite of
18373955d011SMarcel Moolenaar.Ql .export .
18383955d011SMarcel MoolenaarThe specified global
18393955d011SMarcel Moolenaar.Va variable
18403955d011SMarcel Moolenaarwill be removed from
18413955d011SMarcel Moolenaar.Va .MAKE.EXPORTED .
18423955d011SMarcel MoolenaarIf no variable list is provided, all globals are unexported,
18433955d011SMarcel Moolenaarand
18443955d011SMarcel Moolenaar.Va .MAKE.EXPORTED
18453955d011SMarcel Moolenaardeleted.
18463955d011SMarcel Moolenaar.It Ic .unexport-env
18473955d011SMarcel MoolenaarUnexport all globals previously exported and
18483955d011SMarcel Moolenaarclear the environment inherited from the parent.
18493955d011SMarcel MoolenaarThis operation will cause a memory leak of the original environment,
18503955d011SMarcel Moolenaarso should be used sparingly.
18513955d011SMarcel MoolenaarTesting for
18523955d011SMarcel Moolenaar.Va .MAKE.LEVEL
18533955d011SMarcel Moolenaarbeing 0, would make sense.
18543955d011SMarcel MoolenaarAlso note that any variables which originated in the parent environment
18553955d011SMarcel Moolenaarshould be explicitly preserved if desired.
18563955d011SMarcel MoolenaarFor example:
18573955d011SMarcel Moolenaar.Bd -literal -offset indent
18583955d011SMarcel Moolenaar.Li .if ${.MAKE.LEVEL} == 0
18593955d011SMarcel MoolenaarPATH := ${PATH}
18603955d011SMarcel Moolenaar.Li .unexport-env
18613955d011SMarcel Moolenaar.Li .export PATH
18623955d011SMarcel Moolenaar.Li .endif
18633955d011SMarcel Moolenaar.Pp
18643955d011SMarcel Moolenaar.Ed
18653955d011SMarcel MoolenaarWould result in an environment containing only
1866*954401e6SSimon J. Gerraty.Sq Ev PATH ,
18673955d011SMarcel Moolenaarwhich is the minimal useful environment.
18683955d011SMarcel MoolenaarActually
1869*954401e6SSimon J. Gerraty.Sq Ev .MAKE.LEVEL
18703955d011SMarcel Moolenaarwill also be pushed into the new environment.
18713955d011SMarcel Moolenaar.It Ic .warning Ar message
18723955d011SMarcel MoolenaarThe message prefixed by
1873*954401e6SSimon J. Gerraty.Sq Pa warning:
18743955d011SMarcel Moolenaaris printed along with the name of the makefile and line number.
18753955d011SMarcel Moolenaar.It Ic \&.if Oo \&! Oc Ns Ar expression Op Ar operator expression ...
18763955d011SMarcel MoolenaarTest the value of an expression.
18773955d011SMarcel Moolenaar.It Ic .ifdef Oo \&! Oc Ns Ar variable Op Ar operator variable ...
18783955d011SMarcel MoolenaarTest the value of a variable.
18793955d011SMarcel Moolenaar.It Ic .ifndef Oo \&! Oc Ns Ar variable Op Ar operator variable ...
18803955d011SMarcel MoolenaarTest the value of a variable.
18813955d011SMarcel Moolenaar.It Ic .ifmake Oo \&! Oc Ns Ar target Op Ar operator target ...
18823955d011SMarcel MoolenaarTest the target being built.
18833955d011SMarcel Moolenaar.It Ic .ifnmake Oo \&! Ns Oc Ar target Op Ar operator target ...
18843955d011SMarcel MoolenaarTest the target being built.
18853955d011SMarcel Moolenaar.It Ic .else
18863955d011SMarcel MoolenaarReverse the sense of the last conditional.
18873955d011SMarcel Moolenaar.It Ic .elif Oo \&! Ns Oc Ar expression Op Ar operator expression ...
18883955d011SMarcel MoolenaarA combination of
1889*954401e6SSimon J. Gerraty.Sq Ic .else
18903955d011SMarcel Moolenaarfollowed by
1891*954401e6SSimon J. Gerraty.Sq Ic .if .
18923955d011SMarcel Moolenaar.It Ic .elifdef Oo \&! Oc Ns Ar variable Op Ar operator variable ...
18933955d011SMarcel MoolenaarA combination of
1894*954401e6SSimon J. Gerraty.Sq Ic .else
18953955d011SMarcel Moolenaarfollowed by
1896*954401e6SSimon J. Gerraty.Sq Ic .ifdef .
18973955d011SMarcel Moolenaar.It Ic .elifndef Oo \&! Oc Ns Ar variable Op Ar operator variable ...
18983955d011SMarcel MoolenaarA combination of
1899*954401e6SSimon J. Gerraty.Sq Ic .else
19003955d011SMarcel Moolenaarfollowed by
1901*954401e6SSimon J. Gerraty.Sq Ic .ifndef .
19023955d011SMarcel Moolenaar.It Ic .elifmake Oo \&! Oc Ns Ar target Op Ar operator target ...
19033955d011SMarcel MoolenaarA combination of
1904*954401e6SSimon J. Gerraty.Sq Ic .else
19053955d011SMarcel Moolenaarfollowed by
1906*954401e6SSimon J. Gerraty.Sq Ic .ifmake .
19073955d011SMarcel Moolenaar.It Ic .elifnmake Oo \&! Oc Ns Ar target Op Ar operator target ...
19083955d011SMarcel MoolenaarA combination of
1909*954401e6SSimon J. Gerraty.Sq Ic .else
19103955d011SMarcel Moolenaarfollowed by
1911*954401e6SSimon J. Gerraty.Sq Ic .ifnmake .
19123955d011SMarcel Moolenaar.It Ic .endif
19133955d011SMarcel MoolenaarEnd the body of the conditional.
19143955d011SMarcel Moolenaar.El
19153955d011SMarcel Moolenaar.Pp
19163955d011SMarcel MoolenaarThe
19173955d011SMarcel Moolenaar.Ar operator
19183955d011SMarcel Moolenaarmay be any one of the following:
19193955d011SMarcel Moolenaar.Bl -tag -width "Cm XX"
19203955d011SMarcel Moolenaar.It Cm \&|\&|
19213955d011SMarcel MoolenaarLogical OR.
19228695518cSSimon J. Gerraty.It Cm \&&&
19233955d011SMarcel MoolenaarLogical
19243955d011SMarcel Moolenaar.Tn AND ;
19253955d011SMarcel Moolenaarof higher precedence than
19263955d011SMarcel Moolenaar.Dq \&|\&| .
19273955d011SMarcel Moolenaar.El
19283955d011SMarcel Moolenaar.Pp
19293955d011SMarcel MoolenaarAs in C,
19303955d011SMarcel Moolenaar.Nm
19313955d011SMarcel Moolenaarwill only evaluate a conditional as far as is necessary to determine
19323955d011SMarcel Moolenaarits value.
19333955d011SMarcel MoolenaarParentheses may be used to change the order of evaluation.
19343955d011SMarcel MoolenaarThe boolean operator
1935*954401e6SSimon J. Gerraty.Sq Ic \&!
19363955d011SMarcel Moolenaarmay be used to logically negate an entire
19373955d011SMarcel Moolenaarconditional.
19383955d011SMarcel MoolenaarIt is of higher precedence than
1939*954401e6SSimon J. Gerraty.Sq Ic \&&& .
19403955d011SMarcel Moolenaar.Pp
19413955d011SMarcel MoolenaarThe value of
19423955d011SMarcel Moolenaar.Ar expression
19433955d011SMarcel Moolenaarmay be any of the following:
19443955d011SMarcel Moolenaar.Bl -tag -width defined
19453955d011SMarcel Moolenaar.It Ic defined
19463955d011SMarcel MoolenaarTakes a variable name as an argument and evaluates to true if the variable
19473955d011SMarcel Moolenaarhas been defined.
19483955d011SMarcel Moolenaar.It Ic make
19493955d011SMarcel MoolenaarTakes a target name as an argument and evaluates to true if the target
19503955d011SMarcel Moolenaarwas specified as part of
19513955d011SMarcel Moolenaar.Nm Ns 's
19523955d011SMarcel Moolenaarcommand line or was declared the default target (either implicitly or
19533955d011SMarcel Moolenaarexplicitly, see
19543955d011SMarcel Moolenaar.Va .MAIN )
19553955d011SMarcel Moolenaarbefore the line containing the conditional.
19563955d011SMarcel Moolenaar.It Ic empty
19573955d011SMarcel MoolenaarTakes a variable, with possible modifiers, and evaluates to true if
19583955d011SMarcel Moolenaarthe expansion of the variable would result in an empty string.
19593955d011SMarcel Moolenaar.It Ic exists
19603955d011SMarcel MoolenaarTakes a file name as an argument and evaluates to true if the file exists.
19613955d011SMarcel MoolenaarThe file is searched for on the system search path (see
19623955d011SMarcel Moolenaar.Va .PATH ) .
19633955d011SMarcel Moolenaar.It Ic target
19643955d011SMarcel MoolenaarTakes a target name as an argument and evaluates to true if the target
19653955d011SMarcel Moolenaarhas been defined.
19663955d011SMarcel Moolenaar.It Ic commands
19673955d011SMarcel MoolenaarTakes a target name as an argument and evaluates to true if the target
19683955d011SMarcel Moolenaarhas been defined and has commands associated with it.
19693955d011SMarcel Moolenaar.El
19703955d011SMarcel Moolenaar.Pp
19713955d011SMarcel Moolenaar.Ar Expression
19723955d011SMarcel Moolenaarmay also be an arithmetic or string comparison.
19733955d011SMarcel MoolenaarVariable expansion is
1974956e45f6SSimon J. Gerratyperformed on both sides of the comparison, after which the numerical
19753955d011SMarcel Moolenaarvalues are compared.
19763955d011SMarcel MoolenaarA value is interpreted as hexadecimal if it is
19773955d011SMarcel Moolenaarpreceded by 0x, otherwise it is decimal; octal numbers are not supported.
19783955d011SMarcel MoolenaarThe standard C relational operators are all supported.
19793955d011SMarcel MoolenaarIf after
19803955d011SMarcel Moolenaarvariable expansion, either the left or right hand side of a
1981*954401e6SSimon J. Gerraty.Sq Ic ==
19823955d011SMarcel Moolenaaror
1983*954401e6SSimon J. Gerraty.Sq Ic "!="
1984956e45f6SSimon J. Gerratyoperator is not a numerical value, then
19853955d011SMarcel Moolenaarstring comparison is performed between the expanded
19863955d011SMarcel Moolenaarvariables.
19873955d011SMarcel MoolenaarIf no relational operator is given, it is assumed that the expanded
19882c3632d1SSimon J. Gerratyvariable is being compared against 0, or an empty string in the case
19893955d011SMarcel Moolenaarof a string comparison.
19903955d011SMarcel Moolenaar.Pp
19913955d011SMarcel MoolenaarWhen
19923955d011SMarcel Moolenaar.Nm
19933955d011SMarcel Moolenaaris evaluating one of these conditional expressions, and it encounters
19943955d011SMarcel Moolenaara (white-space separated) word it doesn't recognize, either the
19953955d011SMarcel Moolenaar.Dq make
19963955d011SMarcel Moolenaaror
19973955d011SMarcel Moolenaar.Dq defined
19983955d011SMarcel Moolenaarexpression is applied to it, depending on the form of the conditional.
19993955d011SMarcel MoolenaarIf the form is
2000*954401e6SSimon J. Gerraty.Sq Ic .ifdef ,
2001*954401e6SSimon J. Gerraty.Sq Ic .ifndef ,
20023955d011SMarcel Moolenaaror
2003*954401e6SSimon J. Gerraty.Sq Ic .if
20043955d011SMarcel Moolenaarthe
20053955d011SMarcel Moolenaar.Dq defined
20063955d011SMarcel Moolenaarexpression is applied.
20073955d011SMarcel MoolenaarSimilarly, if the form is
2008*954401e6SSimon J. Gerraty.Sq Ic .ifmake
20093955d011SMarcel Moolenaaror
2010*954401e6SSimon J. Gerraty.Sq Ic .ifnmake ,
2011494f7191SSimon J. Gerratythe
20123955d011SMarcel Moolenaar.Dq make
20133955d011SMarcel Moolenaarexpression is applied.
20143955d011SMarcel Moolenaar.Pp
20153955d011SMarcel MoolenaarIf the conditional evaluates to true the parsing of the makefile continues
20163955d011SMarcel Moolenaaras before.
20173955d011SMarcel MoolenaarIf it evaluates to false, the following lines are skipped.
20183955d011SMarcel MoolenaarIn both cases this continues until a
2019*954401e6SSimon J. Gerraty.Sq Ic .else
20203955d011SMarcel Moolenaaror
2021*954401e6SSimon J. Gerraty.Sq Ic .endif
20223955d011SMarcel Moolenaaris found.
20233955d011SMarcel Moolenaar.Pp
20243955d011SMarcel MoolenaarFor loops are typically used to apply a set of rules to a list of files.
20253955d011SMarcel MoolenaarThe syntax of a for loop is:
20263955d011SMarcel Moolenaar.Pp
20273955d011SMarcel Moolenaar.Bl -tag -compact -width Ds
20283955d011SMarcel Moolenaar.It Ic \&.for Ar variable Oo Ar variable ... Oc Ic in Ar expression
20292c3632d1SSimon J. Gerraty.It Aq make-lines
20303955d011SMarcel Moolenaar.It Ic \&.endfor
20313955d011SMarcel Moolenaar.El
20323955d011SMarcel Moolenaar.Pp
20333955d011SMarcel MoolenaarAfter the for
20343955d011SMarcel Moolenaar.Ic expression
20353955d011SMarcel Moolenaaris evaluated, it is split into words.
20363955d011SMarcel MoolenaarOn each iteration of the loop, one word is taken and assigned to each
20373955d011SMarcel Moolenaar.Ic variable ,
20383955d011SMarcel Moolenaarin order, and these
20393955d011SMarcel Moolenaar.Ic variables
20403955d011SMarcel Moolenaarare substituted into the
20412c3632d1SSimon J. Gerraty.Ic make-lines
20423955d011SMarcel Moolenaarinside the body of the for loop.
20433955d011SMarcel MoolenaarThe number of words must come out even; that is, if there are three
20443955d011SMarcel Moolenaariteration variables, the number of words provided must be a multiple
20453955d011SMarcel Moolenaarof three.
20463955d011SMarcel Moolenaar.Sh COMMENTS
20473955d011SMarcel MoolenaarComments begin with a hash
20483955d011SMarcel Moolenaar.Pq Ql \&#
20493955d011SMarcel Moolenaarcharacter, anywhere but in a shell
20503955d011SMarcel Moolenaarcommand line, and continue to the end of an unescaped new line.
20513955d011SMarcel Moolenaar.Sh SPECIAL SOURCES (ATTRIBUTES)
20523955d011SMarcel Moolenaar.Bl -tag -width .IGNOREx
20533955d011SMarcel Moolenaar.It Ic .EXEC
20543955d011SMarcel MoolenaarTarget is never out of date, but always execute commands anyway.
20553955d011SMarcel Moolenaar.It Ic .IGNORE
20563955d011SMarcel MoolenaarIgnore any errors from the commands associated with this target, exactly
20573955d011SMarcel Moolenaaras if they all were preceded by a dash
20583955d011SMarcel Moolenaar.Pq Ql \- .
20593955d011SMarcel Moolenaar.\" .It Ic .INVISIBLE
20603955d011SMarcel Moolenaar.\" XXX
20613955d011SMarcel Moolenaar.\" .It Ic .JOIN
20623955d011SMarcel Moolenaar.\" XXX
20633955d011SMarcel Moolenaar.It Ic .MADE
20643955d011SMarcel MoolenaarMark all sources of this target as being up-to-date.
20653955d011SMarcel Moolenaar.It Ic .MAKE
20663955d011SMarcel MoolenaarExecute the commands associated with this target even if the
20673955d011SMarcel Moolenaar.Fl n
20683955d011SMarcel Moolenaaror
20693955d011SMarcel Moolenaar.Fl t
20703955d011SMarcel Moolenaaroptions were specified.
20713955d011SMarcel MoolenaarNormally used to mark recursive
20720dede8b0SSimon J. Gerraty.Nm Ns s .
20733955d011SMarcel Moolenaar.It Ic .META
20743955d011SMarcel MoolenaarCreate a meta file for the target, even if it is flagged as
20753955d011SMarcel Moolenaar.Ic .PHONY ,
20763955d011SMarcel Moolenaar.Ic .MAKE ,
20773955d011SMarcel Moolenaaror
20783955d011SMarcel Moolenaar.Ic .SPECIAL .
20793955d011SMarcel MoolenaarUsage in conjunction with
20803955d011SMarcel Moolenaar.Ic .MAKE
20813955d011SMarcel Moolenaaris the most likely case.
20823955d011SMarcel MoolenaarIn "meta" mode, the target is out-of-date if the meta file is missing.
20833955d011SMarcel Moolenaar.It Ic .NOMETA
20843955d011SMarcel MoolenaarDo not create a meta file for the target.
20853955d011SMarcel MoolenaarMeta files are also not created for
20863955d011SMarcel Moolenaar.Ic .PHONY ,
20873955d011SMarcel Moolenaar.Ic .MAKE ,
20883955d011SMarcel Moolenaaror
20893955d011SMarcel Moolenaar.Ic .SPECIAL
20903955d011SMarcel Moolenaartargets.
20913955d011SMarcel Moolenaar.It Ic .NOMETA_CMP
20923955d011SMarcel MoolenaarIgnore differences in commands when deciding if target is out of date.
20933955d011SMarcel MoolenaarThis is useful if the command contains a value which always changes.
20943955d011SMarcel MoolenaarIf the number of commands change, though, the target will still be out of date.
20951748de26SSimon J. GerratyThe same effect applies to any command line that uses the variable
20961748de26SSimon J. Gerraty.Va .OODATE ,
20971748de26SSimon J. Gerratywhich can be used for that purpose even when not otherwise needed or desired:
20981748de26SSimon J. Gerraty.Bd -literal -offset indent
20991748de26SSimon J. Gerraty
21001748de26SSimon J. Gerratyskip-compare-for-some:
21011748de26SSimon J. Gerraty	@echo this will be compared
21021748de26SSimon J. Gerraty	@echo this will not ${.OODATE:M.NOMETA_CMP}
21031748de26SSimon J. Gerraty	@echo this will also be compared
21041748de26SSimon J. Gerraty
21051748de26SSimon J. Gerraty.Ed
21061748de26SSimon J. GerratyThe
21071748de26SSimon J. Gerraty.Cm \&:M
21081748de26SSimon J. Gerratypattern suppresses any expansion of the unwanted variable.
21093955d011SMarcel Moolenaar.It Ic .NOPATH
21103955d011SMarcel MoolenaarDo not search for the target in the directories specified by
21113955d011SMarcel Moolenaar.Ic .PATH .
21123955d011SMarcel Moolenaar.It Ic .NOTMAIN
21133955d011SMarcel MoolenaarNormally
21143955d011SMarcel Moolenaar.Nm
21153955d011SMarcel Moolenaarselects the first target it encounters as the default target to be built
21163955d011SMarcel Moolenaarif no target was specified.
21173955d011SMarcel MoolenaarThis source prevents this target from being selected.
21183955d011SMarcel Moolenaar.It Ic .OPTIONAL
21193955d011SMarcel MoolenaarIf a target is marked with this attribute and
21203955d011SMarcel Moolenaar.Nm
21213955d011SMarcel Moolenaarcan't figure out how to create it, it will ignore this fact and assume
21223955d011SMarcel Moolenaarthe file isn't needed or already exists.
21233955d011SMarcel Moolenaar.It Ic .PHONY
21243955d011SMarcel MoolenaarThe target does not
21253955d011SMarcel Moolenaarcorrespond to an actual file; it is always considered to be out of date,
21263955d011SMarcel Moolenaarand will not be created with the
21273955d011SMarcel Moolenaar.Fl t
21283955d011SMarcel Moolenaaroption.
21293955d011SMarcel MoolenaarSuffix-transformation rules are not applied to
21303955d011SMarcel Moolenaar.Ic .PHONY
21313955d011SMarcel Moolenaartargets.
21323955d011SMarcel Moolenaar.It Ic .PRECIOUS
21333955d011SMarcel MoolenaarWhen
21343955d011SMarcel Moolenaar.Nm
21353955d011SMarcel Moolenaaris interrupted, it normally removes any partially made targets.
21363955d011SMarcel MoolenaarThis source prevents the target from being removed.
21373955d011SMarcel Moolenaar.It Ic .RECURSIVE
21383955d011SMarcel MoolenaarSynonym for
21393955d011SMarcel Moolenaar.Ic .MAKE .
21403955d011SMarcel Moolenaar.It Ic .SILENT
21413955d011SMarcel MoolenaarDo not echo any of the commands associated with this target, exactly
21423955d011SMarcel Moolenaaras if they all were preceded by an at sign
21433955d011SMarcel Moolenaar.Pq Ql @ .
21443955d011SMarcel Moolenaar.It Ic .USE
21453955d011SMarcel MoolenaarTurn the target into
21463955d011SMarcel Moolenaar.Nm Ns 's
21473955d011SMarcel Moolenaarversion of a macro.
21483955d011SMarcel MoolenaarWhen the target is used as a source for another target, the other target
21493955d011SMarcel Moolenaaracquires the commands, sources, and attributes (except for
21503955d011SMarcel Moolenaar.Ic .USE )
21513955d011SMarcel Moolenaarof the
21523955d011SMarcel Moolenaarsource.
21533955d011SMarcel MoolenaarIf the target already has commands, the
21543955d011SMarcel Moolenaar.Ic .USE
21553955d011SMarcel Moolenaartarget's commands are appended
21563955d011SMarcel Moolenaarto them.
21573955d011SMarcel Moolenaar.It Ic .USEBEFORE
21583955d011SMarcel MoolenaarExactly like
21593955d011SMarcel Moolenaar.Ic .USE ,
21603955d011SMarcel Moolenaarbut prepend the
21613955d011SMarcel Moolenaar.Ic .USEBEFORE
21623955d011SMarcel Moolenaartarget commands to the target.
21633955d011SMarcel Moolenaar.It Ic .WAIT
21643955d011SMarcel MoolenaarIf
21653955d011SMarcel Moolenaar.Ic .WAIT
21663955d011SMarcel Moolenaarappears in a dependency line, the sources that precede it are
21673955d011SMarcel Moolenaarmade before the sources that succeed it in the line.
21683955d011SMarcel MoolenaarSince the dependents of files are not made until the file itself
21693955d011SMarcel Moolenaarcould be made, this also stops the dependents being built unless they
21703955d011SMarcel Moolenaarare needed for another branch of the dependency tree.
21713955d011SMarcel MoolenaarSo given:
21723955d011SMarcel Moolenaar.Bd -literal
21733955d011SMarcel Moolenaarx: a .WAIT b
21743955d011SMarcel Moolenaar	echo x
21753955d011SMarcel Moolenaara:
21763955d011SMarcel Moolenaar	echo a
21773955d011SMarcel Moolenaarb: b1
21783955d011SMarcel Moolenaar	echo b
21793955d011SMarcel Moolenaarb1:
21803955d011SMarcel Moolenaar	echo b1
21813955d011SMarcel Moolenaar
21823955d011SMarcel Moolenaar.Ed
21833955d011SMarcel Moolenaarthe output is always
21843955d011SMarcel Moolenaar.Ql a ,
21853955d011SMarcel Moolenaar.Ql b1 ,
21863955d011SMarcel Moolenaar.Ql b ,
21873955d011SMarcel Moolenaar.Ql x .
21883955d011SMarcel Moolenaar.br
21893955d011SMarcel MoolenaarThe ordering imposed by
21903955d011SMarcel Moolenaar.Ic .WAIT
21913955d011SMarcel Moolenaaris only relevant for parallel makes.
21923955d011SMarcel Moolenaar.El
21933955d011SMarcel Moolenaar.Sh SPECIAL TARGETS
21943955d011SMarcel MoolenaarSpecial targets may not be included with other targets, i.e. they must be
21953955d011SMarcel Moolenaarthe only target specified.
21963955d011SMarcel Moolenaar.Bl -tag -width .BEGINx
21973955d011SMarcel Moolenaar.It Ic .BEGIN
21983955d011SMarcel MoolenaarAny command lines attached to this target are executed before anything
21993955d011SMarcel Moolenaarelse is done.
22003955d011SMarcel Moolenaar.It Ic .DEFAULT
22013955d011SMarcel MoolenaarThis is sort of a
22023955d011SMarcel Moolenaar.Ic .USE
22033955d011SMarcel Moolenaarrule for any target (that was used only as a
22043955d011SMarcel Moolenaarsource) that
22053955d011SMarcel Moolenaar.Nm
22063955d011SMarcel Moolenaarcan't figure out any other way to create.
22073955d011SMarcel MoolenaarOnly the shell script is used.
22083955d011SMarcel MoolenaarThe
22093955d011SMarcel Moolenaar.Ic .IMPSRC
22103955d011SMarcel Moolenaarvariable of a target that inherits
22113955d011SMarcel Moolenaar.Ic .DEFAULT Ns 's
22123955d011SMarcel Moolenaarcommands is set
22133955d011SMarcel Moolenaarto the target's own name.
221445447996SSimon J. Gerraty.It Ic .DELETE_ON_ERROR
221545447996SSimon J. GerratyIf this target is present in the makefile, it globally causes make to
221645447996SSimon J. Gerratydelete targets whose commands fail.
221745447996SSimon J. Gerraty(By default, only targets whose commands are interrupted during
221845447996SSimon J. Gerratyexecution are deleted.
221945447996SSimon J. GerratyThis is the historical behavior.)
222045447996SSimon J. GerratyThis setting can be used to help prevent half-finished or malformed
222145447996SSimon J. Gerratytargets from being left around and corrupting future rebuilds.
22223955d011SMarcel Moolenaar.It Ic .END
22233955d011SMarcel MoolenaarAny command lines attached to this target are executed after everything
22243955d011SMarcel Moolenaarelse is done.
22253955d011SMarcel Moolenaar.It Ic .ERROR
22263955d011SMarcel MoolenaarAny command lines attached to this target are executed when another target fails.
22273955d011SMarcel MoolenaarThe
22283955d011SMarcel Moolenaar.Ic .ERROR_TARGET
22293955d011SMarcel Moolenaarvariable is set to the target that failed.
22303955d011SMarcel MoolenaarSee also
22313955d011SMarcel Moolenaar.Ic MAKE_PRINT_VAR_ON_ERROR .
22323955d011SMarcel Moolenaar.It Ic .IGNORE
22333955d011SMarcel MoolenaarMark each of the sources with the
22343955d011SMarcel Moolenaar.Ic .IGNORE
22353955d011SMarcel Moolenaarattribute.
22363955d011SMarcel MoolenaarIf no sources are specified, this is the equivalent of specifying the
22373955d011SMarcel Moolenaar.Fl i
22383955d011SMarcel Moolenaaroption.
22393955d011SMarcel Moolenaar.It Ic .INTERRUPT
22403955d011SMarcel MoolenaarIf
22413955d011SMarcel Moolenaar.Nm
22423955d011SMarcel Moolenaaris interrupted, the commands for this target will be executed.
22433955d011SMarcel Moolenaar.It Ic .MAIN
22443955d011SMarcel MoolenaarIf no target is specified when
22453955d011SMarcel Moolenaar.Nm
22463955d011SMarcel Moolenaaris invoked, this target will be built.
22473955d011SMarcel Moolenaar.It Ic .MAKEFLAGS
22483955d011SMarcel MoolenaarThis target provides a way to specify flags for
22493955d011SMarcel Moolenaar.Nm
22503955d011SMarcel Moolenaarwhen the makefile is used.
22513955d011SMarcel MoolenaarThe flags are as if typed to the shell, though the
22523955d011SMarcel Moolenaar.Fl f
22533955d011SMarcel Moolenaaroption will have
22543955d011SMarcel Moolenaarno effect.
22553955d011SMarcel Moolenaar.\" XXX: NOT YET!!!!
22563955d011SMarcel Moolenaar.\" .It Ic .NOTPARALLEL
22573955d011SMarcel Moolenaar.\" The named targets are executed in non parallel mode.
22583955d011SMarcel Moolenaar.\" If no targets are
22593955d011SMarcel Moolenaar.\" specified, then all targets are executed in non parallel mode.
22603955d011SMarcel Moolenaar.It Ic .NOPATH
22613955d011SMarcel MoolenaarApply the
22623955d011SMarcel Moolenaar.Ic .NOPATH
22633955d011SMarcel Moolenaarattribute to any specified sources.
22643955d011SMarcel Moolenaar.It Ic .NOTPARALLEL
22653955d011SMarcel MoolenaarDisable parallel mode.
22663955d011SMarcel Moolenaar.It Ic .NO_PARALLEL
22673955d011SMarcel MoolenaarSynonym for
22683955d011SMarcel Moolenaar.Ic .NOTPARALLEL ,
22693955d011SMarcel Moolenaarfor compatibility with other pmake variants.
2270128a4105SSimon J. Gerraty.It Ic .OBJDIR
2271128a4105SSimon J. GerratyThe source is a new value for
2272*954401e6SSimon J. Gerraty.Sq Va .OBJDIR .
2273128a4105SSimon J. GerratyIf it exists,
2274128a4105SSimon J. Gerraty.Nm
2275128a4105SSimon J. Gerratywill
2276128a4105SSimon J. Gerraty.Xr chdir 2
2277128a4105SSimon J. Gerratyto it and update the value of
2278*954401e6SSimon J. Gerraty.Sq Va .OBJDIR .
22793955d011SMarcel Moolenaar.It Ic .ORDER
2280*954401e6SSimon J. GerratyIn parallel mode, the named targets are made in sequence.
22813955d011SMarcel MoolenaarThis ordering does not add targets to the list of targets to be made.
2282*954401e6SSimon J. Gerraty.Pp
22833955d011SMarcel MoolenaarSince the dependents of a target do not get built until the target itself
22843955d011SMarcel Moolenaarcould be built, unless
22853955d011SMarcel Moolenaar.Ql a
22863955d011SMarcel Moolenaaris built by another part of the dependency graph,
22873955d011SMarcel Moolenaarthe following is a dependency loop:
22883955d011SMarcel Moolenaar.Bd -literal
22893955d011SMarcel Moolenaar\&.ORDER: b a
22903955d011SMarcel Moolenaarb: a
22913955d011SMarcel Moolenaar.Ed
22923955d011SMarcel Moolenaar.Pp
22933955d011SMarcel Moolenaar.\" XXX: NOT YET!!!!
22943955d011SMarcel Moolenaar.\" .It Ic .PARALLEL
22953955d011SMarcel Moolenaar.\" The named targets are executed in parallel mode.
22963955d011SMarcel Moolenaar.\" If no targets are
22973955d011SMarcel Moolenaar.\" specified, then all targets are executed in parallel mode.
22983955d011SMarcel Moolenaar.It Ic .PATH
22993955d011SMarcel MoolenaarThe sources are directories which are to be searched for files not
23003955d011SMarcel Moolenaarfound in the current directory.
23013955d011SMarcel MoolenaarIf no sources are specified, any previously specified directories are
23023955d011SMarcel Moolenaardeleted.
23033955d011SMarcel MoolenaarIf the source is the special
23043955d011SMarcel Moolenaar.Ic .DOTLAST
23053955d011SMarcel Moolenaartarget, then the current working
23063955d011SMarcel Moolenaardirectory is searched last.
23071bbe5942SSimon J. Gerraty.It Ic .PATH. Ns Va suffix
23081bbe5942SSimon J. GerratyLike
23091bbe5942SSimon J. Gerraty.Ic .PATH
23101bbe5942SSimon J. Gerratybut applies only to files with a particular suffix.
23111bbe5942SSimon J. GerratyThe suffix must have been previously declared with
23121bbe5942SSimon J. Gerraty.Ic .SUFFIXES .
23133955d011SMarcel Moolenaar.It Ic .PHONY
23143955d011SMarcel MoolenaarApply the
23153955d011SMarcel Moolenaar.Ic .PHONY
23163955d011SMarcel Moolenaarattribute to any specified sources.
23171d3f2ddcSSimon J. Gerraty.It Ic .POSIX
23182f2a5ecdSSimon J. GerratyIf this is the first non-comment line in the main makefile,
23192f2a5ecdSSimon J. Gerratythe variable
23201d3f2ddcSSimon J. Gerraty.Va %POSIX
23212f2a5ecdSSimon J. Gerratyis set to the value
23222f2a5ecdSSimon J. Gerraty.Ql 1003.2
23232f2a5ecdSSimon J. Gerratyand the makefile
23242f2a5ecdSSimon J. Gerraty.Ql <posix.mk>
23252f2a5ecdSSimon J. Gerratyis included if it exists,
23262f2a5ecdSSimon J. Gerratyto provide POSIX-compatible default rules.
23271d3f2ddcSSimon J. GerratyIf
23281d3f2ddcSSimon J. Gerraty.Nm
23291d3f2ddcSSimon J. Gerratyis run with the
23301d3f2ddcSSimon J. Gerraty.Fl r
23311d3f2ddcSSimon J. Gerratyflag, then only
23321d3f2ddcSSimon J. Gerraty.Ql posix.mk
23331d3f2ddcSSimon J. Gerratywill contribute to the default rules.
23343955d011SMarcel Moolenaar.It Ic .PRECIOUS
23353955d011SMarcel MoolenaarApply the
23363955d011SMarcel Moolenaar.Ic .PRECIOUS
23373955d011SMarcel Moolenaarattribute to any specified sources.
23383955d011SMarcel MoolenaarIf no sources are specified, the
23393955d011SMarcel Moolenaar.Ic .PRECIOUS
23403955d011SMarcel Moolenaarattribute is applied to every
23413955d011SMarcel Moolenaartarget in the file.
23423955d011SMarcel Moolenaar.It Ic .SHELL
23433955d011SMarcel MoolenaarSets the shell that
23443955d011SMarcel Moolenaar.Nm
23453955d011SMarcel Moolenaarwill use to execute commands.
23463955d011SMarcel MoolenaarThe sources are a set of
23473955d011SMarcel Moolenaar.Ar field=value
23483955d011SMarcel Moolenaarpairs.
23493955d011SMarcel Moolenaar.Bl -tag -width hasErrCtls
23503955d011SMarcel Moolenaar.It Ar name
2351be19d90bSSimon J. GerratyThis is the minimal specification, used to select one of the built-in
23523955d011SMarcel Moolenaarshell specs;
23533955d011SMarcel Moolenaar.Ar sh ,
23543955d011SMarcel Moolenaar.Ar ksh ,
23553955d011SMarcel Moolenaarand
23563955d011SMarcel Moolenaar.Ar csh .
23573955d011SMarcel Moolenaar.It Ar path
23583955d011SMarcel MoolenaarSpecifies the path to the shell.
23593955d011SMarcel Moolenaar.It Ar hasErrCtl
23603955d011SMarcel MoolenaarIndicates whether the shell supports exit on error.
23613955d011SMarcel Moolenaar.It Ar check
23623955d011SMarcel MoolenaarThe command to turn on error checking.
23633955d011SMarcel Moolenaar.It Ar ignore
23643955d011SMarcel MoolenaarThe command to disable error checking.
23653955d011SMarcel Moolenaar.It Ar echo
23663955d011SMarcel MoolenaarThe command to turn on echoing of commands executed.
23673955d011SMarcel Moolenaar.It Ar quiet
23683955d011SMarcel MoolenaarThe command to turn off echoing of commands executed.
23693955d011SMarcel Moolenaar.It Ar filter
23703955d011SMarcel MoolenaarThe output to filter after issuing the
23713955d011SMarcel Moolenaar.Ar quiet
23723955d011SMarcel Moolenaarcommand.
23733955d011SMarcel MoolenaarIt is typically identical to
23743955d011SMarcel Moolenaar.Ar quiet .
23753955d011SMarcel Moolenaar.It Ar errFlag
23763955d011SMarcel MoolenaarThe flag to pass the shell to enable error checking.
23773955d011SMarcel Moolenaar.It Ar echoFlag
23783955d011SMarcel MoolenaarThe flag to pass the shell to enable command echoing.
23793955d011SMarcel Moolenaar.It Ar newline
23803955d011SMarcel MoolenaarThe string literal to pass the shell that results in a single newline
23813955d011SMarcel Moolenaarcharacter when used outside of any quoting characters.
23823955d011SMarcel Moolenaar.El
23833955d011SMarcel MoolenaarExample:
23843955d011SMarcel Moolenaar.Bd -literal
23853955d011SMarcel Moolenaar\&.SHELL: name=ksh path=/bin/ksh hasErrCtl=true \e
23863955d011SMarcel Moolenaar	check="set \-e" ignore="set +e" \e
23873955d011SMarcel Moolenaar	echo="set \-v" quiet="set +v" filter="set +v" \e
23883955d011SMarcel Moolenaar	echoFlag=v errFlag=e newline="'\en'"
23893955d011SMarcel Moolenaar.Ed
23903955d011SMarcel Moolenaar.It Ic .SILENT
23913955d011SMarcel MoolenaarApply the
23923955d011SMarcel Moolenaar.Ic .SILENT
23933955d011SMarcel Moolenaarattribute to any specified sources.
23943955d011SMarcel MoolenaarIf no sources are specified, the
23953955d011SMarcel Moolenaar.Ic .SILENT
23963955d011SMarcel Moolenaarattribute is applied to every
23973955d011SMarcel Moolenaarcommand in the file.
23981748de26SSimon J. Gerraty.It Ic .STALE
23991748de26SSimon J. GerratyThis target gets run when a dependency file contains stale entries, having
24001748de26SSimon J. Gerraty.Va .ALLSRC
24011748de26SSimon J. Gerratyset to the name of that dependency file.
24023955d011SMarcel Moolenaar.It Ic .SUFFIXES
24033955d011SMarcel MoolenaarEach source specifies a suffix to
24043955d011SMarcel Moolenaar.Nm .
24053955d011SMarcel MoolenaarIf no sources are specified, any previously specified suffixes are deleted.
24063955d011SMarcel MoolenaarIt allows the creation of suffix-transformation rules.
24073955d011SMarcel Moolenaar.Pp
24083955d011SMarcel MoolenaarExample:
24093955d011SMarcel Moolenaar.Bd -literal
24103955d011SMarcel Moolenaar\&.SUFFIXES: .o
24113955d011SMarcel Moolenaar\&.c.o:
24123955d011SMarcel Moolenaar	cc \-o ${.TARGET} \-c ${.IMPSRC}
24133955d011SMarcel Moolenaar.Ed
24143955d011SMarcel Moolenaar.El
24153955d011SMarcel Moolenaar.Sh ENVIRONMENT
24163955d011SMarcel Moolenaar.Nm
24173955d011SMarcel Moolenaaruses the following environment variables, if they exist:
24183955d011SMarcel Moolenaar.Ev MACHINE ,
24193955d011SMarcel Moolenaar.Ev MACHINE_ARCH ,
24203955d011SMarcel Moolenaar.Ev MAKE ,
24213955d011SMarcel Moolenaar.Ev MAKEFLAGS ,
24223955d011SMarcel Moolenaar.Ev MAKEOBJDIR ,
24233955d011SMarcel Moolenaar.Ev MAKEOBJDIRPREFIX ,
24243955d011SMarcel Moolenaar.Ev MAKESYSPATH ,
24253955d011SMarcel Moolenaar.Ev PWD ,
24263955d011SMarcel Moolenaarand
24273955d011SMarcel Moolenaar.Ev TMPDIR .
24283955d011SMarcel Moolenaar.Pp
24293955d011SMarcel Moolenaar.Ev MAKEOBJDIRPREFIX
24303955d011SMarcel Moolenaarand
24313955d011SMarcel Moolenaar.Ev MAKEOBJDIR
24323955d011SMarcel Moolenaarmay only be set in the environment or on the command line to
24333955d011SMarcel Moolenaar.Nm
24343955d011SMarcel Moolenaarand not as makefile variables;
24353955d011SMarcel Moolenaarsee the description of
2436*954401e6SSimon J. Gerraty.Sq Va .OBJDIR
24373955d011SMarcel Moolenaarfor more details.
24383955d011SMarcel Moolenaar.Sh FILES
24393955d011SMarcel Moolenaar.Bl -tag -width /usr/share/mk -compact
24403955d011SMarcel Moolenaar.It .depend
24413955d011SMarcel Moolenaarlist of dependencies
24423955d011SMarcel Moolenaar.It Makefile
24433955d011SMarcel Moolenaarlist of dependencies
24443955d011SMarcel Moolenaar.It makefile
24453955d011SMarcel Moolenaarlist of dependencies
24463955d011SMarcel Moolenaar.It sys.mk
24473955d011SMarcel Moolenaarsystem makefile
24483955d011SMarcel Moolenaar.It /usr/share/mk
24493955d011SMarcel Moolenaarsystem makefile directory
24503955d011SMarcel Moolenaar.El
24513955d011SMarcel Moolenaar.Sh COMPATIBILITY
2452db29cad8SSimon J. GerratyThe basic make syntax is compatible between different versions of make;
24533955d011SMarcel Moolenaarhowever the special variables, variable modifiers and conditionals are not.
2454db29cad8SSimon J. Gerraty.Ss Older versions
2455db29cad8SSimon J. GerratyAn incomplete list of changes in older versions of
2456db29cad8SSimon J. Gerraty.Nm :
24573955d011SMarcel Moolenaar.Pp
24583955d011SMarcel MoolenaarThe way that .for loop variables are substituted changed after
24593955d011SMarcel Moolenaar.Nx 5.0
24603955d011SMarcel Moolenaarso that they still appear to be variable expansions.
24613955d011SMarcel MoolenaarIn particular this stops them being treated as syntax, and removes some
24623955d011SMarcel Moolenaarobscure problems using them in .if statements.
2463db29cad8SSimon J. Gerraty.Pp
2464db29cad8SSimon J. GerratyThe way that parallel makes are scheduled changed in
2465db29cad8SSimon J. Gerraty.Nx 4.0
2466db29cad8SSimon J. Gerratyso that .ORDER and .WAIT apply recursively to the dependent nodes.
2467db29cad8SSimon J. GerratyThe algorithms used may change again in the future.
2468db29cad8SSimon J. Gerraty.Ss Other make dialects
2469db29cad8SSimon J. GerratyOther make dialects (GNU make, SVR4 make, POSIX make, etc.) do not
2470db29cad8SSimon J. Gerratysupport most of the features of
2471db29cad8SSimon J. Gerraty.Nm
2472db29cad8SSimon J. Gerratyas described in this manual.
2473db29cad8SSimon J. GerratyMost notably:
2474db29cad8SSimon J. Gerraty.Bl -bullet -offset indent
2475db29cad8SSimon J. Gerraty.It
2476db29cad8SSimon J. GerratyThe
2477db29cad8SSimon J. Gerraty.Ic .WAIT
2478db29cad8SSimon J. Gerratyand
2479db29cad8SSimon J. Gerraty.Ic .ORDER
2480db29cad8SSimon J. Gerratydeclarations and most functionality pertaining to parallelization.
2481db29cad8SSimon J. Gerraty(GNU make supports parallelization but lacks these features needed to
2482db29cad8SSimon J. Gerratycontrol it effectively.)
2483db29cad8SSimon J. Gerraty.It
2484db29cad8SSimon J. GerratyDirectives, including for loops and conditionals and most of the
2485db29cad8SSimon J. Gerratyforms of include files.
2486db29cad8SSimon J. Gerraty(GNU make has its own incompatible and less powerful syntax for
2487db29cad8SSimon J. Gerratyconditionals.)
2488db29cad8SSimon J. Gerraty.It
2489db29cad8SSimon J. GerratyAll built-in variables that begin with a dot.
2490db29cad8SSimon J. Gerraty.It
2491db29cad8SSimon J. GerratyMost of the special sources and targets that begin with a dot,
2492db29cad8SSimon J. Gerratywith the notable exception of
2493db29cad8SSimon J. Gerraty.Ic .PHONY ,
2494db29cad8SSimon J. Gerraty.Ic .PRECIOUS ,
2495db29cad8SSimon J. Gerratyand
2496db29cad8SSimon J. Gerraty.Ic .SUFFIXES .
2497db29cad8SSimon J. Gerraty.It
2498db29cad8SSimon J. GerratyVariable modifiers, except for the
2499db29cad8SSimon J. Gerraty.Dl :old=new
2500db29cad8SSimon J. Gerratystring substitution, which does not portably support globbing with
2501db29cad8SSimon J. Gerraty.Ql %
2502db29cad8SSimon J. Gerratyand historically only works on declared suffixes.
2503db29cad8SSimon J. Gerraty.It
2504db29cad8SSimon J. GerratyThe
2505db29cad8SSimon J. Gerraty.Ic $>
2506db29cad8SSimon J. Gerratyvariable even in its short form; most makes support this functionality
2507db29cad8SSimon J. Gerratybut its name varies.
2508db29cad8SSimon J. Gerraty.El
2509db29cad8SSimon J. Gerraty.Pp
2510db29cad8SSimon J. GerratySome features are somewhat more portable, such as assignment with
2511db29cad8SSimon J. Gerraty.Ic += ,
2512db29cad8SSimon J. Gerraty.Ic ?= ,
2513db29cad8SSimon J. Gerratyand
2514db29cad8SSimon J. Gerraty.Ic != .
2515db29cad8SSimon J. GerratyThe
2516db29cad8SSimon J. Gerraty.Ic .PATH
2517db29cad8SSimon J. Gerratyfunctionality is based on an older feature
2518db29cad8SSimon J. Gerraty.Ic VPATH
2519db29cad8SSimon J. Gerratyfound in GNU make and many versions of SVR4 make; however,
2520db29cad8SSimon J. Gerratyhistorically its behavior is too ill-defined (and too buggy) to rely
2521db29cad8SSimon J. Gerratyupon.
2522db29cad8SSimon J. Gerraty.Pp
2523db29cad8SSimon J. GerratyThe
2524db29cad8SSimon J. Gerraty.Ic $@
2525db29cad8SSimon J. Gerratyand
2526db29cad8SSimon J. Gerraty.Ic $<
2527db29cad8SSimon J. Gerratyvariables are more or less universally portable, as is the
2528db29cad8SSimon J. Gerraty.Ic $(MAKE)
2529db29cad8SSimon J. Gerratyvariable.
2530db29cad8SSimon J. GerratyBasic use of suffix rules (for files only in the current directory,
2531db29cad8SSimon J. Gerratynot trying to chain transformations together, etc.) is also reasonably
2532db29cad8SSimon J. Gerratyportable.
25333955d011SMarcel Moolenaar.Sh SEE ALSO
25343d31df21SMateusz Piotrowski.Xr mkdep 1 ,
25353d31df21SMateusz Piotrowski.Xr style.Makefile 5
25363955d011SMarcel Moolenaar.Sh HISTORY
25373955d011SMarcel MoolenaarA
25383955d011SMarcel Moolenaar.Nm
25393955d011SMarcel Moolenaarcommand appeared in
25403955d011SMarcel Moolenaar.At v7 .
25413955d011SMarcel MoolenaarThis
25423955d011SMarcel Moolenaar.Nm
25433955d011SMarcel Moolenaarimplementation is based on Adam De Boor's pmake program which was written
254493036677SSimon J. Gerratyfor Sprite at Berkeley.
25453955d011SMarcel MoolenaarIt was designed to be a parallel distributed make running jobs on different
25463955d011SMarcel Moolenaarmachines using a daemon called
25473955d011SMarcel Moolenaar.Dq customs .
254874d2e02bSSimon J. Gerraty.Pp
254974d2e02bSSimon J. GerratyHistorically the target/dependency
255074d2e02bSSimon J. Gerraty.Dq FRC
255174d2e02bSSimon J. Gerratyhas been used to FoRCe rebuilding (since the target/dependency
255274d2e02bSSimon J. Gerratydoes not exist... unless someone creates an
255374d2e02bSSimon J. Gerraty.Dq FRC
255474d2e02bSSimon J. Gerratyfile).
25553955d011SMarcel Moolenaar.Sh BUGS
25563955d011SMarcel MoolenaarThe
25573955d011SMarcel Moolenaar.Nm
255849caa483SSimon J. Gerratysyntax is difficult to parse without actually acting on the data.
255949caa483SSimon J. GerratyFor instance, finding the end of a variable's use should involve scanning
256049caa483SSimon J. Gerratyeach of the modifiers, using the correct terminator for each field.
25613955d011SMarcel MoolenaarIn many places
25623955d011SMarcel Moolenaar.Nm
25633955d011SMarcel Moolenaarjust counts {} and () in order to find the end of a variable expansion.
25643955d011SMarcel Moolenaar.Pp
25653955d011SMarcel MoolenaarThere is no way of escaping a space character in a filename.
2566