如何提取基于GNU Build System的部分项目?
当我将某些子目录从“./configure”管理的项目和所有这些东西移开时,它会尝试访问一些“../../configure.ac”和其他东西,并且不容易构建。
如何提取此类项目的一部分并使其独立?
When I move some subdirectory away from project managed by "./configure" and all that things, it tries to get to some "../../configure.ac" and other things and is not easily buildable.
How to extract part of such project and make it independent?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有两种方法可以解决这个问题,创建一个单独的自动工具构建过程,或者取消自动工具和手动代码,或者创建一个新的
Makefile
。看一下上面的插图,一个名为
myprojectfoo
的虚构项目正在使用自动工具构建一个名为foo
的二进制文件。顶级目录即myprojectfoo
将包含configure.ac、Makefile.am和Makefile.in,位于子目录中至少会有 Makefile.am 和 Makefile.in。自动工具将创建并执行 make 命令来构建项目。现在,根据我对您想要执行的操作的理解:
您想要取出
src
子目录,它也是include's
。那么在这种情况下,创建一个单独的 Makefile(读取 - 无自动工具)构建会更容易。在这种情况下,会更容易。我能想到的最好的方法是,一旦你走了,你最终必须做出决定,你想要提取的项目源的子集有多大在此之前,删除对 Makefile.am、Makefile.in...的所有引用,并借用现有的简单 Makefile 模板来构建它并像这样调用它
或者
如果您想使用自动工具使用该子集构建一个单独的项目:
Makefile.am
,如下所示。configure.ac
,如下所示...configure.ac
configure.ac
进行任何后续更改,然后运行 autoreconf,这将执行 automake、autoconf 和其他支持自动工具程序。获取 Linux 的
Makefile.am
样本...获取 Linux 的
configure.ac
样本...自动工具的命令位于顶部我的头脑,我可能错过了一些东西......请随时通过在这篇文章的底部对此发表评论来指出,它将进行相应的修改。
There is two ways to deal with this, create a separate auto-tools build process or do away with the auto-tools and hand code or make a new
Makefile
.Have a look at the illustration above, for a fictitious project called
myprojectfoo
and is using auto-tools to build a binary calledfoo
. The top-level directory i.e.myprojectfoo
will have configure.ac, Makefile.am and Makefile.in, in the subdirectories there would be at least Makefile.am and Makefile.in. The auto-tools will create and execute the make commands to build the project.Now, from what I'm understanding in what you are trying to do:
You want to take out the
src
subdirectory and it'sinclude's
also. Then in that case, it would be easier to create a separate Makefile (read - no auto-tools) build.. in that case, it would be easier.The best way I can think of it is, you will have to make that decision ultimately, how big is the subset of the project's sources you want to extract, once you go ahead with that, remove all references to Makefile.am, Makefile.in... and borrow an existing simple Makefile template to build it and invoke it like this
OR
If you want to build a separate project using that subset using auto-tools:
Makefile.am
as shown below.configure.ac
as shown below...configure.ac
configure.ac
, run autoreconf after that, which will execute automake, autoconf, and other supporting auto-tools programs.Taking a sample of the
Makefile.am
for Linux...Taking a sample of the
configure.ac
for Linux...The commands for the auto-tools, is top of my head and I may have missed something..feel free to point out by placing a comment on this at the bottom of this post and it will be amended accordingly.