如何使用 GNU Autotools 更改 *.o 文件和产品目录?

How to change *.o file and product directory by using GNU Autotools?

我用 GNU Autotools 创建了一个非常简单的 hello world C/C++ 项目。 Here is a full tutorial 展示了如何在 GNU Autotools 中构建最简单的项目。我想更改项目以将所有 *.o 存储在 build/ 目录中,将可执行文件存储在 output/ 中。

是否可以在 Autotools 中更改 C/C++ 编译器的输出文件夹?

autotools 不是这样设计的。 autotools 的设计方式是将源文件保留在原处并切换到另一个目录,运行 在那里构建,它将在本地写入目标文件。

所以,而不是 运行ning:

cd myproj
./configure
make

并在与源相同的目录中获取目标文件,您可以执行以下操作:

mkdir obj
cd obj
../myproj/configure
make

然后目标文件位于 obj 目录中,而不是源目录中。