make: Features
1
1 14 Features of GNU 'make'
1 *************************
1
1 Here is a summary of the features of GNU 'make', for comparison with and
1 credit to other versions of 'make'. We consider the features of 'make'
1 in 4.2 BSD systems as a baseline. If you are concerned with writing
1 portable makefiles, you should not use the features of 'make' listed
1 here, nor the ones in ⇒Missing.
1
1 Many features come from the version of 'make' in System V.
1
11 * The 'VPATH' variable and its special meaning. ⇒Searching
Directories for Prerequisites Directory Search. This feature
1 exists in System V 'make', but is undocumented. It is documented
1 in 4.3 BSD 'make' (which says it mimics System V's 'VPATH'
1 feature).
1
1 * Included makefiles. ⇒Including Other Makefiles Include.
1 Allowing multiple files to be included with a single directive is a
1 GNU extension.
1
1 * Variables are read from and communicated via the environment.
1 ⇒Variables from the Environment Environment.
1
1 * Options passed through the variable 'MAKEFLAGS' to recursive
11 invocations of 'make'. ⇒Communicating Options to a
Sub-'make' Options/Recursion.
1
1 * The automatic variable '$%' is set to the member name in an archive
1 reference. ⇒Automatic Variables.
1
1 * The automatic variables '$@', '$*', '$<', '$%', and '$?' have
1 corresponding forms like '$(@F)' and '$(@D)'. We have generalized
1 this to '$^' as an obvious extension. ⇒Automatic Variables.
1
11 * Substitution variable references. ⇒Basics of Variable
References Reference.
1
1 * The command line options '-b' and '-m', accepted and ignored. In
1 System V 'make', these options actually do something.
1
1 * Execution of recursive commands to run 'make' via the variable
11 'MAKE' even if '-n', '-q' or '-t' is specified. ⇒Recursive
Use of 'make' Recursion.
1
11 * Support for suffix '.a' in suffix rules. ⇒Archive Suffix
Rules. This feature is obsolete in GNU 'make', because the
11 general feature of rule chaining (⇒Chains of Implicit Rules
Chained Rules.) allows one pattern rule for installing members in
1 an archive (⇒Archive Update) to be sufficient.
1
1 * The arrangement of lines and backslash/newline combinations in
1 recipes is retained when the recipes are printed, so they appear as
1 they do in the makefile, except for the stripping of initial
1 whitespace.
1
1 The following features were inspired by various other versions of
1 'make'. In some cases it is unclear exactly which versions inspired
1 which others.
1
1 * Pattern rules using '%'. This has been implemented in several
1 versions of 'make'. We're not sure who invented it first, but it's
11 been spread around a bit. ⇒Defining and Redefining Pattern
Rules Pattern Rules.
1
1 * Rule chaining and implicit intermediate files. This was
1 implemented by Stu Feldman in his version of 'make' for AT&T Eighth
1 Edition Research Unix, and later by Andrew Hume of AT&T Bell Labs
1 in his 'mk' program (where he terms it "transitive closure"). We
1 do not really know if we got this from either of them or thought it
11 up ourselves at the same time. ⇒Chains of Implicit Rules
Chained Rules.
1
1 * The automatic variable '$^' containing a list of all prerequisites
1 of the current target. We did not invent this, but we have no idea
1 who did. ⇒Automatic Variables. The automatic variable '$+'
1 is a simple extension of '$^'.
1
1 * The "what if" flag ('-W' in GNU 'make') was (as far as we know)
11 invented by Andrew Hume in 'mk'. ⇒Instead of Executing
Recipes Instead of Execution.
1
1 * The concept of doing several things at once (parallelism) exists in
1 many incarnations of 'make' and similar programs, though not in the
11 System V or BSD implementations. ⇒Recipe Execution
Execution.
1
1 * A number of different build tools that support parallelism also
11 support collecting output and displaying as a single block. ⇒
Output During Parallel Execution Parallel Output.
1
1 * Modified variable references using pattern substitution come from
1 SunOS 4. ⇒Basics of Variable References Reference. This
1 functionality was provided in GNU 'make' by the 'patsubst' function
1 before the alternate syntax was implemented for compatibility with
1 SunOS 4. It is not altogether clear who inspired whom, since GNU
1 'make' had 'patsubst' before SunOS 4 was released.
1
1 * The special significance of '+' characters preceding recipe lines
1 (⇒Instead of Executing Recipes Instead of Execution.) is
1 mandated by 'IEEE Standard 1003.2-1992' (POSIX.2).
1
1 * The '+=' syntax to append to the value of a variable comes from
1 SunOS 4 'make'. ⇒Appending More Text to Variables Appending.
1
1 * The syntax 'ARCHIVE(MEM1 MEM2...)' to list multiple members in a
11 single archive file comes from SunOS 4 'make'. ⇒Archive
Members.
1
1 * The '-include' directive to include makefiles with no error for a
1 nonexistent file comes from SunOS 4 'make'. (But note that SunOS 4
1 'make' does not allow multiple makefiles to be specified in one
1 '-include' directive.) The same feature appears with the name
1 'sinclude' in SGI 'make' and perhaps others.
1
1 * The '!=' shell assignment operator exists in many BSD of 'make' and
1 is purposefully implemented here to behave identically to those
1 implementations.
1
1 * Various build management tools are implemented using scripting
1 languages such as Perl or Python and thus provide a natural
1 embedded scripting language, similar to GNU 'make''s integration of
1 GNU Guile.
1
1 The remaining features are inventions new in GNU 'make':
1
1 * Use the '-v' or '--version' option to print version and copyright
1 information.
1
1 * Use the '-h' or '--help' option to summarize the options to 'make'.
1
11 * Simply-expanded variables. ⇒The Two Flavors of Variables
Flavors.
1
1 * Pass command line variable assignments automatically through the
11 variable 'MAKE' to recursive 'make' invocations. ⇒Recursive
Use of 'make' Recursion.
1
1 * Use the '-C' or '--directory' command option to change directory.
1 ⇒Summary of Options Options Summary.
1
11 * Make verbatim variable definitions with 'define'. ⇒Defining
Multi-Line Variables Multi-Line.
1
1 * Declare phony targets with the special target '.PHONY'.
1
1 Andrew Hume of AT&T Bell Labs implemented a similar feature with a
1 different syntax in his 'mk' program. This seems to be a case of
1 parallel discovery. ⇒Phony Targets Phony Targets.
1
11 * Manipulate text by calling functions. ⇒Functions for
Transforming Text Functions.
1
1 * Use the '-o' or '--old-file' option to pretend a file's
11 modification-time is old. ⇒Avoiding Recompilation of Some
Files Avoiding Compilation.
1
1 * Conditional execution.
1
1 This feature has been implemented numerous times in various
1 versions of 'make'; it seems a natural extension derived from the
1 features of the C preprocessor and similar macro languages and is
11 not a revolutionary concept. ⇒Conditional Parts of Makefiles
Conditionals.
1
11 * Specify a search path for included makefiles. ⇒Including
Other Makefiles Include.
1
1 * Specify extra makefiles to read with an environment variable.
1 ⇒The Variable 'MAKEFILES' MAKEFILES Variable.
1
1 * Strip leading sequences of './' from file names, so that './FILE'
1 and 'FILE' are considered to be the same file.
1
1 * Use a special search method for library prerequisites written in
11 the form '-lNAME'. ⇒Directory Search for Link Libraries
Libraries/Search.
1
11 * Allow suffixes for suffix rules (⇒Old-Fashioned Suffix Rules
Suffix Rules.) to contain any characters. In other versions of
1 'make', they must begin with '.' and not contain any '/'
1 characters.
1
1 * Keep track of the current level of 'make' recursion using the
1 variable 'MAKELEVEL'. ⇒Recursive Use of 'make' Recursion.
1
1 * Provide any goals given on the command line in the variable
1 'MAKECMDGOALS'. ⇒Arguments to Specify the Goals Goals.
1
11 * Specify static pattern rules. ⇒Static Pattern Rules Static
Pattern.
1
11 * Provide selective 'vpath' search. ⇒Searching Directories for
Prerequisites Directory Search.
1
11 * Provide computed variable references. ⇒Basics of Variable
References Reference.
1
11 * Update makefiles. ⇒How Makefiles Are Remade Remaking
Makefiles. System V 'make' has a very, very limited form of this
1 functionality in that it will check out SCCS files for makefiles.
1
11 * Various new built-in implicit rules. ⇒Catalogue of Built-In
Rules Catalogue of Rules.
1
1 * Load dynamic objects which can modify the behavior of 'make'.
1 ⇒Loading Dynamic Objects Loading Objects.
1