如何在 makefile 中建立依赖关系,以便在市场修订版本更改时构建目标?
我有一个脚本,旨在在源代码树中生成 config.h,供代码在编译时使用。其中包含的信息包括集市修订号。
我的项目仅基于 Makefile。我想添加 config.h 作为当制作 config.h 的脚本更改或集市修订版更改时要构建的目标。
.bzr 目录中是否有一个文件会在修订版本更改时发生更改,或者我可以使用其他文件来获取此类依赖项?
I have a script that is designed to generate a config.h in the source tree, to be used by the code at compile-time. Information included in this includes the bazaar revision number.
My project is based only on a Makefile. I would like to add config.h as a target to be built when the script to make config.h is changed or the bazaar revision changes.
Is there a file in the .bzr directory that would change when the revision changes or something else I could use to get this type of dependency?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如史蒂文所说,你可能会使用最新版本的文件。
但作为另一种方法,您可以考虑使用 post_change_branch_tip 挂钩,并在每次更改分支提示时自动调用 config.h 的构建脚本。
http: //doc.bazaar-vcs.org/bzr.2.0.0/en/user-reference/index.html#post-change-branch-tip
As Steven said you might use last-revision file.
But as another approach you can consider to use post_change_branch_tip hook, and call build script for config.h automatically every time branch tip is changed.
http://doc.bazaar-vcs.org/bzr.2.0.0/en/user-reference/index.html#post-change-branch-tip
看起来 .bzr/branch/last-revision 有你想要的...
编辑:为了正确处理构建过去修订的情况,老实说,每次构建时重建配置文件可能会更容易,特别是如果不需要太长时间...
It looks like .bzr/branch/last-revision has what you want...
EDIT: To properly handle the case of building past revisions, it honestly might just be easier to rebuild the config file every time you do a build, especially if it doesn't take too long...