nmake:批处理文件可以作为 make 命令块的一部分运行,影响 nmake.exe 进程的环境吗?
我想在nmake中如果我这样做:
example :
set value=77
echo %%value%%
结果将在控制台上显示77。
有没有办法让我调用 .cmd 或 .bat 文件来影响 nmake.exe 进程的环境?假设我将语句 set value=77
放入名为“setvalue.cmd”的文件中。然后将 makefile 更改为:
example :
setvalue
echo %%value%%
我得到:
%value%
或者,如果有一种方法可以在命令块中设置宏,那也可以。或者,一种从批处理文件设置宏值的方法,甚至在命令块之外也是如此。
I think in nmake if I do this:
example :
set value=77
echo %%value%%
The result will display 77 on the console.
Is there a way for me to invoke a .cmd or .bat file that will affect the environment of the nmake.exe process? Suppose I put the statement set value=77
in a file called "setvalue.cmd". Then change the makefile to this:
example :
setvalue
echo %%value%%
I get:
%value%
Alternatively, if there's a way to set a macro within a command block, that would also work. Or, a way to set the value of a macro from a batch file, even outside a command block.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以在 makefile 预处理期间创建一个 nmake 片段,并将其读入。假设
batch.cmd
输出有效的 nmake 语法,那么您应该确保
batch.cmd
设置%errorlevel%
适当(例如,exit /b 22
)。makefile.auto
可以包含任何内容,但您可能需要像value=77
这样的内容。几点:value
($(value)
)batch.cmd
([batch.cmd $(OBJECTS) >makefile.auto]
)You can create an nmake snippet during makefile pre-processing, and read that in. Assuming
batch.cmd
outputs valid nmake syntax, thenYou should ensure
batch.cmd
sets%errorlevel%
appropriately (e.g.,exit /b 22
).makefile.auto
can contain anything, but you would probably want stuff likevalue=77
. A couple of points:value
using nmake syntax ($(value)
)batch.cmd
if necessary ([batch.cmd $(OBJECTS) >makefile.auto]
)不,我不这么认为。
No, I don't think so.