printing long compilation lines with MS NMAKE

只愿长相守 提交于 2019-12-04 11:27:58
Elazar Leibovich

In order to keep the temporary file that keeps your command line append the KEEP keyword after the final <<. For example

dep:
    echo cmd @<<tmpfilename
cmd_args..
<<KEEP

In this case after issuing nmake dep a file named tmpfilename will remain, and hold the arguments list cmd_args.

See sample makefile 2 in this MS KB article. This and this (warning:PDF) are explanation of the KEEP and NOKEEP keyword, but I'm not sure if they were written specifically for MS NMAKE.

Edit: above links were replaced in 2019/08 since all of them were dead. The new links point to archived copies that seem to contain what the OP was referring to in this answer.

The syntax is described in Inline Files in a Makefile and specifically Reusing inline files.

Normal unix make supports "make -n" to show the commands it would run, for nmake it is "make /n". However, make usually also tries to be smart and will run rules that update dependencies first in any case, even for "-n", so you might try

#dep:
my_test_rule:
    cmd @<<tmpfilename
cmd_args..
<<

and then run "nmake /n my_test_rule" for your debugging.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!