本文介绍了用MS NMAKE打印较长的编译行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个旧版MS NMAKE Makefile,我需要修复其中的一些错误.

I have a legacy MS NMAKE Makefile I need to fix a few bugs in.

我想调试一些非常长的命令行,这些命令行正在使用内联文件" :

There are some very long command lines I wish to debug that are being executed using the NMAKE trick of "inline files":

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

将行更改为

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

NMAKE抱怨该行太长.

NMAKE complains that the line is too long.

我还可以使用其他技巧来查看NMAKE实际执行的命令行吗?

Is there any other trick I can apply in order to view the command line NMAKE is actually executing?

推荐答案

为保留用于保留命令行的临时文件,请在最终<<之后附加KEEP关键字.例如

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

在这种情况下,发出nmake dep后,将保留一个名为tmpfilename的文件,并保留参数列表cmd_args.

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

请参阅此. 此(警告:PDF)KEEPNOKEEP关键字的说明,但是我不确定它们是否专门针对MS NMAKE编写.

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.

由于所有链接均已失效,因此在2019/08年替换了上述链接.新链接指向的归档副本似乎包含OP在此答案中所指的内容.

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.

Makefile中的内联文件,特别是重复使用内联文件.

这篇关于用MS NMAKE打印较长的编译行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 19:54