nmake – simple question about escaping
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)

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
发布评论
需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。