GNU 自动工具 : How do you include source files in the 'make dist' tarball that are above the root source directory?

标签 gnu autotools autoconf automake

我有一个 Subversion 项目,它使用 Gnu Autotools(即 automake、autoconf 和 libtool)来管理子文件夹(称为“子包”)中的源代码。子包引用子包根源目录之上的源文件,并且对其他子包是通用的。不幸的是,当运行 'make dist' 来创建发行版 tarball 时,公共(public)源文件不会包含在发行版中。

有没有办法在分发源代码之前使用 autoconf/automake 将这些公共(public)源文件移动到子包的子目录中,并让 makefile 自行调整以正确指向重新定位的源文件?显然,可以在编译之前让 makefile 移动这些源文件,但是对于在 Subversion 存储库中工作,这会导致问题,因为这些移动的文件是受修订控制的,并且很容易意外编辑移动的文件而不是原始文件.

最佳答案

您可以在子包中有一个空目录,称为“common”,其中包含一个将外部文件复制到其中的 makefile。然后您可以使用 dist-hook 目标将文件直接移动到“common”目录的版本中这将被压缩到压缩包中。这样,您就不必担心它们四处散布并被编辑。您还将在复制时覆盖“common”中的 Makefile.am、Makefile.in 和 Makefile。

subpackage/common/Makefile.am 中的示例(未经测试):

dist-hook:
    cp -p $(top_srcdir)/../common/Makefile* $(top_srcdir)/../common/*.[ch] $(distdir)

我不是 100% 确定这会起作用。它可能会破坏你的包的其余部分,这取决于其他所有东西都希望在哪里找到这些源文件;如果您解压缩 tarball 并尝试从那里制作 dist,它可能会破坏制作 dist。你应该知道这种诡计是不受欢迎的。但我希望我已经给了你足够的想法来玩弄。

关于GNU 自动工具 : How do you include source files in the 'make dist' tarball that are above the root source directory?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1836209/

相关文章:

linux - 在末尾添加摘要的问题/失败数量的计数器

linux - GNU 与 Linux 有何关系?

c - luajit 附近的 PKG_CHECK_MODULES 语法错误

doxygen - 使用 autotools 生成(并安装)doxygen 文档

autotools - 使用 automake 指定要构建的 Makefile

autotools - 通过autotools查询pkg-config变量

c++ - 使用 cmake 设置 gsl 时出现问题

c++ - 过度使用Pragma Pack(1)

linux - 错误 : configure: error: ln doesn't support --relative when building Systemd

linux - 如何强制配置脚本生成发布makefile