【问题标题】:How to use autotools nobase and nodist prefixs together on include_HEADERS如何在 include_HEADERS 上同时使用 autotools nobase 和 nodist 前缀
【发布时间】:2016-04-27 20:40:56
【问题描述】:

我在子目录中有一些头文件,必须将它们复制到我的包含目录中的同名子目录中。我可以使用 nobase 前缀来实现这一点(我正在使用 heimdal 代码,仅供参考):

nobase_include_HEADERS = hcrypto/aes.h \
      hcrypto/bn.h      \
      hcrypto/cmac.h    \
      hcrypto/des.h     \
      hcrypto/dh.h      \
      hcrypto/dsa.h     \
etc...

但是其中一些头文件是在构建过程中生成的(因为必须在这些头文件存在之前构建 heimdal),所以我需要使用 nodist 前缀,这样 dist 就不会死。

I found an article 说我可以同时使用它们,甚至提供了一个类似的例子,所以我这样做了:

nobase_nodist_include_HEADERS = hcrypto/aes.h \
      hcrypto/bn.h      \
      hcrypto/cmac.h    \
      hcrypto/des.h     \
      hcrypto/dh.h      \
      hcrypto/dsa.h     \
etc...

我没有注意到任何警告或错误,但这些头文件不会被复制到我的包含目录中。 是我做错了什么,还是 autotools 中存在错误?

有趣的是,如果我颠倒前缀,我会得到这个错误:

Makefile.am:93: error: 'nodist_nobase_include_HEADERS' is used but 'nobase_includedir' is undefined

automake documentation 中解释了该错误的原因:

在与“dist_”或“nodist_”结合使用时,应首先指定“nobase_”

我还定义了 nodist_include_HEADERS (正在工作)。也许这两个定义引起了某种冲突?

我刚刚尝试删除 nodist_include_HEADERS 并将所有标题放在 nobase_nodist_include_HEADERS 行下,但现在我的标题都没有安装。

Automake 和系统信息: automake (GNU automake) 1.13.4 openSUSE 13.2 (x86_64)

【问题讨论】:

  • 请在问题本身中添加任何其他信息,而不是滥用某些 cmets。
  • 请做一个最小的完整工作示例stackoverflow.com/help/mcve(在您的情况下是一小部分 Makefile.am)

标签: c autotools automake


【解决方案1】:

如果标头是由程序生成的,则应将它们标记为BUILT_SOURCES,这样automake 就不会被混淆为尝试将它们安装为dist

其次,对于不打算安装的头文件,最好使用SOURCES 指令,而不是HEADERS。试试这个:

nobase_include_SOURCES += hcrypto/aes.h \
    hcrypto/bn.h      \
    hcrypto/cmac.h    \
    hcrypto/des.h     \
    hcrypto/dh.h      \
    hcrypto/dsa.h
BUILT_SOURCES = hcrypto/aes.h \
    hcrypto/bn.h      \
    hcrypto/cmac.h    \
    hcrypto/des.h     \
    hcrypto/dh.h      \
    hcrypto/dsa.h

【讨论】:

    猜你喜欢
    • 2018-12-23
    • 1970-01-01
    • 2021-10-02
    • 2018-07-24
    • 2020-02-04
    • 1970-01-01
    • 2015-07-28
    • 1970-01-01
    • 2015-03-21
    相关资源
    最近更新 更多