(make.info.gz) Substitution Refs
Info Catalog
(make.info.gz) Advanced
(make.info.gz) Advanced
(make.info.gz) Computed Names
6.3.1 Substitution References
-----------------------------
A "substitution reference" substitutes the value of a variable with
alterations that you specify. It has the form `$(VAR:A=B)' (or
`${VAR:A=B}') and its meaning is to take the value of the variable VAR,
replace every A at the end of a word with B in that value, and
substitute the resulting string.
When we say "at the end of a word", we mean that A must appear
either followed by whitespace or at the end of the value in order to be
replaced; other occurrences of A in the value are unaltered. For
example:
foo := a.o b.o c.o
bar := $(foo:.o=.c)
sets `bar' to `a.c b.c c.c'. Setting Variables Setting.
A substitution reference is actually an abbreviation for use of the
`patsubst' expansion function ( Functions for String Substitution
and Analysis Text Functions.). We provide substitution references as
well as `patsubst' for compatibility with other implementations of
`make'.
Another type of substitution reference lets you use the full power of
the `patsubst' function. It has the same form `$(VAR:A=B)' described
above, except that now A must contain a single `%' character. This
case is equivalent to `$(patsubst A,B,$(VAR))'. Functions for
String Substitution and Analysis Text Functions, for a description of
the `patsubst' function.
For example:
foo := a.o b.o c.o
bar := $(foo:%.o=%.c)
sets `bar' to `a.c b.c c.c'.
Info Catalog
(make.info.gz) Advanced
(make.info.gz) Advanced
(make.info.gz) Computed Names
automatically generated byinfo2html