如何在 include_HEADERS 上一起使用 autotools nobase 和 nodist 前缀

How to use autotools nobase and nodist prefixs together on include_HEADERS

我的子目录中有一些 header 文件,必须将其复制到我的 include 目录中的 same-named 子目录中。我可以使用 nobase 前缀来实现(我正在使用 heimdal 代码,仅供参考):

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

但是其中一些 header 文件是在构建过程中生成的(因为 heimdal 必须在那些 header 文件存在之前构建),所以我需要使用 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...

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

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

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

automake documentation:

中解释了该错误的原因

‘nobase_’ should be specified first when used in conjunction with either ‘dist_’ or ‘nodist_’

我还定义了 nodist_include_HEADERS(有效)。也许这两个定义引起了某种冲突?

我刚刚尝试删除 nodist_include_HEADERS 并将我所有的 header 放在 nobase_nodist_include_HEADERS 行下,但现在我的 header 中的 NONE安装。

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

如果头文件是由程序生成的,您应该用 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