如何在automake中一次指定多个源文件

发布于 2024-09-28 12:54:31 字数 253 浏览 1 评论 0原文

有什么办法可以避免在 automake 脚本中指定我手动创建的每个源文件吗?

我尝试了多种使用 find -name *.cc 等指定源文件的方法。我还尝试在 autoconf 中找到该列表并将其替换到 Makefile.am 中,但 automake 抗议说这是不允许的。

如果我必须手动维护列表,我可能会一直忘记将新创建的文件添加到列表中。我宁愿不必这样做。有什么办法可以自动为我选择新文件吗?

任何帮助表示赞赏。

Is there any way around having to specify every sourcefile I create manually in my automake scripts?

I've tried several ways of specifying sourcefiles using find -name *.cc or the like. I've also tried finding the list in autoconf and substituting it into the Makefile.am, but automake protested that this is not allowed.

If I have to maintain the list by hand, I'm likely to keep forgetting to add newly created files to the list. I'd rather not have to do that. Is there any way to have new files selected for me automatically?

Any help is appreciated.

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

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

发布评论

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

评论(1

夜巴黎 2024-10-05 12:54:31

试试这个:

Makefile.am:

include srcs.am
new-src:
    # Some shell command to update srcs.am

foo_SOURCES 的定义放入 srcs.am 中。然后要更新源列表,请执行 make new-src;制作

不过,这似乎是一个非常糟糕的主意。一旦你的项目建立起来,你就很少会改变文件列表,而且你仍然会有神奇的包袱。

Try this:

Makefile.am:

include srcs.am
new-src:
    # Some shell command to update srcs.am

Put the definition of foo_SOURCES in srcs.am. Then to update the source list, do make new-src; make.

This seems like a really bad idea, though. Once your project is established, you'll rarely change the file list anyway and you'll still have magic baggage hanging around.

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