| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This appendix summarizes the directives, text manipulation functions,
and special variables which GNU make understands.
See section Special Built-in Target Names, Catalogue of Implicit Rules,
and Summary of Options,
for other summaries.
Here is a summary of the directives GNU make recognizes:
define variableendefDefine a multi-line, recursively-expanded variable.
See section Defining Canned Command Sequences.
ifdef variableifndef variableifeq (a,b)ifeq "a" "b"ifeq 'a' 'b'ifneq (a,b)ifneq "a" "b"ifneq 'a' 'b'elseendifConditionally evaluate part of the makefile.
See section Conditional Parts of Makefiles.
include fileInclude another makefile.
See section Including Other Makefiles.
override variable = valueoverride variable := valueoverride variable += valueoverride define variableendefDefine a variable, overriding any previous definition, even one from
the command line.
See section The override Directive.
exportTell make to export all variables to child processes by default.
See section Communicating Variables to a Sub-make.
export variableexport variable = valueexport variable := valueexport variable += valueunexport variableTell make whether or not to export a particular variable to child
processes.
See section Communicating Variables to a Sub-make.
vpath pattern pathSpecify a search path for files matching a ‘%’ pattern.
See section The vpath Directive.
vpath patternRemove all search paths previously specified for pattern.
vpathRemove all search paths previously specified in any vpath
directive.
Here is a summary of the text manipulation functions (see section Functions for Transforming Text):
$(subst from,to,text)Replace from with to in text.
See section Functions for String Substitution and Analysis.
$(patsubst pattern,replacement,text)Replace words matching pattern with replacement in text.
See section Functions for String Substitution and Analysis.
$(strip string)Remove excess whitespace characters from string.
See section Functions for String Substitution and Analysis.
$(findstring find,text)Locate find in text.
See section Functions for String Substitution and Analysis.
$(filter pattern…,text)Select words in text that match one of the pattern words.
See section Functions for String Substitution and Analysis.
$(filter-out pattern…,text)Select words in text that do not match any of the pattern words.
See section Functions for String Substitution and Analysis.
$(sort list)Sort the words in list lexicographically, removing duplicates.
See section Functions for String Substitution and Analysis.
$(dir names…)Extract the directory part of each file name.
See section Functions for File Names.
$(notdir names…)Extract the non-directory part of each file name.
See section Functions for File Names.
$(suffix names…)Extract the suffix (the last ‘.’ and following characters) of each file name.
See section Functions for File Names.
$(basename names…)Extract the base name (name without suffix) of each file name.
See section Functions for File Names.
$(addsuffix suffix,names…)Append suffix to each word in names.
See section Functions for File Names.
$(addprefix prefix,names…)Prepend prefix to each word in names.
See section Functions for File Names.
$(join list1,list2)Join two parallel lists of words.
See section Functions for File Names.
$(word n,text)Extract the nth word (one-origin) of text.
See section Functions for File Names.
$(words text)Count the number of words in text.
See section Functions for File Names.
$(firstword names…)Extract the first word of names.
See section Functions for File Names.
$(wildcard pattern…)Find file names matching a shell file name pattern (not a
‘%’ pattern).
See section The Function wildcard.
$(shell command)Execute a shell command and return its output.
See section The shell Function.
$(origin variable)Return a string describing how the make variable variable was
defined.
See section The origin Function.
$(foreach var,words,text)Evaluate text with var bound to each word in words,
and concatenate the results.
See section The foreach Function.
Here is a summary of the automatic variables. See section Automatic Variables, for full information.
$@타겟의 파일 이름.
$%The target member name, when the target is an archive member.
$<첫번째 의존성의 이름.
$?타겟보다 새로운 모든 의존성의 이름들을 사이사이에 공백을 넣은 값.
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 (see section Using make to Update Archive Files).
$^$+The names of all the dependencies, with spaces between them. For
dependencies which are archive members, only the member named is used
(see section Using make to Update Archive Files). The value of $^ omits duplicate
dependencies, while $+ retains them and preserves their order.
$*The stem with which an implicit rule matches (see section 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 $+.
$(?D)$(?F)The directory part and the file-within-directory part of $?.
These variables are used specially by GNU make:
MAKEFILESMakefiles to be read on every invocation of make.
See section The Variable MAKEFILES.
VPATHDirectory search path for files not found in the current directory.
See section VPATH Search Path for All Dependencies.
SHELL시스템 기본 명령어 해석기의 이름으로, 보통 ‘/bin/sh’이다.
메이크파일의 SHELL 변수의 값으로, 명령어를 실행할 때 쓰이는 셸을
바꿀 수 있다. See section 명령어 실행.
MAKESHELLMS-DOS 전용으로, make에서 사용될 명령어 해석기의 이름이다. 이
값은 SHELL의 값보다 우선한다. See section MAKESHELL 변수.
MAKEThe name with which make was invoked.
Using this variable in commands has special meaning.
See section How the MAKE Variable Works.
MAKELEVELThe number of levels of recursion (sub-makes).
See section Communicating Variables to a Sub-make.
MAKEFLAGSThe flags given to make. You can set this in the environment or
a makefile to set flags.
See section Communicating Options to a Sub-make.
MAKECMDGOALSThe targets given to make on the command line. Setting this
variable has no effect on the operation of make.
See section Arguments to Specify the Goals.
CURDIRSet to the pathname of the current working directory (after all
-C options are processed, if any). Setting this variable has no
effect on the operation of make.
See section Recursive Use of make.
SUFFIXESThe default list of suffixes before make reads any makefiles.
| [ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on April 12, 2025 using texi2html 5.0.