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

时间:2016-04-27 20:40:56

标签: c autotools automake

我在子目录中有一些头文件,必须将其复制到include目录中同名的子目录。我可以使用nobase前缀来实现这一点(我正在使用heimdal代码,fyi):

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...

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

有趣的是,如果我反转前缀,我会收到此错误:

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

此错误的原因在automake documentation

中说明
  当与'dist_'或'nodist _'一起使用时,应首先指定'pobase_'

我还定义了nodist_include_HEADERS(正在运行)。也许这两个定义会导致某种冲突?

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

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

1 个答案:

答案 0 :(得分:3)

如果标题是由程序生成的,则应使用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