并行 make 文件中的关键部分
我正在尝试并行化旧的 Makefile。
事实上,我需要确保在编译过程开始之前某些生成器脚本被调用非并行。
生成器总是在编译之前调用。有什么方法可以在 makefile 中建立一些关键部分吗?
Makefile 很乱,我不想把它发布在这里。
I am trying to parallelize an old Makefile.
In fact I need to make sure that some generator scripts are called not parallel before the compiling procedure starts.
The generators are always called before the compile. Is there any way to establish a somewhat critical section in a makefile?
The Makefile is messy, I'd prefer not to post it here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以将生成文件的规则放在单独的 Makefile 中,并执行如下操作:
但是,对于 GNU Make,默认情况下这将是并行的。您需要抑制它,并且手册并不清楚您将如何做到这一点。也许以下的某种组合会起作用,具体取决于您希望支持的 make 的实现:
传递
-j1
标志:抑制
MAKEFLAGS
选项:在
Makefile.Generators
中使用以下行抑制并行执行:<前><代码>.NOTPARALLEL:
You could put the rules for the generated files in a separate Makefile, and do something like this:
However, with GNU Make, this will be parallel by default. You'll need to suppress it, and the manual isn't exactly clear how you would do that. Maybe some combination of the following would work, depending on which implementations of make you wish to support:
Pass the
-j1
flag:Suppress
MAKEFLAGS
options:Suppress parallel execution with the following line in
Makefile.Generators
:您可以制定运行所有脚本的规则,然后确保所有其他规则都依赖于该规则。
You can make a rule that runs all of the scripts, and then make sure all of your other rules depend on that rule.