NMAKE 1.11/1.12/1.13 Do Not Parse Escape Character Correctly

ID Number: Q74706

1.11 1.12 1.13 | 1.11 1.12 1.13

MS-DOS | OS/2

buglist1.11 buglist1.12 buglist1.13

Summary:

In NMAKE, the caret (^) symbol is used as an escape character for the

characters #()$^\{}!@- (which NMAKE uses as control characters). If

you create an NMAKE macro that contains one of these symbols, you may,

due to context, need to use the caret symbol to indicate that you want

the literal character in the macro. If you use a caret when one is not

needed, the caret should be ignored, but this does not always work

correctly in NMAKE versions 1.11, 1.12, and 1.13.

More Information:

Using ^^ or ^$ also fails to work correctly. In some cases, the

leading caret is not removed even though it is needed to get a caret

or dollar sign. However, NMAKE might also remove both characters.

For example, if you create a macro containing two carets preceded by

another character, such as abc^^abc, NMAKE will not correctly parse

out the first caret, leaving only one caret. Instead, it leaves both

carets in the macro. If, on the other hand, you create a macro

containing two carets preceded only by the equal sign for the macro

assignment, such as ^^abc, NMAKE will parse out both carets leaving

only the abc.

The sample makefiles below illustrate these problems. Each makefile

contains comments showing the expected output and the actual output

with NMAKE versions 1.11, 1.12, and 1.13.

To work around the first described problem, in which NMAKE does not

remove the unneeded caret, you can remove the caret symbol. To work

around the problem with the ^$, a $$ can be used instead. There is no

direct workaround for the problem with the ^^.

Microsoft has confirmed this to be a problem in NMAKE versions 1.11,

1.12, and 1.13. We are researching this problem and will post new

information here as it becomes available.

Sample Makefile #1

------------------

test=abc^!abc # note: test=abc!abc will work

ALL:

echo $(test)

# expected output : echo abc!abc

# resulting output: echo abc^!abc

Sample Makefile #2

------------------

test=abc^$abc # note: test=abc$$abc will work

ALL:

echo $(test)

# expected output : echo abc$abc

# resulting output: echo abc^$abc

Sample Makefile #3

------------------

test=abc^^abc

ALL:

echo $(test)

# expected output : echo abc^abc

# resulting output: echo abc^^abc

Sample Makefile #4

------------------

test=^^abc

ALL:

echo $(test)

# expected output : echo ^abc

# resulting output: echo abc