如何影响 Makefile.am 的目标顺序、添加附加步骤等?

发布于 2024-10-08 04:28:56 字数 265 浏览 7 评论 0原文

我可以像我习惯管理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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情独悲 2024-10-15 04:28:56

1.11 中的 Automake 确实有 Vala 支持。

配置.ac:

AM_PROG_VALAC

Makefile.am:

AM_VALAFLAGS = whateverelse
whatever_SOURCES = xxx.vala

Automake in 1.11 does have Vala support.

configure.ac:

AM_PROG_VALAC

Makefile.am:

AM_VALAFLAGS = whateverelse
whatever_SOURCES = xxx.vala
血之狂魔 2024-10-15 04:28:56

Automake 会自动将您在 Makefile.am 中指定的任何 Make 目标复制到生成的 Makefile 中。因此,您只需将其包含在 .am 文件中即可生成任何自定义的复杂内容。

然而,您不应该对所有都这样做——这会破坏 Automake 试图为您提供的好处。 无论如何指定

bin_PROGRAMS=foo
AM_CFLAGS=$(DEPS_CFLAGS)
foo_SOURCES=file1.cpp file2.cpp
foo_LDADD=$(DEPS_LIBS)

都会生成一个标准的 Make 目标。我建议您学习使用 Automake 宏来处理大多数标准的事情——这样会更便携。

学习丰富多样的 Autotools 功能的最佳方法不是阅读手册 - 它太复杂且无组织性。我的建议只是采用一个与您的构建风格(依赖项、平台等)相似的现有开源 GNU 项目,并检查其 Autoconf 和 A​​utomake 文件。已经建立的项目已经学到了很多技巧,你可以借鉴。

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

bin_PROGRAMS=foo
AM_CFLAGS=$(DEPS_CFLAGS)
foo_SOURCES=file1.cpp file2.cpp
foo_LDADD=$(DEPS_LIBS)

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文