nmake 推理规则限制为深度 1
我注意到 nmake.exe 将其推理规则搜索限制为一个丢失的文件。我发现网络上没有提到这个问题。我错过了什么吗?
$ cat Makefile .SUFFIXES: .a .b .d .e all: abc.e .a.b: copy $** $@ .b.d: copy $** $@ .d.e: copy $** $@ $ touch abc.a $ nmake NMAKE : fatal error U1073: don't know how to make 'abc.e' Stop. $ nmake -n abc.a 'abc.a' is up-to-date $ nmake -n abc.b copy abc.a abc.b $ nmake -n abc.d NMAKE : fatal error U1073: don't know how to make 'abc.d' Stop.
同样的 Makefile 使用 GNU make 生成以下内容:
$ make -n copy abc* abc.b copy abc* abc.d copy abc* abc.e rm abc.b abc.d
当然,$**
宏和 copy
命令在 GNU make 中并不那么有用。 ;-)
你的 nmake.exe
版本能更好地处理这个问题吗?有魔法开关吗?或者它真的像看起来那样破碎吗?
I have noticed nmake.exe
limits its inference-rule search to one missing file. I find no mention of the problem on the Web. Am I missing something?
$ cat Makefile .SUFFIXES: .a .b .d .e all: abc.e .a.b: copy $** $@ .b.d: copy $** $@ .d.e: copy $** $@ $ touch abc.a $ nmake NMAKE : fatal error U1073: don't know how to make 'abc.e' Stop. $ nmake -n abc.a 'abc.a' is up-to-date $ nmake -n abc.b copy abc.a abc.b $ nmake -n abc.d NMAKE : fatal error U1073: don't know how to make 'abc.d' Stop.
This same Makefile produces tbe following with GNU make:
$ make -n copy abc* abc.b copy abc* abc.d copy abc* abc.e rm abc.b abc.d
Of course, the $**
macro and copy
command aren't as useful in with GNU make. ;-)
Does your version of nmake.exe
handle this any better? Is there a magic switch? Or is it really as broken as it seems?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里的问题是跟踪构建过程中的多步骤操作。您的源文件会生成某种中间文件,进而生成最终的构建输出。在糟糕的环境中,您可能会对源文件进行更改,然后您的最终二进制文件仍然可以从中间文件的过时版本构建。显然,那会很糟糕。
GNU make 采用立即对整个依赖树进行建模的方法,并一直跟踪修改的文件直至输出。如果 make 是您使用的唯一构建工具,那么这很棒。如果您有非常大的项目,则此方法效果不佳,因此您需要按特定顺序进行制作。如果“make”不支持构建过程中的某些工具,则此方法效果不佳,因此无论如何您都需要运行多次。
nmake.exe 采用尽可能简单的方法:一次只执行一次。它假设它将成为更大工具链的一部分。因此,如果您具有多遍依赖项,则将需要多次 nmake。如果您的构建过程需要超过 3 遍,那么您可能正在做一件坏事,您应该修复您的过程。对于大声喊叫,如果您需要多次传递,只需编写一个脚本即可完成。
The problem here is tracking multi-step operations in your build process. Your source files produce intermediate files of some sort which in turn produce the final build output. In a bad universe, you might make changes to a source file and then your final binaries could still be built from stale versions of the intermediate files. Obviously, that would be bad.
GNU make takes the approach of modeling the entire dependency tree at once, and tracing the modified files all the way through to the output. This is great if make is the only build tool you use. This doesn't work well if you have very large projects, so you need to make them in a specific order. This doesn't work well if 'make' doesn't support some tools of your build process, so you would need to run make multiple times anyway.
nmake.exe takes the approach of doing the simplest possible thing: Only doing one pass at a time. It assumes it will be part of a larger tool chain. So if you have multi-pass dependencies, you will need multiple passes of nmake. If your build process requires more than 3 passes, you are probably doing A Bad Thing and you should fix your process. And for crying out loud, if you need multiple passes, just write a script to do it.