NMAKE Help (nmake.hlp) (
Table of Contents;
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
Substitution Within Macros
◄Up► ◄Contents► ◄Index► ◄Back►
─────NMAKE──────────────────────────────────────────────────────────────────
You can use a macro to substitute text within another macro. The
substitution applies only to the current use of the macro and does
not modify the original macro definition. You can also substitute
text in any predefined macro (except $$@).
To substitute text within a macro, use the following syntax:
$(macroname:string1=string2)
Each occurrence of <string1> in <macroname> is replaced by
<string2>. No spaces or tabs can appear before the colon (:).
Spaces after the colon are interpreted as part of the string in
which they occur. If <string2> is a null string, all occurrences
of <string1> are deleted from the <macroname> macro.
Macro substitution is literal and case sensitive. The strings
cannot contain macro expansions.
Example
OBJS = ONE.OBJ TWO.OBJ THREE.OBJ
To replace each space in the OBJS macro with a space, followed by
a plus sign, followed by a newline character, invoke OBJS as:
$(OBJS: = +^
)
The caret (^) tells NMAKE to treat the end of the line as a
literal newline character. The value after substitution is:
ONE.OBJ +
TWO.OBJ +
THREE.OBJ
This example is useful for creating response files.
-♦-