Vous êtes sur la page 1sur 15

MAKE (1)

FreeBSD General Commands Manual

MAKE (1)

NAME make maintain program dependencies SYNOPSIS make [ ABPSXeiknpqrstv] [ C directory] [ D variable] [ d flags] [ E variable] [ f makefile] [ I directory] [ j max_jobs] [ m directory] [ V variable] [ x warning_options] [variable=value] [target . . .] DESCRIPTION The make utility is a program designed to simplify the maintenance of other programs. Its input is a list of specications describing dependency relationships between the generation of les and programs. First of all, the initial list of specications will be read from the system makele, sys.mk, unless inhibited with the r option. The standard sys.mk as shipped with FreeBSD also handles make.conf(5), the default path to which can be altered via the make variable __MAKE_CONF. Then the rst of BSDmakefile, makefile, and Makefile that can be found in the current directory, object directory (see .OBJDIR), or search path (see the I option) will be read for the main list of dependency specications. A different makele or list of them can be supplied via the f option(s). Finally, if the le .depend can be found in any of the aforesaid locations, it will also be read (see mkdep(1)). When make searches for a makele, its name takes precedence over its location. For instance, BSDmakefile in the object directory will be favored over Makefile in the current directory. The options are as follows: A B Make archive errors non-fatal, causing make to just skip the remainder or all of the archive and continue after printing a message. Try to be backwards compatible by executing a single shell per command and by executing the commands to make the sources of a dependency line in sequence. This is turned on by default unless j is used.

C directory Change to directory before reading the makeles or doing anything else. If multiple C options are specied, each is interpreted relative to the previous one: C / C etc is equivalent to C /etc. D variable Dene variable to be 1, in the global context. d flags Turn on debugging, and specify which portions of make are to print debugging information. Argument flags is one or more of the following: A a c d f g1 Print all possible debugging information; equivalent to specifying all of the debugging ags. Print debugging information about archive searching and caching. Print debugging information about conditional evaluation. Print debugging information about directory searching and caching. Print debugging information about the execution of for loops. Print the input graph before making anything.

FreeBSD 7.2

December 29, 2008

MAKE (1)

FreeBSD General Commands Manual

MAKE (1)

g2 j l m s t v

Print the input graph after making everything, or before exiting on error. Print debugging information about running multiple shells. Print commands in Makeles regardless of whether or not they are prexed by @ or other "quiet" ags. Also known as "loud" behavior. Print debugging information about making targets, including modication dates. Print debugging information about sufx-transformation rules. Print debugging information about target list maintenance. Print debugging information about variable assignment.

E variable Specify a variable whose environment value (if any) will override macro assignments within makeles. e Specify that environment values override macro assignments within makeles for all variables.

f makefile Specify a makele to read instead of the default one. If makefile is not an absolute pathname, make will search for it as described above. In case makefile is , standard input is read. Multiple f options can be supplied, and the makeles will be read in that order. Unlike the other command-line options, f is neither stored in .MAKEFLAGS nor pushed down to sub-makes via MAKEFLAGS. See below for more details on these variables. I directory Specify a directory in which to search for makeles and included makeles. Multiple I options can be specied to form a search path. The system makele directory (or directories, see the m option) is automatically appended at the tail of this path. i Ignore non-zero exit of shell commands in the makele. Equivalent to specifying before each command line in the makele.

j max_jobs Specify the maximum number of jobs that make may have running at any one time. Turns compatibility mode off, unless the B ag is also specied. k Continue processing after errors are encountered, but only on those targets that do not depend on the target whose creation caused the error.

m directory Specify a directory in which to search for the system makele and makeles included via the <...> style. Multiple m options can be specied to form a search path. This path will override the default system include path, /usr/share/mk. The system include path will always be appended to the search path used for "..."-style inclusions and makele searches (see the I option). n P p Q Display the commands that would have been executed, but do not actually execute them. Collate the output of a given job and display it only when the job nishes, instead of mixing the output of parallel jobs together. This option has no effect unless j is used too. Only print the input graph, not executing any commands. The output is the same as d g1. When combined with f /dev/null, only the builtin rules of make are displayed. Be extra quiet. For multi-job makes, this will cause le banners not to be generated.

FreeBSD 7.2

December 29, 2008

MAKE (1)

FreeBSD General Commands Manual

MAKE (1)

q r S s t

Do not execute any commands, but exit 0 if the specied targets are up-to-date and 1, otherwise. Do not process the system makele. Stop processing when an error is encountered. Default behaviour. This is needed to negate the k option during recursive builds. Do not echo any commands as they are executed. Equivalent to specifying @ before each command line in the makele. Rather than re-building a target as specied in the makele, create it or update its modication time to make it appear up-to-date.

V variable Print makes idea of the value of variable, in the global context. Do not build any targets. Multiple instances of this option may be specied; the variables will be printed one per line, with a blank line for each null or undened variable. v X Be extra verbose. Print any extra information. When using the V option to print the values of variables, do not recursively expand the values.

variable=value Set the value of the variable variable to value. x warning_options Specify extended warning options. This option may be specied several times. A warning_option can be prexed with no in which case the warning is switched off. The currently available options are: dirsyntax Warn if anything except blanks and comments follows an .endif or .else directive. See also the .WARN special target. There are seven different types of lines in a makele: le dependency specications, shell commands, variable assignments, include statements, conditional directives, for loops, and comments. In general, lines may be continued from one line to the next by ending them with a backslash ( \ ) . The trailing newline character and initial whitespace on the following line are compressed into a single space. FILE DEPENDENCY SPECIFICATIONS Dependency lines consist of one or more targets, an operator, and zero or more sources. This creates a relationship where the targets depend on the sources and are usually created from them. The exact relationship between the target and the source is determined by the operator that separates them. The three operators are as follows: : A target is considered out-of-date if its modication time is less than those of any of its sources. Sources for a target accumulate over dependency lines when this operator is used. The target is removed if make is interrupted. Targets are always re-created, but not until all sources have been examined and re-created as necessary. Sources for a target accumulate over dependency lines when this operator is used. The target is removed if make is interrupted. If no sources are specied, the target is always re-created. Otherwise, a target is considered out-ofdate if any of its sources has been modied more recently than the target. Sources for a target do not accumulate over dependency lines when this operator is used. The target will not be removed if make is interrupted.

::

FreeBSD 7.2

December 29, 2008

MAKE (1)

FreeBSD General Commands Manual

MAKE (1)

Targets and sources may contain the shell wildcard expressions ?, , [] and {}. The expressions ?, and [] may only be used as part of the nal component of the target or source, and must be used to describe existing les. The expression {} need not necessarily be used to describe existing les. Expansion is in directory order, not alphabetically as done in the shell. SHELL COMMANDS Each target may have associated with it a series of shell commands, normally used to create the target. Each of the commands in this script must be preceded by a tab. While any target may appear on a dependency line, only one of these dependencies may be followed by a creation script, unless the :: operator is used. If the rst characters of the command line are @, , and/or +, the command is treated specially. A @ causes the command not to be echoed before it is executed. A causes any non-zero exit status of the command line to be ignored. A + causes the command to be executed even if n is specied on the command line. VARIABLE ASSIGNMENTS Variables in make are much like variables in the shell, and, by tradition, consist of all upper-case letters. The ve operators that can be used to assign values to variables are as follows: = += ?= := != Assign the value to the variable. Any previous value is overridden. Append the value to the current value of the variable. Assign the value to the variable if it is not already dened. Assign with expansion, i.e., expand the value before assigning it to the variable. Normally, expansion is not done until the variable is referenced. Expand the value and pass it to the shell for execution and assign the result to the variable. Any newlines in the result are replaced with spaces.

Any whitespace before the assigned value is removed; if the value is being appended, a single space is inserted between the previous contents of the variable and the appended value. Variables are expanded by surrounding the variable name with either curly braces ( {} ) or parentheses ( () ) and preceding it with a dollar sign ( $ ) . If the variable name contains only a single letter, the surrounding braces or parentheses are not required. This shorter form is not recommended. Variable substitution occurs at two distinct times, depending on where the variable is being used. Variables in dependency lines are expanded as the line is read. Variables in shell commands are expanded when the shell command is executed. The four different classes of variables (in order of increasing precedence) are: Environment variables Variables dened as part of makes environment. Global variables Variables dened in the makele or in included makeles. Command line variables Variables dened as part of the command line and variables obtained from the MAKEFLAGS environment variable or the .MAKEFLAGS target. Local variables Variables that are dened specic to a certain target. If the name of an environment variable appears in a makele on the left-hand side of an assignment, a global variable with the same name is created, and the latter shadows the former as per their relative precedences.

FreeBSD 7.2

December 29, 2008

MAKE (1)

FreeBSD General Commands Manual

MAKE (1)

The environment is not changed in this case, and the change is not exported to programs executed by make. However, a command-line variable actually replaces the environment variable of the same name if the latter exists, which is visible to child programs. There are seven local variables in make: .ALLSRC The list of all sources for this target; also known as >.

.ARCHIVE The name of the archive le; also known as !. .IMPSRC The name/path of the source from which the target is to be transformed (the implied source); also known as <.

.MEMBER The name of the archive member; also known as %. .OODATE .PREFIX .TARGET The list of sources for this target that were deemed out-of-date; also known as ?. The le prex of the le, containing only the le portion, no sufx or preceding directory components; also known as . The name of the target; also known as @.

The shorter forms @, !, <, %, ?, >, and are permitted for backward compatibility and are not recommended. The six variables @F, @D, <F, <D, F, and D are permitted for compatibility with AT&T System V UNIX makeles and are not recommended. Four of the local variables may be used in sources on dependency lines because they expand to the proper value for each target on the line. These variables are .TARGET, .PREFIX, .ARCHIVE, and .MEMBER. In addition, make sets or knows about the following internal variables or environment variables: $ MAKE .CURDIR .OBJDIR A single dollar sign $, i.e. $$ expands to a single dollar sign. The name that make was executed with ( argv[0] ) . A path to the directory where make was executed. The make utility sets .CURDIR to the canonical path given by getcwd(3). A path to the directory where the targets are built. At startup, make searches for an alternate directory to place target les. It will attempt to change into this special directory and will search this directory for makeles not found in the current directory. The following directories are tried in order: 1. 2. 3. 4. 5. ${MAKEOBJDIRPREFIX}/pwd ${MAKEOBJDIR} obj.${MACHINE} obj /usr/obj/pwd

The rst directory that make successfully changes into is used. If either MAKEOBJDIRPREFIX or MAKEOBJDIR is set in the environment but make is unable to change into the corresponding directory, then the current directory is used without checking the remainder of the list. If they are undened and make is unable to change into any of the remaining three directories, then the current directory is used. Note, that MAKEOBJDIRPREFIX and MAKEOBJDIR must be environment variables and should not be set on makes command line. The make utility sets .OBJDIR to the canonical path given by getcwd(3).

FreeBSD 7.2

December 29, 2008

MAKE (1)

FreeBSD General Commands Manual

MAKE (1)

.MAKEFILE_LIST As make reads various makeles, including the default les and any obtained from the command line and .include and .sinclude directives, their names will be automatically appended to the .MAKEFILE_LIST variable. They are added right before make begins to parse them, so that the name of the current makele is the last word in this variable. MAKEFLAGS The environment variable MAKEFLAGS may initially contain anything that may be specied on makes command line, including f option(s). After processing, its contents are stored in the .MAKEFLAGS global variable, although any f options are omitted. Then all options and variable assignments specied on makes command line, except for f, are appended to the .MAKEFLAGS variable. Whenever make executes a program, it sets MAKEFLAGS in the programs environment to the current value of the .MAKEFLAGS global variable. Thus, if MAKEFLAGS in makes environment contains any f options, they will not be pushed down to child programs automatically. The make utility effectively lters out f options from the environment and command line although it passes the rest of its options down to submakes via MAKEFLAGS by default. When passing macro denitions and ag arguments in the MAKEFLAGS environment variable, space and tab characters are quoted by preceding them with a backslash. When reading the MAKEFLAGS variable from the environment, all sequences of a backslash and one of space or tab are replaced just with their second character without causing a word break. Any other occurrences of a backslash are retained. Groups of unquoted space, tab and newline characters cause word breaking. .MAKEFLAGS Initially, this global variable contains makes current run-time options from the environment and command line as described above, under MAKEFLAGS. By modifying the contents of the .MAKEFLAGS global variable, the makele can alter the contents of the MAKEFLAGS environment variable made available for all programs which make executes. This includes adding f option(s). The current value of .MAKEFLAGS is just copied verbatim to MAKEFLAGS in the environment of child programs. Note that any options entered to .MAKEFLAGS neither affect the current instance of make nor show up in its own copy of MAKEFLAGS instantly. However, they do show up in the MAKEFLAGS environment variable of programs executed by make. On the other hand, a direct assignment to MAKEFLAGS neither affects the current instance of make nor is passed down to makes children. Compare with the .MAKEFLAGS special target below. MFLAGS This variable is provided for backward compatibility and contains all the options from the MAKEFLAGS environment variable plus any options specied on makes command line. The process-id of make. The parent process-id of make.

.MAKE.PID .MAKE.PPID

.MAKE.JOB.PREFIX If make is run with j v then output for each target is prexed with a token --target --- the rst part of which can be controlled via .MAKE.JOB.PREFIX. For example: .MAKE.JOB.PREFIX=${.newline}---${MAKE:T}[${.MAKE.PID}] would produce tokens like ---make[1234] target --or .MAKE.JOB.PREFIX=---pid[${.MAKE.PID}],ppid[${.MAKE.PPID}] would produce tokens like ---pid[56789],ppid[1234] target --- making

FreeBSD 7.2

December 29, 2008

MAKE (1)

FreeBSD General Commands Manual

MAKE (1)

it easier to track the degree of parallelism being achieved. .TARGETS .INCLUDES .LIBS MACHINE List of targets make is currently building. See .INCLUDES special target. See .LIBS special target. Name of the machine architecture make is running on, obtained from the MACHINE environment variable, or through uname(3) if not dened.

MACHINE_ARCH Name of the machine architecture make was compiled for, dened at compilation time. VPATH Makeles may assign a colon-delimited list of directories to VPATH. These directories will be searched for source les by make after it has nished parsing all input makeles.

Variable expansion may be modied to select or modify each word of the variable (where a word is whitespace-delimited sequence of characters). The general format of a variable expansion is as follows: {variable[:modifier[:...]]} Each modier begins with a colon and one of the following special characters. The colon may be escaped with a backslash ( \ ) . C/pattern/replacement/[1g] Modify each word of the value, substituting every match of the extended regular expression pattern (see re_format(7)) with the ed(1)style replacement string. Normally, the rst occurrence of the pattern in each word of the value is changed. The 1 modier causes the substitution to apply to at most one word; the g modier causes the substitution to apply to as many instances of the search pattern as occur in the word or words it is found in. Note that 1 and g are orthogonal; the former species whether multiple words are potentially affected, the latter whether multiple substitutions can potentially occur within each affected word. E H L Replaces each word in the variable with its sufx. Replaces each word in the variable with everything but the last component. Converts variable to lower-case letters.

Mpattern Select only those words that match the rest of the modier. The standard shell wildcard characters (, ?, and []) may be used. The wildcard characters may be escaped with a backslash ( \ ) . Npattern This is identical to M, but selects all words which do not match the rest of the modier. O Q R Order every word in the variable alphabetically. Quotes every shell meta-character in the variable, so that it can be passed safely through recursive invocations of make. Replaces each word in the variable with everything but its sufx.

S/old_string/new_string/[g] Modify the rst occurrence of old_string in each word of the variables value, replacing it with new_string. If a g is appended to the last slash of the pattern, all occurrences in each word are replaced. If old_string begins with a caret ( ) , old_string is anchored at the beginning of each word. If old_string ends with a dollar sign ( $ ) , it is anchored at the end of each word. Inside new_string, an ampersand ( & ) is replaced by old_string. Any character may be used as a delimiter for the parts of the modier string.

FreeBSD 7.2

December 29, 2008

MAKE (1)

FreeBSD General Commands Manual

MAKE (1)

The anchoring, ampersand, and delimiter characters may be escaped with a backslash ( \ ) . Variable expansion occurs in the normal fashion inside both old_string and new_string with the single exception that a backslash is used to prevent the expansion of a dollar sign ( $ ) , not a preceding dollar sign as is usual. old_string=new_string This is the AT&T System V UNIX style variable substitution. It must be the last modier specied. If old_string or new_string do not contain the pattern matching character % then it is assumed that they are anchored at the end of each word, so only sufxes or entire words may be replaced. Otherwise % is the substring of old_string to be replaced in new_string T U u Replaces each word in the variable with its last component. Converts variable to upper-case letters. Remove adjacent duplicate words (like uniq(1)).

DIRECTIVES, CONDITIONALS, AND FOR LOOPS Directives, conditionals, and for loops reminiscent of the C programming language are provided in make. All such structures are identied by a line beginning with a single dot ( . ) character. The following directives are supported: .include <file> .include "file" Include the specied makele. Variables between the angle brackets or double quotes are expanded to form the le name. If angle brackets are used, the included makele is expected to be in the system makele directory. If double quotes are used, the including makeles directory and any directories specied using the I option are searched before the system makele directory. .sinclude <file> .sinclude "file" Like .include, but silently ignored if the le cannot be found and opened. .undef variable Un-dene the specied global variable. Only global variables may be un-dened. .error message Terminate processing of the makele immediately. The lename of the makele, the line on which the error was encountered and the specied message are printed to the standard error output and make terminates with exit code 1. Variables in the message are expanded. .warning message Emit a warning message. The lename of the makele, the line on which the warning was encountered, and the specied message are printed to the standard error output. Variables in the message are expanded. Conditionals are used to determine which parts of the Makele to process. They are used similarly to the conditionals supported by the C pre-processor. The following conditionals are supported: .if [!]expression [operator expression . . .] Test the value of an expression. .ifdef [!]variable [operator variable . . .] Test the value of a variable.

FreeBSD 7.2

December 29, 2008

MAKE (1)

FreeBSD General Commands Manual

MAKE (1)

.ifndef [!]variable [operator variable . . .] Test the value of a variable. .ifmake [!]target [operator target . . .] Test the target being built. .ifnmake [!]target [operator target . . .] Test the target being built. .else Reverse the sense of the last conditional. .elif [!]expression [operator expression . . .] A combination of .else followed by .if. .elifdef [!]variable [operator variable . . .] A combination of .else followed by .ifdef. .elifndef [!]variable [operator variable . . .] A combination of .else followed by .ifndef. .elifmake [!]target [operator target . . .] A combination of .else followed by .ifmake. .elifnmake [!]target [operator target . . .] A combination of .else followed by .ifnmake. .endif End the body of the conditional. The operator may be any one of the following: || && logical OR Logical AND; of higher precedence than ||.

As in C, make will only evaluate a conditional as far as is necessary to determine its value. Parentheses may be used to change the order of evaluation. The boolean operator ! may be used to logically negate an entire conditional. It is of higher precedence than &&. The value of expression may be any of the following: defined make Takes a variable name as an argument and evaluates to true if the variable has been dened. Takes a target name as an argument and evaluates to true if the target was specied as part of makes command line or was declared the default target (either implicitly or explicitly, see .MAIN) before the line containing the conditional. Takes a variable, with possible modiers, and evaluates to true if the expansion of the variable would result in an empty string. Takes a le name as an argument and evaluates to true if the le exists. The le is searched for on the system search path (see .PATH). Takes a target name as an argument and evaluates to true if the target has been dened.

empty exists target

An expression may also be a numeric or string comparison: in this case, the left-hand side must be a variable expansion, whereas the right-hand side can be a constant or a variable expansion. Variable expansion is performed on both sides, after which the resulting values are compared. A value is interpreted as hexadecimal if it is preceded by 0x, otherwise it is decimal; octal numbers are not supported. String comparison can only use the == or != operators, whereas numeric values (both integer and oating point) can also be compared using the >, >=, < and <= operators.

FreeBSD 7.2

December 29, 2008

MAKE (1)

FreeBSD General Commands Manual

MAKE (1)

If no relational operator (and right-hand value) are given, an implicit != 0 is used. However be very careful in using this feature especially when the left-hand side variable expansion returns a string. When make is evaluating one of these conditional expressions, and it encounters a word it does not recognize, either the make or dened expression is applied to it, depending on the form of the conditional. If the form is .if, .ifdef or .ifndef, the dened expression is applied. Similarly, if the form is .ifmake or .ifnmake, the make expression is applied. If the conditional evaluates to true the parsing of the makele continues as before. If it evaluates to false, the following lines are skipped. In both cases this continues until a .else or .endif is found. For loops are typically used to apply a set of rules to a list of les. The syntax of a for loop is: .for variable in expression <make-rules> .endfor After the for expression is evaluated, it is split into words. The iteration variable is successively set to each word, and substituted in the make-rules inside the body of the for loop. COMMENTS Comments begin with a hash ( # ) character, anywhere but in a shell command line, and continue to the end of the line. SPECIAL SOURCES .IGNORE Ignore any errors from the commands associated with this target, exactly as if they all were preceded by a dash ( ) . .MAKE Execute the commands associated with this target even if the n or t options were specied. Normally used to mark recursive makes.

.NOTMAIN Normally make selects the rst target it encounters as the default target to be built if no target was specied. This source prevents this target from being selected. .OPTIONAL If a target is marked with this attribute and make cannot gure out how to create it, it will ignore this fact and assume the le is not needed or already exists. .PRECIOUS When make is interrupted, it removes any partially made targets. This source prevents the target from being removed. .SILENT .USE Do not echo any of the commands associated with this target, exactly as if they all were preceded by an at sign ( @ ) . Turn the target into makes version of a macro. When the target is used as a source for another target, the other target acquires the commands, sources, and attributes (except for .USE) of the source. If the target already has commands, the .USE targets commands are appended to them. If special .WAIT source appears in a dependency line, the sources that precede it are made before the sources that succeed it in the line. Loops are not being detected and targets that form loops will be silently ignored.

.WAIT

SPECIAL TARGETS Special targets may not be included with other targets, i.e., they must be the only target specied.

FreeBSD 7.2

December 29, 2008

10

MAKE (1)

FreeBSD General Commands Manual

MAKE (1)

.BEGIN

Any command lines attached to this target are executed before anything else is done.

.DEFAULT This is sort of a .USE rule for any target (that was used only as a source) that make cannot gure out any other way to create. Only the shell script is used. The .IMPSRC variable of a target that inherits .DEFAULTs commands is set to the targets own name. .END .IGNORE .INCLUDES A list of sufxes that indicate les that can be included in a source le. The sufx must have already been declared with .SUFFIXES; any sufx so declared will have the directories on its search path (see .PATH) placed in the .INCLUDES special variable, each preceded by a I ag. .INTERRUPT If make is interrupted, the commands for this target will be executed. .LIBS .MAIN This does for libraries what .INCLUDES does for include les, except that the ag used is L. If no target is specied when make is invoked, this target will be built. This is always set, either explicitly, or implicitly when make selects the default target, to give the user a way to refer to the default target on the command line. Any command lines attached to this target are executed after everything else is done. Mark each of the sources with the .IGNORE attribute. If no sources are specied, this is the equivalent of specifying the i option.

.MAKEFILEDEPS Enable the Remaking Makeles functionality, as explained in the REMAKING MAKEFILES section below. .MAKEFLAGS This target provides a way to specify ags for make when the makele is used. The ags are as if typed to the shell, though the f option will have no effect. Flags (except for f) and variable assignments specied as the source for this target are also appended to the .MAKEFLAGS internal variable. Please note the difference between this target and the .MAKEFLAGS internal variable: specifying an option or variable assignment as the source for this target will affect both the current makele and all processes that make executes. .MFLAGS Same as above, for backward compatibility.

.NOTPARALLEL Disable parallel mode. .NO_PARALLEL Same as above, for compatibility with other pmake variants. .ORDER .PATH The named targets are made in sequence. The sources are directories which are to be searched for les not found in the current directory. If no sources are specied, any previously specied directories are deleted. Where possible, use of .PATH is preferred over use of the VPATH variable. The sources are directories which are to be searched for sufxed les not found in the current directory. The make utility rst searches the sufxed search path, before reverting to the default path if the le is not found there. This form is required for .LIBS and .INCLUDES to work.

.PATHsufx

FreeBSD 7.2

December 29, 2008

11

MAKE (1)

FreeBSD General Commands Manual

MAKE (1)

.PHONY .POSIX .PRECIOUS

Apply the .PHONY attribute to any specied sources. Targets with this attribute are always considered to be out of date. Adjust makes behavior to match the applicable POSIX specications. (Note this disables the Remaking Makeles feature.) Apply the .PRECIOUS attribute to any specied sources. If no sources are specied, the .PRECIOUS attribute is applied to every target in the le.

.SHELL

Select another shell. The sources of this target have the format key=value. The key is one of: path name quiet echo lter Specify the path to the new shell. Specify the name of the new shell. This may be either one of the three builtin shells (see below) or any other name. Specify the shell command to turn echoing off. Specify the shell command to turn echoing on. Usually shells print the echo off command before turning echoing off. This is the exact string that will be printed by the shell and is used to lter the shell output to remove the echo off command.

echoFlag The shell option that turns echoing on. errFlag The shell option to turn on error checking. If error checking is on, the shell should exit if a command returns a non-zero status.

hasErrCtl True if the shell has error control. check If hasErrCtl is true then this is the shell command to turn error checking on. If hasErrCtl is false then this is a command template to echo commands for which error checking is disabled. The template must contain a %s. If hasErrCtl is true, this is the shell command to turn error checking off. If hasErrCtl is false, this is a command template to execute a command so that errors are ignored. The template must contain a %s. This is a string of meta characters of the shell. This is a string holding all the shells builtin commands separated by blanks. The meta and builtins strings are used in compat mode. When a command line contains neither a meta character nor starts with a shell builtin, it is executed directly without invoking a shell. When one of these strings (or both) is empty all commands are executed through a shell. If true, remove the ENV environment variable before executing any command. This is useful for the Korn-shell ( ksh ) .

ignore

meta builtins

unsetenv

Values that are strings must be surrounded by double quotes. Boolean values are specied as T or Y (in either case) to mean true. Any other value is taken to mean false. There are several uses of the .SHELL target: Selecting one of the builtin shells. This is done by just specifying the name of the shell with the name keyword. It is also possible to modify the parameters of the builtin shell by just specifying other keywords (except for path).

FreeBSD 7.2

December 29, 2008

12

MAKE (1)

FreeBSD General Commands Manual

MAKE (1)

Using another executable for one of the builtin shells. This is done by specifying the path to the executable with the path keyword. If the last component is the same as the name of the builtin shell, no name needs to be specied; if it is different, the name must be given: .SHELL: path="/usr/local/bin/sh" selects the builtin shell sh but will execute it from /usr/local/bin/sh. Like in the previous case, it is possible to modify parameters of the builtin shell by just specifying them.

Using an entirely different shell. This is done by specifying all keywords.

The builtin shells are sh, csh and ksh. Because FreeBSD has no ksh in /bin, it is unwise to specify name="ksh" without also specifying a path. .SILENT .SUFFIXES Each source species a sufx to make. If no sources are specied, any previous specied sufces are deleted. .WARN Each source species a warning ag as previously described for the x command line option. Warning ags specied on the command line take precedence over ags specied in the makele. Also, command line warning ags are pushed to sub-makes through the MAKEFLAGS environment variables so that a warning ag specied on the command line will inuence all sub-makes. Several ags can be specied on a single .WARN target by seperating them with blanks. Apply the .SILENT attribute to any specied sources. If no sources are specied, the .SILENT attribute is applied to every command in the le.

REMAKING MAKEFILES If the special target .MAKEFILEDEPS exists in the Makele, make enables the Remaking Makeles feature. After reading Makele and all the les that are included using .include or .sinclude directives (source Makeles) make considers each source Makele as a target and tries to rebuild it. Both explicit and implicit rules are checked and all source Makeles are updated if necessary. If any of the source Makeles were rebuilt, make restarts from clean state. To prevent innite loops the following source Makele targets are ignored: :: targets that have no prerequisites ! targets targets that have .PHONY or .EXEC attributes targets without prerequisites and without commands

When remaking a source Makele options -t (touch target), -q (query mode), and -n (no exec) do not take effect, unless source Makele is specied explicitly as a target in make command line. Additionally, system makeles and .depend are not considered as Makeles that can be rebuilt. ENVIRONMENT The make utility uses the following environment variables, if they exist: MACHINE, MAKE, MAKEFLAGS, MAKEOBJDIR, and MAKEOBJDIRPREFIX. FILES

FreeBSD 7.2

December 29, 2008

13

MAKE (1)

FreeBSD General Commands Manual

MAKE (1)

.depend Makefile makefile obj sys.mk /usr/share/mk /usr/share/doc/psd/12.make /usr/obj /etc/make.conf

list of dependencies list of dependencies list of dependencies object directory system makele default system makele directory PMake tutorial default MAKEOBJDIRPREFIX directory. default path to make.conf(5)

EXAMPLES List all included makeles in order visited: make -V .MAKEFILE_LIST | tr \ \\n

COMPATIBILITY Older versions of make used MAKE instead of MAKEFLAGS. This was removed for POSIX compatibility. The internal variable MAKE is set to the same value as .MAKE; support for this may be removed in the future. Most of the more esoteric features of make should probably be avoided for greater compatibility. SEE ALSO mkdep(1), make.conf(5) PMake - A Tutorial. in /usr/share/doc/psd/12.make HISTORY A make command appeared in PWB UNIX. BUGS The determination of .OBJDIR is contorted to the point of absurdity. In the presence of several .MAIN special targets, make silently ignores all but the rst. .TARGETS is not set to the default target when make is invoked without a target name and no .MAIN special target exists. The evaluation of expression in a test is very simple-minded. Currently, the only form that works is .if ${VAR} op something For instance, you should write tests as .if ${VAR} == string not the other way around, which would give you an error. For loops are expanded before tests, so a fragment such as: .for ARCH in ${SHARED_ARCHS} .if ${ARCH} == ${MACHINE} ... .endif .endfor will not work, and should be rewritten as: .for ARCH in ${SHARED_ARCHS} .if ${MACHINE} == ${ARCH} ... .endif .endfor

FreeBSD 7.2

December 29, 2008

14

MAKE (1)

FreeBSD General Commands Manual

MAKE (1)

The parsing code is broken with respect to handling a semicolon after a colon, so a fragment like this will fail: HDRS= foo.h bar.h

all: .for h in ${HDRS:S;;${.CURDIR}/;} ... .endfor A trailing backslash in a variable value dened on the command line causes the delimiting space in the MAKEFLAGS environment variable to be preceded by that backslash. That causes a submake to not treat that space as a word delimiter. Fixing this requires a larger rewrite of the code handling command line macros and assignments to .MAKEFLAGS.

FreeBSD 7.2

December 29, 2008

15

Vous aimerez peut-être aussi