考虑修改文件进行重建
我有一个 C++ 项目,我使用 Bakefile 进行构建过程,为 msvc、mingw、gnu 等生成 Makefile 以实现跨平台支持。
现在的问题是,如果我更改任何 .h 文件(包含在其他 .cpp 文件中)并执行重建,则不会重新编译修改后的文件。但是更改任何 .cpp 文件都会重新编译。
根据项目中包含的任何文件的修改时间戳,我希望考虑重建该文件。
我是否缺少需要在 .bkl 文件中添加为标签的内容? 请帮忙。
I have a C++ project, I am using Bakefile for build process, Makefiles are generated for msvc, mingw, gnu etc for cross-platform support.
Now the problem is that if I change any .h files (which are included in other .cpp files) and performing a rebuild does not recompile modified files. But changing any .cpp file gets recompiled.
Based on modified time-stamp of any file which is included in the project I expect to consider that file for rebuild.
Am I missing something which required to be added as a tag in .bkl files?
Please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Bakefile 本身只处理目标之间的依赖关系。源文件和头文件之间的依赖关系变化过于频繁,无法在 makefile 中记录下来。这种依赖关系是由编译器和 make 处理的,他们必须合作。
GCC 和 GNU make 对此支持得很好(Bakefile 的 gnu 或 autoconf 格式生成具有适当 deps 跟踪的 makefile)。我猜您的抱怨尤其是关于 nmake (Bakefile 的 msvc 格式),对吗?
恐怕你运气不好——
nmake
太有限并且不支持动态依赖关系。我建议改为生成并使用项目文件,IDE 和 vcbuild 都会跟踪依赖项。Bakefile itself only handles dependencies between targets. Dependencies between source files and headers are too frequently changing to be written down in makefiles. This kind of dependencies is handled by the compiler and
make
, who have to cooperate.GCC and GNU make support this just fine (and Bakefile's
gnu
orautoconf
formats generate makefiles with proper deps tracking). I'm guessing that your complain is aboutnmake
(Bakefile'smsvc
format) in particular, right?You're out of luck here, I'm afraid --
nmake
is too limited and doesn't support dynamic dependencies. I recommend to generate and use project files instead, both the IDE andvcbuild
do track dependencies.