Macros Cannot Be Used as Substitution Strings for Other Macros

ID Number: Q71286

1.00 1.01 1.10 1.11 1.12 1.13 | 1.01 1.10 1.11 1.12 1.13

MS-DOS | OS/2

Summary:

The NMAKE utility provides a macro substitution feature that allows

you to replace specific string occurrences in a macro with a

substitute string. However, NMAKE will not evaluate another macro as

the replacement text in a macro substitution.

More Information:

Assume an NMAKE description file (makefile) contains the following

lines:

SAMPLE=sit sat set

NEW=m

all:

echo $(SAMPLE:s=b)

The echo command echoes the contents of the macro SAMPLE, but all

occurrences of the letter "s" in the macro are replaced with the

letter "b" (resulting in the output of "bit bat bet"). On the other

hand, the following macro substitution does not behave as intended:

echo $(SAMPLE:s=$(NEW))

The intent here is to output "mit mat met", but in a macro

substitution, any characters placed between the colon and the right

parenthesis are taken literally. Therefore, an embedded macro is not

evaluated. In this case, the unexpected output that results is

"$(NEW)it $(NEW)at $(NEW)et".