views:

94

answers:

1

Hi

I'd like to make below nmake code to produce check.mak file with the following contents: $(A) instead I get the following error: "NMAKE : fatal error U1040: internal error : macro expansion" Any suggestions? My nmake version is 9.00.30729.01 (VC 2008).

OPTION = A
FILE = check.mak

all :
    @echo "$$($(OPTION))" > $(FILE)
+1  A: 

This looks like a bug in NMAKE. After some experimentation I found that the following work-around gives you the output you want, although it's a little ugly:

OPTION=A
FILE=check.mak
LPAREN=(
RPAREN=)

all:
        echo $$$(LPAREN)$(OPTION)$(RPAREN) > $(FILE)

For what it's worth, I also tried your original with the NMAKE emulator that my company sells, and found that it was able to process the makefile with no errors, which is why I feel confident in saying that the observed behavior is a bug in the NMAKE implementation rather than a limitation of the NMAKE syntax.

Hope that helps,

Eric Melski

Eric Melski
I raised this issue on MS Connect -https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=435762In short the response is MS doesn't care.
Piotr Dobrogost