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

标签 c autotools automake

我的子目录中有一些头文件,必须将其复制到我的包含目录中的同名子目录中。我可以使用 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 中解释了该错误的原因。 :

‘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 都没有安装。

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

关于c - 如何在 include_HEADERS 上一起使用 autotools nobase 和 nodist 前缀,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36900450/

相关文章:

C程序通过Valgrind检查: can't return all the reserved storage space

c++11 - 打包C++11程序源码的可移植方法

c - 将 Autotools 用于具有平台特定源代码的项目

c++ - 在通用 Linux 上构建 sipXtapi - 安装错误

c++ - Automake 库工具 'No rule to make target'

不能为 cgminer 自动配置(缺少 AC_CHECK_FUNCS)

c - 在 Solaris/Linux 中释放分配的内存

c - gcc C ***检测到堆栈粉碎***数组

c - CodeBlock 中的结构大小错误

c++ - MakeFile.am : Mixing c and c++, 新错误