这个问题扩展了问题How to handle subprojects with autotools?
所以我在 modules/libfoo 中有一些带有自己的 Makefile(不是 GNU autotools)的项目
我添加了 SUBDIRS = include/jsonbox Makefile.am 并且它编译得很好,但前提是我从顶级目录调用 ./configure 和 make 。
如果我创建一个子目录,比如 build,然后从中运行 ../configure,我在 make 过程中会遇到错误:
Making all in modules/libfoo
/bin/sh: line 17: cd: modules/libfoo: No such file or directory
make: *** [all-recursive] Error 1
有可能处理这个吗?我需要几个用于不同拱门和 CFLAGS 的构建目录。
编辑: 正如它在文档中所建议的那样,我在嵌套项目中创建了一个 GNUmakefile.in。但它仍然不适用于 VPATH:
Making all in modules/libfoo
make[1]: Entering directory `/home/galadog/test/build/moudles/libfoo'
GNUmakefile:2: Makefile: No such file or directory
make[1]: *** No rule to make target `Makefile'. Stop.
make[1]: Leaving directory `/home/galadog/test/build/moudles/libfoo'
make: *** [all-recursive] Error 1
Edit2 实际的 Makefile 可以在这里看到: https ://github.com/anhero/JsonBox/blob/master/Makefile