How to configure application which uses Autotools to build to external directory?

对着背影说爱祢 提交于 2019-12-11 15:05:49

问题


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?


回答1:


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.

Do be aware, however, that

  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.

  2. 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.

  3. 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.



来源:https://stackoverflow.com/questions/51022952/how-to-configure-application-which-uses-autotools-to-build-to-external-directory

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!