使用 sqlite 管理 Makefile 构建标志
我从源树中构建了超过两打的目标,通常具有三个活动分支,同时包含生产和调试构建。 到目前为止,我已经使用了一个定义目标的个人 Makefile,其中包含一个定义编译标志的通用 Makefile,然后包含来自特定源树的 Makefile。 这可行,但我忍不住想还有更好的方法。
我想使用 sqlite3 数据库来存储和组织构建标志的完整列表。 在编译时,将查询数据库以根据项目版本、平台和开发/生产生成标志并开始构建。
该数据库将是我可以记录和跟踪所有开发版本的当前设置的一个地方。 一组基本的存储标志将被版本、目标平台上更细粒度的标志覆盖,然后构建质量级别。
作为实现此类内容的一部分,我还将创建一些 shell 脚本来操作数据库和获取/设置标志,并允许我实验室中的其他开发人员更轻松地采用它。
这已经完成了吗? 有类似的例子吗?
有没有不同/更好的方法来处理这个问题?
两件事情: * 我无法修改原始项目Makefiles。 * 尝试使用像 automake 这样的东西会很麻烦,因为所需的数量 配置标志以在代码库的现有模块中启用调试级别的数量将达到数百个。
I build for more than two dozen targets from a source tree with usually three active branches with both production and debug builds. To date I've used a personal Makefile that defines the target which includes a common Makefile that defines the compile flags which then includes the Makefile from a specific source tree. This works but I can't help but thinking there's a better way.
I'd like to use a sqlite3 database to store and organize a full list of build flags. At compile time the database would be queried to generate to generate flags based on project version, platform and dev/production and start the build.
This database would be a single place where I can document and keep track my current settings for all my development builds. A base set of stored flags would be overridden by more granular flags at version, target platform, then build quality levels.
As part of implementing something like this I would also create a handful of shell scripts to manipulate the database and get/set flags as well as permit other developers in my lab adopt this more easily.
Has this already been done? Are there any examples of something like this?
Is there a different/better way to handle this?
Two things:
* I cannot modify the original project Makefiles.
* Attempting to use something like automake would be cumbersome as the necessary number of
configure flags to enable a debugging level in an existing module of the code base would number in the hundreds.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我怀疑您可能想看看更复杂的构建系统。 看看ant,jam 和其他构建系统工具。 我认为执行您所描述的操作的标准 GNU 方式是通过 ./configure (autoconf)脚本,尽管我可以看到管理不同的配置会很困难。
虽然编写自己的 Makefile 配置系统是可能的,但我怀疑如果您希望您的代码得到更广泛的采用,那么使用更标准的构建系统是正确的答案。
I suspect you may like to take a look at a more sophisticated build system. Take a look at ant, jam, and other build system tools. I think the standard GNU way of doing what you describe is through ./configure (autoconf) scripts, although I can see that managing the different configurations would be difficult.
Although writing your own Makefile configuration system is possible, I would suspect that if you want your code to have wider adoption, that using a more standard build system is the right answer.
恕我直言,为此使用数据库是多余的。 使用 makefile include 是处理此问题的一种干净而简单的方法。 您对这种方法有什么顾虑/问题/问题? 也许有一种方法可以重组您的 makefile 以实现您的目标,而无需添加数据库,也无需切换到完全不同的构建系统。
IMHO, using a database for this is overkill. Using makefile includes is a clean and simple way to handle this. What are your concerns/issues/problems regarding this approach? Perhaps there's a way to restructure your makefiles to achieve your goals, without adding a database and without switching to a completely different build system.