应用前Autoconf编译依赖
在过去的几天里,我一直在使用自动工具,终于取得了重大进展。 我遇到的一个问题是我有两个库需要在主应用程序代码之前编译。 我不太确定该怎么做。 我的目录结构如下,还有来自我的configure.ac 的片段。
AC_CONFIG_FILES([Makefile
src/Makefile
gtkworkbook/Makefile
csv/Makefile])
AC_OUTPUT
我需要在src/Makefile之前编译csv/Makefile和gtkworkbook/Makefile; 有什么办法可以指定这个吗? 现在,我在应用程序编译过程中收到有关库 (csv) 不存在的错误。
I have been tooling around with autotools for the past couple of days, and finally have made significant progress. One problem I am having is that I have two libraries that need to be compiled before the main application code. I'm not quite sure how to do this. My directory structure is below and a snippet from my configure.ac as well.
AC_CONFIG_FILES([Makefile
src/Makefile
gtkworkbook/Makefile
csv/Makefile])
AC_OUTPUT
I need the csv/Makefile and gtkworkbook/Makefile to both be compiled before src/Makefile; is there any way to specify this? Right now I am getting an error about the library (csv) not existing during the application compile process.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
AC_CONFIG_FILES() 中的项目顺序不会影响构建顺序。 如果您使用 automake(我假设您使用的是 automake),它将按照您在每个 Makefile.am 的 SUBDIRS 列表中列出目录的顺序遍历您的目录树。
话虽这么说,为了一致性/可维护性,您应该让 AC_CONFIG_FILES() 中的项目顺序反映构建顺序。
如何按照所需顺序构建顶级 Makefile.am 的 SUBDIRS 的示例:
另外,对于这个简单的情况,您不需要同时使用 AC_CONFIG_FILES() 和 AC_OUTPUT()。 您可以将列表目录传递给 AC_OUTPUT():
The order of items in AC_CONFIG_FILES() does not affect the build order. If you're using automake, which I assume you are, it will traverse your directory tree in the order that you list directories in each Makefile.am's SUBDIRS list.
That being said, you should have the order of items in AC_CONFIG_FILES() mirror the build order, for consistency/maintainability.
Example of how your toplevel Makefile.am's SUBDIRS to build in the desired order:
Also, for this simple case you don't need both AC_CONFIG_FILES() and AC_OUTPUT(). You can pass your list directory to AC_OUTPUT():