Automatic variables in Makefiles (make/gmake)
$@: The filename representing the target
$%: The filename element of an archive member specification
$<: The filename of the first prerequisite
$?: The names of all prerequisite that are newer than the target, separated by spaces
$^: The filenames of all the prerequisite's, separated by spaces. (Without duplicates)
$+: Same as $^, except that it includes duplicates
$*: The stem of target filename. A stem is typically a filename without it's suffix.
User defined variables
*) A variable name can contain any characters including spaces except # and =.
*) Case sensitive
*) To get the value of a variable, enclose the variable name in $(). Single-letter variable can omit parenthesis
*) Variables can also be expanded using curly braces as in ${CC}
*) The value of a variable consists of all the words to the right of the assignment symbol with leading space trimmed. Trailing spaces are not trimmed
No comments:
Post a Comment