我可以让 make 表现得像守护进程吗?

发布于 2025-01-07 06:31:11 字数 492 浏览 1 评论 0原文

我正在开发一个具有非常轻量级构建步骤的项目,如下所示:

cat f1.js f2.js f3.js f4.js > glom.js

所以首先我编写了一个 makefile 来完成它,而且效果很好。

然后,当我迭代该项目时,我意识到必须手动运行 make 真的很烦人,因此我编写了一个 python 脚本来监视文件系统和 makefile,并在发生变化时运行 make。

这也很好,但我想到这是 make 应该自己做的事情,当 make 可以很好地完成这项工作时,我宁愿不要让 python 脚本漂浮在源代码树上。

所以我四处搜寻,但没有找到任何这样的例子。我的问题如下:

  • make有这个功能吗?
  • 如果不...
    • 让它表现出这种行为的明智方法是什么?
    • 对于 make 来说,这是一个明智的功能吗? (如果我要实现它,有人会关心吗?)

I'm working on a project with very lightweight build steps that look like this:

cat f1.js f2.js f3.js f4.js > glom.js

So first I wrote a makefile that does it and it was good.

Then as I was iterating on the project I realized that having to run make manually was really annoying so I wrote a python script that watches the filesystem and makefile and runs make whenever something changes.

That was fine too, but it occurred to me that this is something make should do on its own, and I would rather not have a python script floating around the source tree when make can do the job just fine.

So I searched around but didn't find any examples of this. My questions are as follows:

  • Does make have this feature?
  • If not...
    • What's a sensible way to get it to behave this way?
    • Is this a sensible feature for make to have? (if I were to implement it, would anyone care?)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

━╋う一瞬間旳綻放 2025-01-14 06:31:11

这不是 Make 的责任,因此它不这样做。在许多情况下,重建是一个复杂且耗时的过程,在这种情况下,您当然不希望在对源文件的每次更改时都发生重建。

然而,许多 IDE 都能够在发生更改时执行自动重建(例如 Eclipse CDT)。

This isn't the responsibility of Make, which is why it doesn't do it. In many cases, rebuilding is a complex, time-consuming process, in which case you certainly don't want it to occur on every single change to the source files.

However, many IDEs are capable of performing auto-rebuild when changes are made (e.g. Eclipse CDT).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文