如何影响 Makefile.am 的目标顺序、添加附加步骤等?
我可以像我习惯管理Makefile一样管理Makefile.am吗?
通常我创建相互调用的目标以便构建项目。
但在 Makefile.am 中,我有一些神秘的 libqqq_la_SOURCES = ...
,我不知道它到底在做什么。
在哪里编写对于给定的源代码应该使用什么编译器?在哪里添加“qqq.c is generated from qqq.vala”这一步?
如何将 Makefile.am 写为 Makefile?
Can I manage Makefile.am as I got used to manage Makefile?
Usually I create targets which calls each other in order to make the project built.
But in Makefile.am I have some mysterious libqqq_la_SOURCES = ...
which I don't know what is it doing exactly.
Where to write what compiler should it use for the given source? Where to add a step that "qqq.c is generated from qqq.vala"?
How to write Makefile.am as just Makefile?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
1.11 中的 Automake 确实有 Vala 支持。
配置.ac:
Makefile.am:
Automake in 1.11 does have Vala support.
configure.ac:
Makefile.am:
Automake 会自动将您在 Makefile.am 中指定的任何 Make 目标复制到生成的 Makefile 中。因此,您只需将其包含在 .am 文件中即可生成任何自定义的复杂内容。
然而,您不应该对所有都这样做——这会破坏 Automake 试图为您提供的好处。 无论如何指定
都会生成一个标准的 Make 目标。我建议您学习使用 Automake 宏来处理大多数标准的事情——这样会更便携。
学习丰富多样的 Autotools 功能的最佳方法不是阅读手册 - 它太复杂且无组织性。我的建议只是采用一个与您的构建风格(依赖项、平台等)相似的现有开源 GNU 项目,并检查其 Autoconf 和 Automake 文件。已经建立的项目已经学到了很多技巧,你可以借鉴。
Automake will automatically copy over any Make targets you specify in Makefile.am into the generated Makefile. So you can generate any custom, complicated things just by including it in the .am file.
However, you shouldn't do this for everything -- that defeats the benefit that Automake is trying to provide you. Specifying
will generate a standard Make target anyway. I recommend you learn to use Automake macros for most standard things -- it will be more portable that way.
The best way to learn the rich variety of Autotools features is not to read the manual -- it's way too complicated and unorganizable. My suggestion is simply to take an existing open-source GNU project that is similar in build style (dependencies, platforms, etc) to yours, and examine its Autoconf and Automake files. The established projects have learned quite a few tricks that you can learn from.