从递归构建系统转移到非递归构建系统

时间:2017-09-14 09:58:57

标签: makefile build autotools autoconf automake

我正在尝试将我们的构建系统更新为非递归。系统的当前布局(我们在其中构建GNU Octave和Matlab mex文件)是:

---project/
|  ---mex/
|  |  +--src/ (contains common source files)
|  |  +--matlab-mex/ (contains compiled Matlab mex files)
|  |  +--octave-mex/ (contains compiled Octave mex files)
|  |  ---build/
|  |  |  mex1.am
|  |  |  ...
|  |  |  mexN.am
|  |  |  ---matlab/
|  |  |  |    Makefile.am
|  |  |  |    configure.ac
|  |  |  |    commonmex.am
|  |  |  |    ---mex1/
|  |  |  |    |    Makefile.am
|  |  |  |    ...
|  |  |  |    ---mexN/
|  |  |  |    |    Makefile.am
|  |  |  +--octave/ (... same layout as project/mex/build/matlab/)

目前,commonmex.am包含行EXEEXT=$(MEXEXT),允许mex个文件使用相应的扩展程序进行编译(.mex.mexmaci.mexmaci64等等)取决于configure找到的Matlab版本和OS系统/体系结构。作为一个递归系统,这很有效。

问题

在迁移到非递归构建系统(已阅读autotools-mythbusterKarel Zak's blog)时,我SUBDIRS include而不是使用commonmex.am mex*.am中的project/mex/build/matlab/Makefile.am。我在进行此更改时遇到的问题是我无法像上面那样覆盖EXEEXT。当我运行autoreconf -si时,我收到以下警告:

./commonmex.am:1: warning: EXEEXT was already defined in condition TRUE, which includes condition DO_SOMETHING ...
Makefile.am:10:   'mex1/mex1.am' included from here
mex1/mex1.am:1:   './commonmex.am' included from here
configure.ac:59: ... 'EXEEXT' previously defined here

NB: if DO_SOMETHINGMakefile.am中的一个条件,它包装整个Makefile,如果人员构建中有一个GNU Octave或Matlab而不是其他

当我运行make时,mex文件已构建但没有任何扩展(我正在构建在macOS上,但结果在我想象的GNU / Linux上是相同的)。当我们编译这些mex文件以便在GNU / Linux,macOS和Windows上进行分发时,扩展对我们来说非常重要。

如何在使用EXEEXT变量覆盖configure.ac中的MEXEXT集时移动到非递归构建系统,同时也在configure.ac中设置?

1 个答案:

答案 0 :(得分:0)

最后,很容易。只需覆盖EXEEXTconfigure.ac的定义:

EXEEXT=$MEXEXT