如何配置使用Autotools构建到外部目录的应用程序? [英] How to configure application which uses Autotools to build to external directory?

查看:137
本文介绍了如何配置使用Autotools构建到外部目录的应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有使用Autotools(Autoconf,Automake等)的应用程序,该工具将对象和二进制文件构建到项目目录中.这不方便,我想为他们提供单独的目录,例如构建"目录. IE.我需要阴影构建".有人可以建议如何做到这一点吗?

I've got application which uses Autotools (Autoconf, Automake etc) which builds object and binary files into project directory. It is not convenient, I'd like to have separate directory for them, e.g. "build" directory. I.e. I need "shadow build". Could anybody advise how this could be done?

推荐答案

默认情况下,Autotools支持源外构建,如

The Autotools support out-of-source building by default, as described in the Automake manual. In a nutshell, you create a directory, anywhere, into which the build results should go. You make that your working directory, and run the project's configure script from there:

mkdir ~/the_project-build
cd  ~/the_project-build
~/the_project-1.2.3/configure
make
make install

然后,所有构建的文件都应进入您创建的构建树中,而不是源树中.如果愿意,构建树的根目录可能位于项目目录中.

All built files should then go into the build tree you've created instead of into the source tree. It is possible for the root of the build tree to be inside the project directory if you prefer.

但是请注意

  1. 此功能取决于Automake和Autoconf.使用不带Automake的Autoconf的项目需要一些手动的注意才能为其进行源外构建工作,而根据我的经验,此类项目通常不会受到这种关注.

  1. This feature depends on Automake and Autoconf together. Projects that use Autoconf without Automake require some manual attention to make out-of-source building work for them, and in my experience, such projects often don't receive that attention.

基于Autotools的项目的维护者可以采取许多措施来破坏源代码的构建,因此您不能完全确定每个 Autotools项目都可以开箱即用地构建这种方式.

There is a number of things the maintainers of an Autotools-based project can do to break out-of-source building, so you cannot be fully confident that every Autotools project can be built this way straight out of the box.

另一方面,Automake自动提供一个"distcheck"目标来测试源外构建,因此,包维护者拥有一个工具,旨在帮助确保其项目确实支持源外.源构建.这样可以提高任何给定项目实际上所做的可能性.

On the other hand, Automake automatically provides a 'distcheck' target that tests out-of-source building, among other things, so package maintainers have a tool intended to help ensure that their projects do support out-of-source builds. This improves the likelihood that any given project in fact does.

这篇关于如何配置使用Autotools构建到外部目录的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆