什么是 ltmain.sh,为什么 automake 说它丢失了?什么是好的自动(make/conf/etc)生成器?

发布于 2024-09-01 06:04:25 字数 195 浏览 4 评论 0原文

我只想在 Linux 中开发一个 C 应用程序,并自动生成 auto(make/conf/...) 内容。我尝试用 ede 和 anjuta 生成它,但它似乎没有生成 Makefile.am。因此,我尝试运行 automake,但它说找不到“ltmain.sh”。是否有一些易于生成 Linux C/C++ 应用程序的基本构建文件。标准做法是什么?大多数人自己编写这些文件吗?

I just want to develop a C app in linux with the auto(make/conf/...) stuff automatically generated. I tried generating it with ede and anjuta, but it doesn't seem to generate Makefile.am. So, I tried running automake, and it says "ltmain.sh" isn't found. Is there some easy to generate the basic build files for linux C/C++ apps. What is the standard practice? Do most people write these files themselves?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

无尽的现实 2024-09-08 06:04:26

我会考虑根本不使用 autoconf 和 automake —— 它们的复杂性超过了它们的好处,特别是如果您只针对 Linux。

请注意,例如“git”根本不使用它们;相反,它只是有一个中等复杂(但易于理解)的 Makefile。

I'd consider not using autoconf and automake at all -- their complexity outweighs their benefit, particularly if you're targeting only Linux.

Note that "git", for example, doesn't use them at all; instead it simply has a moderately-complex (but comprehensible) Makefile.

世态炎凉 2024-09-08 06:04:25

生成一组非常简单的自动工具文件非常容易。这是一个(非常基本的)示例。运行这些后,您应该在目录中获得 ltmain.sh 的副本,并且您将准备好运行配置脚本:

$ mkdir sample
$ cd sample
$ echo 'int main( void ) { return 0; }' > foo.c
$ echo 'bin_PROGRAMS = foo' > Makefile.am
$ autoscan
$ mv configure.scan configure.ac
$ # edit configure.ac, add AM_INIT_AUTOMAKE([foreign])
$ # and LT_INIT, set project name and bug-report-address
$ autoreconf -ivf

请注意,在本示例中,libtool 实际上不是必需的,因为
该示例只是构建一个简单的应用程序。但你问的是
ltmain.sh,这是一个 libtool 的东西,所以需要 LT_INIT
解决问题的这一部分。如果你想建造
库,将 bin_PROGRAMS 更改为 lib_LTLIBRARIES。

Generating a really trivial set of autotool files is pretty easy. Here's a (really basic) example. After you run these, you should get a copy of ltmain.sh in the directory, and you'll be all set to run the configure script:

$ mkdir sample
$ cd sample
$ echo 'int main( void ) { return 0; }' > foo.c
$ echo 'bin_PROGRAMS = foo' > Makefile.am
$ autoscan
$ mv configure.scan configure.ac
$ # edit configure.ac, add AM_INIT_AUTOMAKE([foreign])
$ # and LT_INIT, set project name and bug-report-address
$ autoreconf -ivf

Note that in this example, libtool really isn't necessary since
the example is just building a simple app. But you asked about
ltmain.sh, and that's a libtool thing so LT_INIT is needed to
address that portion of the question. If you want to build
a library, change bin_PROGRAMS to lib_LTLIBRARIES.

二智少女 2024-09-08 06:04:25

EDE 可以通过两种不同的方式处理 Automake 文件。如果您编写自己的 automake 文件,它会读取它们,并通过 UI 调整它们。

如果您愿意,您可以让 EDE 为您完成所有工作。首先,创建您的第一个 C 文件,然后当它位于磁盘上时,执行:

Mx ede-new RET Automake RET

然后从项目/项目选项菜单中添加一个目标,例如“程序”。

如果您填写 C 文件,则可以从菜单中选择 Project->Build->build currentproject,除了运行所有其他 automake 命令之外,它将创建并设置 Automake 执行其操作所需的所有内容需要。

最后,有一个“运行”选项可以运行您的程序。

EDE can work with your Automake files in two different ways. If you write your own automake files, it will read them, and tweak them via the UI.

If you prefer, you can have EDE do the whole thing for you. First, create your first C file, then when it is on disk, do:

M-x ede-new RET Automake RET

then from the project/project options menu, add a target, like "program".

If you fill in your C file, you can then choose Project->Build->build currentproject from the menu, and it will create and setup everything needed for Automake to do it's thing, in addition to running all the misc automake commands needed.

Lastly, there is a 'run' option somewhere to run your program.

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