[BACK]Return to make.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / make

Diff for /src/usr.bin/make/make.1 between version 1.18 and 1.19

version 1.18, 1999/05/16 21:53:31 version 1.19, 1999/06/05 01:21:33
Line 41 
Line 41 
 .Nm make  .Nm make
 .Nd maintain program dependencies  .Nd maintain program dependencies
 .Sh SYNOPSIS  .Sh SYNOPSIS
 .Nm  .Nm make
 .Op Fl BPSeiknqrst  .Op Fl BPSeiknqrst
 .Op Fl D Ar variable  .Op Fl D Ar variable
 .Op Fl d Ar flags  .Op Fl d Ar flags
Line 52 
Line 52 
 .Op Fl m Ar directory  .Op Fl m Ar directory
 .Ek  .Ek
 .Op Fl V Ar variable  .Op Fl V Ar variable
 .Op Ar variable=value  .Op Ar variable Ns No = Ns Ar value
 .Op Ar target ...  .Op Ar target ...
 .Sh DESCRIPTION  .Sh DESCRIPTION
 .Nm make  .Nm
 is a program designed to simplify the maintenance of other programs.  is a program designed to simplify the maintenance of other programs.
 Its input is a list of specifications as to the files upon which programs  Its input is a list of specifications as to the files upon which programs
 and other files depend.  and other files depend.
Line 74 
Line 74 
 .Pp  .Pp
 This manual page is intended as a reference document only.  This manual page is intended as a reference document only.
 For a more thorough introduction to  For a more thorough introduction to
 .Nm make  .Nm
 and makefiles, please refer to  and makefiles, please refer to
 .%T "Make \- A Tutorial" .  .%T "Make \- A Tutorial" .
 .Pp  .Pp
Line 92 
Line 92 
 to be 1, in the global context.  to be 1, in the global context.
 .It Fl d Ar flags  .It Fl d Ar flags
 Turn on debugging, and specify which portions of  Turn on debugging, and specify which portions of
 .Nm make  .Nm
 are to print debugging information.  are to print debugging information.
 .Ar flags  .Ar flags
 is one or more of the following:  is one or more of the following:
Line 137 
Line 137 
 If  If
 .Ar makefile  .Ar makefile
 is  is
 .Ql Fl ,  .Ql \- ,
 standard input is read.  standard input is read.
 Multiple makefiles may be specified, and are read in the order specified.  Multiple makefiles may be specified, and are read in the order specified.
 .It Fl I Ar directory  .It Fl I Ar directory
Line 148 
Line 148 
 .It Fl i  .It Fl i
 Ignore non-zero exit of shell commands in the makefile.  Ignore non-zero exit of shell commands in the makefile.
 Equivalent to specifying  Equivalent to specifying
 .Ql Fl  .Ql \-
 before each command line in the makefile.  before each command line in the makefile.
 .It Fl j Ar max_jobs  .It Fl j Ar max_jobs
 Specify the maximum number of jobs that  Specify the maximum number of jobs that
 .Nm make  .Nm
 may have running at any one time. Turns compatibility mode off, unless the  may have running at any one time. Turns compatibility mode off, unless the
 .Ar B  .Ar B
 flag is also specified.  flag is also specified.
Line 172 
Line 172 
 Display the commands that would have been executed, but do not actually  Display the commands that would have been executed, but do not actually
 execute them.  execute them.
 .It Fl P  .It Fl P
 Collate the output of a given job and display it only when the job finishes,  Collate the output of a given job and display it only when the job finishes,
 instead of mixing the output of parallel jobs together.  instead of mixing the output of parallel jobs together.
 This option has no effect unless  This option has no effect unless
 .Fl j  .Fl j
 is used too.  is used too.
 .It Fl q  .It Fl q
Line 224 
Line 224 
 .Sh FILE DEPENDENCY SPECIFICATIONS  .Sh FILE DEPENDENCY SPECIFICATIONS
 Dependency lines consist of one or more targets, an operator, and zero  Dependency lines consist of one or more targets, an operator, and zero
 or more sources.  or more sources.
 This creates a relationship where the targets ``depend'' on the sources  This creates a relationship where the targets
   .Dq depend
   on the sources
 and are usually created from them.  and are usually created from them.
 The exact relationship between the target and the source is determined  The exact relationship between the target and the source is determined
 by the operator that separates them.  by the operator that separates them.
Line 236 
Line 238 
 Sources for a target accumulate over dependency lines when this operator  Sources for a target accumulate over dependency lines when this operator
 is used.  is used.
 The target is removed if  The target is removed if
 .Nm make  .Nm
 is interrupted.  is interrupted.
 .It Ic \&!  .It Ic \&!
 Targets are always re-created, but not until all sources have been  Targets are always re-created, but not until all sources have been
Line 244 
Line 246 
 Sources for a target accumulate over dependency lines when this operator  Sources for a target accumulate over dependency lines when this operator
 is used.  is used.
 The target is removed if  The target is removed if
 .Nm make  .Nm
 is interrupted.  is interrupted.
 .It Ic \&::  .It Ic \&::
 If no sources are specified, the target is always re-created.  If no sources are specified, the target is always re-created.
Line 253 
Line 255 
 Sources for a target do not accumulate over dependency lines when this  Sources for a target do not accumulate over dependency lines when this
 operator is used.  operator is used.
 The target will not be removed if  The target will not be removed if
 .Nm make  .Nm
 is interrupted.  is interrupted.
 .El  .El
 .Pp  .Pp
Line 299 
Line 301 
 causes any non-zero exit status of the command line to be ignored.  causes any non-zero exit status of the command line to be ignored.
 .Sh VARIABLE ASSIGNMENTS  .Sh VARIABLE ASSIGNMENTS
 Variables in  Variables in
 .Nm make  .Nm
 are much like variables in the shell, and, by tradition,  are much like variables in the shell, and, by tradition,
 consist of all upper-case letters.  consist of all upper-case letters.
 The five operators that can be used to assign values to variables are as  The five operators that can be used to assign values to variables are as
Line 368 
Line 370 
 .Ql Va \&! .  .Ql Va \&! .
 .It Va .IMPSRC  .It Va .IMPSRC
 The name/path of the source from which the target is to be transformed  The name/path of the source from which the target is to be transformed
 (the ``implied'' source); also known as  (the
   .Dq implied
   source); also known as
 .Ql Va \&< .  .Ql Va \&< .
 .It Va .MEMBER  .It Va .MEMBER
 The name of the archive member; also known as  The name of the archive member; also known as
Line 421 
Line 425 
 .El  .El
 .Pp  .Pp
 In addition,  In addition,
 .Nm make  .Nm
 sets or knows about the following internal variables, or environment  sets or knows about the following internal variables, or environment
 variables:  variables:
 .Bl -tag -width MAKEFLAGS  .Bl -tag -width MAKEFLAGS
 .It Va \&$  .It Va \&$
Line 434 
Line 438 
 sign.  sign.
 .It Va .MAKE  .It Va .MAKE
 The name that  The name that
 .Nm make  .Nm
 was executed with  was executed with
 .Pq Va argv Ns Op 0 .  .Pq Va argv Ns Op 0 .
 .It Va .CURDIR  .It Va .CURDIR
 A path to the directory where  A path to the directory where
 .Nm make  .Nm
 was executed.  was executed.
 .It Va .OBJDIR  .It Va .OBJDIR
 A path to the directory where the targets are built.  A path to the directory where the targets are built.
 At startup,  At startup,
 .Nm make  .Nm
 searches for an alternate directory to place target files -- it  searches for an alternate directory to place target files -- it
 will attempt to change into this special directory.  will attempt to change into this special directory.
 First, if  First, if
 .Ev MAKEOBJDIRPREFIX  .Ev MAKEOBJDIRPREFIX
 is defined,  is defined,
 .Nm make  .Nm
 prepends its contents to the current directory name and tries for  prepends its contents to the current directory name and tries for
 the resulting directory. If that fails,  the resulting directory. If that fails,
 .Nm make  .Nm
 remains in the current directory.  remains in the current directory.
 If  If
 .Ev MAKEOBJDIRPREFIX  .Ev MAKEOBJDIRPREFIX
 is not defined,  is not defined,
 .Nm make  .Nm
 checks  checks
 .Ev MAKEOBJDIR  
 and tries to change into that directory.  Should that fail,  
 .Nm make  
 remains in the current directory.  If  
 .Ev MAKEOBJDIR  .Ev MAKEOBJDIR
   and tries to change into that directory.  Should that fail,
   .Nm
   remains in the current directory.  If
   .Ev MAKEOBJDIR
 is not defined, it tries to change into the directory named  is not defined, it tries to change into the directory named
 .Pa obj.${MACHINE}  .Pa obj.${MACHINE}
 (see  (see
 .Va MACHINE  .Va MACHINE
 variable). If it still has found no special directory,  variable). If it still has found no special directory,
 .Nm make  .Nm
 next tries the directory named  next tries the directory named
 .Pa obj .  .Pa obj .
 If this fails,  If this fails,
 .Nm make  .Nm
 tries to prepend /usr/obj to the current directory name.  tries to prepend
   .Pa /usr/obj
   to the current directory name.
 Finally, if none of these directories are available  Finally, if none of these directories are available
 .Nm make  .Nm
 will settle for and use the current directory.  will settle for and use the current directory.
 .It Va .MAKEFLAGS  .It Va .MAKEFLAGS
 The environment variable  The environment variable
Line 485 
Line 491 
 may contain anything that  may contain anything that
 may be specified on  may be specified on
 .Nm make Ns 's  .Nm make Ns 's
 command line. Its contents are stored in  command line. Its contents are stored in
 .Nm make Ns 's  .Nm make Ns 's
 .Va .MAKEFLAGS  .Va .MAKEFLAGS
 variable.  variable.
 Anything specified on  Anything specified on
 .Nm make Ns 's  .Nm make Ns 's
 command line is appended to the  command line is appended to the
 .Va .MAKEFLAGS  .Va .MAKEFLAGS
 variable which is then  variable which is then
 entered into the environment as  entered into the environment as
 .Ev MAKEFLAGS  .Ev MAKEFLAGS
 for all programs which  for all programs which
 .Nm make  .Nm
 executes.  executes.
 .It Va MFLAGS  .It Va MFLAGS
 A shorter synonym for  A shorter synonym for
 .Va .MAKEFLAGS .  .Va .MAKEFLAGS .
 .It Ev PWD  .It Ev PWD
 Alternate path to the current directory.  Alternate path to the current directory.
 .Nm make  .Nm
 normally sets  normally sets
 .Ql Va .CURDIR  .Ql Va .CURDIR
 to the canonical path given by  to the canonical path given by
Line 512 
Line 518 
 However, if the environment variable  However, if the environment variable
 .Ev PWD  .Ev PWD
 is set and gives a path to the current directory, then  is set and gives a path to the current directory, then
 .Nm make  .Nm
 sets  sets
 .Ql Va .CURDIR  .Ql Va .CURDIR
 to the value of  to the value of
Line 522 
Line 528 
 is always set to the value of  is always set to the value of
 .Ql Va .OBJDIR  .Ql Va .OBJDIR
 for all programs which  for all programs which
 .Nm make  .Nm
 executes.  executes.
 .It Va .TARGETS  .It Va .TARGETS
 List of targets  List of targets
 .Nm make  .Nm
 is currently building.  is currently building.
 .It Va .INCLUDES  .It Va .INCLUDES
 See  See
 .Ic .INCLUDES  .Ic .INCLUDES
 special target  special target
 .It Va .LIBS  .It Va .LIBS
 See  See
 .Ic .LIBS  .Ic .LIBS
 special target  special target
 .It Va MACHINE  .It Va MACHINE
 Name of the machine architecture  Name of the machine architecture
 .Nm make  .Nm
 is running on, obtained from the  is running on, obtained from the
 .Ev MACHINE  .Ev MACHINE
 environment variable, or through  environment variable, or through
 .Xr uname 2  .Xr uname 2
 if not defined.  if not defined.
 .It Va MACHINE_ARCH  .It Va MACHINE_ARCH
 Name of the machine architecture  Name of the machine architecture
 .Nm make  .Nm
 was compiled for, obtained from the  was compiled for, obtained from the
 .Ev MACHINE_ARCH  .Ev MACHINE_ARCH
 environment variable, or defined at compilation time.  environment variable, or defined at compilation time.
 .El  .El
 .Pp  .Pp
 Variable expansion may be modified to select or modify each word of the  Variable expansion may be modified to select or modify each word of the
 variable (where a ``word'' is whitespace delimited sequence of characters).  variable (where a
   .Dq word
   is whitespace delimited sequence of characters).
 The general format of a variable expansion is as follows:  The general format of a variable expansion is as follows:
 .Pp  .Pp
 .Dl {variable[:modifier[:...]]}  .Dl {variable[:modifier[:...]]}
Line 816 
Line 824 
 .El  .El
 .Pp  .Pp
 As in C,  As in C,
 .Nm make  .Nm
 will only evaluate a conditional as far as is necessary to determine  will only evaluate a conditional as far as is necessary to determine
 its value.  its value.
 Parentheses may be used to change the order of evaluation.  Parentheses may be used to change the order of evaluation.
Line 871 
Line 879 
 variable is being compared against 0.  variable is being compared against 0.
 .Pp  .Pp
 When  When
 .Nm make  .Nm
 is evaluating one of these conditional expressions, and it encounters  is evaluating one of these conditional expressions, and it encounters
 a word it doesn't recognize, either the ``make'' or ``defined''  a word it doesn't recognize, either the
   .Dq make
   or
   .Dq defined
 expression is applied to it, depending on the form of the conditional.  expression is applied to it, depending on the form of the conditional.
 If the form is  If the form is
 .Ql Ic .ifdef  .Ql Ic .ifdef
 or  or
 .Ql Ic .ifndef ,  .Ql Ic .ifndef ,
 the ``defined'' expression  the
 is applied.  .Dq defined
   expression is applied.
 Similarly, if the form is  Similarly, if the form is
 .Ql Ic .ifmake  .Ql Ic .ifmake
 or  or
 .Ql Ic .ifnmake ,  .Ql Ic .ifnmake ,
 the ``make''  the
   .Dq make
 expression is applied.  expression is applied.
 .Pp  .Pp
 If the conditional evaluates to true the parsing of the makefile continues  If the conditional evaluates to true the parsing of the makefile continues
Line 933 
Line 946 
 as if they all were preceded by a dash  as if they all were preceded by a dash
 .Pq Ql \- .  .Pq Ql \- .
 .It Ic .MADE  .It Ic .MADE
 Mark all sources of this target as being up-to-date.  Mark all sources of this target as being up-to-date.
 .It Ic .MAKE  .It Ic .MAKE
 Execute the commands associated with this target even if the  Execute the commands associated with this target even if the
 .Fl n  .Fl n
Line 944 
Line 957 
 .Nm make Ns 's .  .Nm make Ns 's .
 .It Ic .NOTMAIN  .It Ic .NOTMAIN
 Normally  Normally
 .Nm make  .Nm
 selects the first target it encounters as the default target to be built  selects the first target it encounters as the default target to be built
 if no target was specified.  if no target was specified.
 This source prevents this target from being selected.  This source prevents this target from being selected.
 .It Ic .OPTIONAL  .It Ic .OPTIONAL
 If a target is marked with this attribute and  If a target is marked with this attribute and
 .Nm make  .Nm
 can't figure out how to create it, it will ignore this fact and assume  can't figure out how to create it, it will ignore this fact and assume
 the file isn't needed or already exists.  the file isn't needed or already exists.
 .It Ic .PRECIOUS  .It Ic .PRECIOUS
 When  When
 .Nm make  .Nm
 is interrupted, it removes any partially made targets.  is interrupted, it removes any partially made targets.
 This source prevents the target from being removed.  This source prevents the target from being removed.
 .It Ic .SILENT  .It Ic .SILENT
Line 994 
Line 1007 
 .Ic .USE  .Ic .USE
 rule for any target (that was used only as a  rule for any target (that was used only as a
 source) that  source) that
 .Nm make  .Nm
 can't figure out any other way to create.  can't figure out any other way to create.
 Only the shell script is used.  Only the shell script is used.
 The  The
Line 1019 
Line 1032 
 .Ic .SUFFIXES ,  .Ic .SUFFIXES ,
 any suffix so declared will have the directories on its search path (see  any suffix so declared will have the directories on its search path (see
 .Ic .PATH )  .Ic .PATH )
 placed in the  placed in the
 .Va .INCLUDES  .Va .INCLUDES
 special variable, each preceded by a  special variable, each preceded by a
 .Fl I  .Fl I
 flag.  flag.
 .It Ic .INTERRUPT  .It Ic .INTERRUPT
 If  If
 .Nm make  .Nm
 is interrupted, the commands for this target will be executed.  is interrupted, the commands for this target will be executed.
 .It Ic .LIBS  .It Ic .LIBS
 This does for libraries what  This does for libraries what
 .Ic .INCLUDES  .Ic .INCLUDES
 does for include files, except that the flag used is  does for include files, except that the flag used is
 .Fl L .  .Fl L .
 .It Ic .MAIN  .It Ic .MAIN
 If no target is specified when  If no target is specified when
 .Nm make  .Nm
 is invoked, this target will be built. This is always set, either  is invoked, this target will be built. This is always set, either
 explicitly, or implicitly when  explicitly, or implicitly when
 .Nm make  .Nm
 selects the default target, to give the user a way to refer to the default  selects the default target, to give the user a way to refer to the default
 target on the command line.  target on the command line.
 .It Ic .MAKEFLAGS  .It Ic .MAKEFLAGS
 This target provides a way to specify flags for  This target provides a way to specify flags for
 .Nm make  .Nm
 when the makefile is used.  when the makefile is used.
 The flags are as if typed to the shell, though the  The flags are as if typed to the shell, though the
 .Fl f  .Fl f
Line 1071 
Line 1084 
 .It Ic .PATH\fIsuffix\fR  .It Ic .PATH\fIsuffix\fR
 The sources are directories which are to be searched for suffixed files  The sources are directories which are to be searched for suffixed files
 not found in the current directory.  not found in the current directory.
 .Nm make  .Nm
 first searches the suffixed search path, before reverting to the default  first searches the suffixed search path, before reverting to the default
 path if the file is not found there.  path if the file is not found there.
 .It Ic .PHONY  .It Ic .PHONY
 Apply the  Apply the
Line 1100 
Line 1113 
 .Nm make .  .Nm make .
 If no sources are specified, any previous specified suffices are deleted.  If no sources are specified, any previous specified suffices are deleted.
 .Sh COMPATIBILITY  .Sh COMPATIBILITY
 Older versions of  Older versions of
 .Nm make  .Nm
 used  used
 .Ev MAKE  .Ev MAKE
 instead of  instead of
 .Ev MAKEFLAGS .  .Ev MAKEFLAGS .
 This was removed for POSIX compatibility.  This was removed for POSIX compatibility.
 The internal variable  The internal variable
 .Va MAKE  .Va MAKE
 is set to the same value as  is set to the same value as
 .Va .MAKE ,  .Va .MAKE ,
 support for this may be removed in the future.  support for this may be removed in the future.
 .Pp  .Pp
 Most of the more esoteric features of  Most of the more esoteric features of
 .Nm make  .Nm
 should probably be avoided for greater compatibility.  should probably be avoided for greater compatibility.
 .Sh ENVIRONMENT  .Sh ENVIRONMENT
 .Nm make  .Nm
 uses the following environment variables, if they exist:  uses the following environment variables, if they exist:
 .Ev MACHINE ,  .Ev MACHINE ,
 .Ev MACHINE_ARCH ,  .Ev MACHINE_ARCH ,
Line 1141 
Line 1154 
 .It Pa /usr/share/mk  .It Pa /usr/share/mk
 system makefile directory  system makefile directory
 .IT Pa /usr/obj  .IT Pa /usr/obj
 default  default
 .Ev MAKEOBJDIRPREFIX directory.  .Ev MAKEOBJDIRPREFIX directory.
 .El  .El
 .Sh BUGS  .Sh BUGS
 The determination of  The determination of
 .Va .OBJDIR  .Va .OBJDIR
 is contorted to the point of absurdity.  is contorted to the point of absurdity.
 .Pp  .Pp
 In the presence of several  In the presence of several
 .Ic .MAIN  .Ic .MAIN
 special targets,  special targets,
 .Nm make  .Nm
 silently ignores all but the first.  silently ignores all but the first.
 .Pp  .Pp
 .Va .TARGETS  .Va .TARGETS
 is not set to the default target when  is not set to the default target when
 .Nm make  .Nm
 is invoked without a target name and no  is invoked without a target name and no
 .Ic MAIN  .Ic MAIN
 special target exists.  special target exists.
 .Pp  .Pp
 The evaluation of  The evaluation of
Line 1184 
Line 1197 
 .Xr mkdep 1  .Xr mkdep 1
 .Sh HISTORY  .Sh HISTORY
 A  A
 .Nm make  .Nm
 command appeared in  command appeared in
 .At v7 .  .At v7 .

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19