Output translations
Macros in shell commands are translated when executed.
The form is as follows:
$(macro:string1=string2)
For each appearance of string1 in the evaluated macro,
string2 is substituted.
Finding string1 in $(macro)
means that the evaluated $(macro) is considered a series of strings,
each delimited by white space (blanks or tabs).
Thus, the occurrence of string1 in $(macro) means
that a regular expression of the following form was found:
.<string1>[TAB|BLANK]
This particular form was chosen because make usually concerns itself
with suffixes.
This type of translation is useful when maintaining
archive libraries.
Now, all that is necessary is to accumulate the
out-of-date members and write a shell script
that can handle all the C language programs
(which are those files ending in .c).
Thus, the following fragment optimizes the executions
of make for maintaining an archive library:
$(LIB): $(LIB)(a.o) $(LIB)(b.o) $(LIB)(c.o)
$(CC) -c $(CFLAGS) $(?:.o=.c)
$(AR) $(ARFLAGS) $(LIB) $?
rm $?
A dependency of the preceding form is necessary for each of the different
types of source files (suffixes) that define the archive library.
These translations are added in an effort to make more general
use of the wealth of information that make generates.
Next topic:
Suffixes and transformation rules
Previous topic:
Executable commands
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003