nmake – simple question about escaping

nmake – simple question about escaping

乞讨 发布于 2021-11-28 字数 359 浏览 735 回复 1 原文

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)

如果你对这篇文章有疑问,欢迎到本站 社区 发帖提问或使用手Q扫描下方二维码加群参与讨论,获取更多帮助。

扫码加入群聊

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

陌路黄昏 2022-06-07 1 楼

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