如果您的制作(或构建)目标是文件中存在某些内容怎么办
make 和其他构建系统的典型构建目标是文件或目录。我正在构建一个类似于 emacs 软件包的 BSD 端口的系统。
我刚刚意识到我对每个包的目标并不真正准确 - 这不是文件 edan.el 需要比其先决条件更新。它必须比先决条件更新,并且必须包含
(provide '[% pkg %])
其中 pkg
是刚刚下载、解压和字节编译的包。
有没有办法用 make 来做到这一点?还有其他构建系统可以处理此类事情吗?
The typical build targets for make and other build systems is a file or directory. I am building a system similar BSD-ports for emacs packages.
I just realized that my target for each package was not truly accurate - it's not that the file edan.el needs to be newer than its prerequisites. It must be newer than the prerequisites and it must contain
(provide '[% pkg %])
Where pkg
is the package that has just been downloaded, unpacked, and byte-compiled.
Is there a way to do this with make? Does any other build system handle this sort of thing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您总是希望目标包含正确的数据。例如,您不希望 foo.o 与 foo.c 的内容没有关系。时间戳只是这一点的代理。您必须相信这些工具确实能做正确的事情。
听起来这里真正的复杂之处在于依赖关系是动态的。文件
edan.el
取决于当前安装和管理的所有软件包的列表,该列表可能会发生变化。但当然,您可以将此数据表示为文件。实际上,我希望您已经拥有一个包含活动包列表的文件。(您可能还想依赖实际的包。您应该能够编写一个脚本来将此数据合并到主
Makefile
中包含的依赖文件中。)It's always the case that you want the target to contain the right data. You don't want
foo.o
to have no relation to the contents offoo.c
, for example. The timestamps are merely a proxy for this. You have to trust that the tools actually do the right thing.It sounds like the real complication here is that the dependencies are dynamic. The file
edan.el
depends on the list of all currently installed and managed packages, which can change. But you can, of course, represent this data as a file. I expect you already do have a file that has a list of the active packages, actually.(You possibly also want to depend on the actual packages too. You should be able to write a script to munge this data into a depend file that is include in the main
Makefile
.)