(make.info)Quick Reference


Next: Complex Makefile Prev: Makefile Conventions Up: Top

Quick Reference
***************

   This appendix summarizes the directives, text manipulation functions,
and special variables which GNU `make' understands.  Note: Special
Targets, Note: Catalogue of Implicit Rules, and
Note: Summary of Options, for other summaries.

   Here is a summary of the directives GNU `make' recognizes:

`define VARIABLE'
`endef'
     Define a multi-line, recursively-expanded variable.
     Note: Sequences.

`ifdef VARIABLE'
`ifndef VARIABLE'
`ifeq (A,B)'
`ifeq "A" "B"'
`ifeq 'A' 'B''
`ifneq (A,B)'
`ifneq "A" "B"'
`ifneq 'A' 'B''
`else'
`endif'
     Conditionally evaluate part of the makefile.
     Note: Conditionals.

`include FILE'
     Include another makefile.
     Note: Including Other Makefiles.

`override VARIABLE = VALUE'
`override VARIABLE := VALUE'
`override VARIABLE += VALUE'
`override define VARIABLE'
`endef'
     Define a variable, overriding any previous definition, even one
     from the command line.
     Note: The `override' Directive.

`export'
     Tell `make' to export all variables to child processes by default.
     Note: Communicating Variables to a Sub-`make'.

`export VARIABLE'
`export VARIABLE = VALUE'
`export VARIABLE := VALUE'
`export VARIABLE += VALUE'
`unexport VARIABLE'
     Tell `make' whether or not to export a particular variable to child
     processes.
     Note: Communicating Variables to a Sub-`make'.

`vpath PATTERN PATH'
     Specify a search path for files matching a `%' pattern.
     Note: The `vpath' Directive.

`vpath PATTERN'
     Remove all search paths previously specified for PATTERN.

`vpath'
     Remove all search paths previously specified in any `vpath'
     directive.

   Here is a summary of the text manipulation functions (*note
Functions::.):

`$(subst FROM,TO,TEXT)'
     Replace FROM with TO in TEXT.
     Note: Functions for String Substitution and Analysis
     Functions.

`$(patsubst PATTERN,REPLACEMENT,TEXT)'
     Replace words matching PATTERN with REPLACEMENT in TEXT.
     Note: Functions for String Substitution and Analysis
     Functions.

`$(strip STRING)'
     Remove excess whitespace characters from STRING.
     Note: Functions for String Substitution and Analysis
     Functions.

`$(findstring FIND,TEXT)'
     Locate FIND in TEXT.
     Note: Functions for String Substitution and Analysis
     Functions.

`$(filter PATTERN...,TEXT)'
     Select words in TEXT that match one of the PATTERN words.
     Note: Functions for String Substitution and Analysis
     Functions.

`$(filter-out PATTERN...,TEXT)'
     Select words in TEXT that *do not* match any of the PATTERN words.
     Note: Functions for String Substitution and Analysis
     Functions.

`$(sort LIST)'
     Sort the words in LIST lexicographically, removing duplicates.
     Note: Functions for String Substitution and Analysis
     Functions.

`$(dir NAMES...)'
     Extract the directory part of each file name.
     Note: Functions for File Names.

`$(notdir NAMES...)'
     Extract the non-directory part of each file name.
     Note: Functions for File Names.

`$(suffix NAMES...)'
     Extract the suffix (the last `.' and following characters) of each
     file name.
     Note: Functions for File Names.

`$(basename NAMES...)'
     Extract the base name (name without suffix) of each file name.
     Note: Functions for File Names.

`$(addsuffix SUFFIX,NAMES...)'
     Append SUFFIX to each word in NAMES.
     Note: Functions for File Names.

`$(addprefix PREFIX,NAMES...)'
     Prepend PREFIX to each word in NAMES.
     Note: Functions for File Names.

`$(join LIST1,LIST2)'
     Join two parallel lists of words.
     Note: Functions for File Names.

`$(word N,TEXT)'
     Extract the Nth word (one-origin) of TEXT.
     Note: Functions for File Names.

`$(words TEXT)'
     Count the number of words in TEXT.
     Note: Functions for File Names.

`$(firstword NAMES...)'
     Extract the first word of NAMES.
     Note: Functions for File Names.

`$(wildcard PATTERN...)'
     Find file names matching a shell file name pattern (*not* a `%'
     pattern).
     Note: The Function `wildcard'.

`$(shell COMMAND)'
     Execute a shell command and return its output.
     Note: The `shell' Function.

`$(origin VARIABLE)'
     Return a string describing how the `make' variable VARIABLE was
     defined.
     Note: The `origin' Function.

`$(foreach VAR,WORDS,TEXT)'
     Evaluate TEXT with VAR bound to each word in WORDS, and
     concatenate the results.
     Note: The `foreach' Function.

   Here is a summary of the automatic variables.  Note: Automatic
Variables, for full information.

`$@'
     The file name of the target.

`$%'
     The target member name, when the target is an archive member.

`$<'
     The name of the first dependency.

`$?'
     The names of all the dependencies that are newer than the target,
     with spaces between them.  For dependencies which are archive
     members, only the member named is used (Note: Archives.).

`$^'
     The names of all the dependencies, with spaces between them.  For
     dependencies which are archive members, only the member named is
     used (Note: Archives.).

`$*'
     The stem with which an implicit rule matches (Note: How Patterns
     Match.).

`$(@D)'
`$(@F)'
     The directory part and the file-within-directory part of `$@'.

`$(*D)'
`$(*F)'
     The directory part and the file-within-directory part of `$*'.

`$(%D)'
`$(%F)'
     The directory part and the file-within-directory part of `$%'.

`$(<D)'
`$(<F)'
     The directory part and the file-within-directory part of `$<'.

`$(^D)'
`$(^F)'
     The directory part and the file-within-directory part of `$^'.

`$(?D)'
`$(?F)'
     The directory part and the file-within-directory part of `$?'.

   These variables are used specially by GNU `make':

`MAKEFILES'
     Makefiles to be read on every invocation of `make'.
     Note: The Variable `MAKEFILES'.

`VPATH'
     Directory search path for files not found in the current directory.
     Note: `VPATH' Search Path for All Dependencies.

`SHELL'
     The name of the system default command interpreter, usually
     `/bin/sh'.  You can set `SHELL' in the makefile to change the
     shell used to run commands.  Note: Command Execution.

`MAKE'
     The name with which `make' was invoked.  Using this variable in
     commands has special meaning.  Note: How the `MAKE' Variable
     Works.

`MAKELEVEL'
     The number of levels of recursion (sub-`make's).
     Note: Variables/Recursion.

`MAKEFLAGS'
     The flags given to `make'.  You can set this in the environment or
     a makefile to set flags.
     Note: Communicating Options to a Sub-`make'.

`SUFFIXES'
     The default list of suffixes before `make' reads any makefiles.


automatically generated by info2www