Makefile.def vs Makefile.am

时间:2017-09-05 12:33:55

标签: c makefile binutils

我正在使用linux binutils-2.29。 在父目录中没有Makefile.am,但在所有子目录中都有Makefile.am

在父目录中,这些是存在的Makefile:

Makefile  Makefile.def  Makefile.in  Makefile.tpl

Makefile.tpl旁边,有一条评论说MakefileMakefile.tpl autogen Makefile.def生成的Makefile.def

但在子目录内没有autoreconf && automake,当我运行Makefile时,它会从Makefile.am生成Makefile.def

Makefile.amString.prototype.match之间究竟有什么区别?

1 个答案:

答案 0 :(得分:1)

  

Makefile.def与Makefile.am有什么区别?

让我们看一下使用binutils的GCC大型项目。引用Regenerating GCC Configuration

  

Makefile.in文件有时很大,可以由automake从Makefile.am文件生成。一些Makefile.in文件(用于在构建树中生成Makefile)由来自Makefile.tpl和Makefile.def文件的autogen生成。 Autogen是一个(GUILE脚本化)工具,旨在简化包含大量重复文本的程序的创建和维护。

因此,区别在于您希望如何以及在何处存储autogen将要处理的部分输入文件。对于GCC,它Makefile.tpl存储模板(用于生成输出Makefile,而Makefile.def存储定义,将由autogen使用

例如,在Makefile.tpl内,您会找到此模板来填充HOST_LIB_PATH变量(请注意它使用host_modules变量):

# This is the list of directories that may be needed in RPATH_ENVVAR
# so that programs built for the host machine work.
HOST_LIB_PATH = [+ FOR host_modules +][+
  IF lib_path +]$(HOST_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
  ENDFOR host_modules +]

Makefile.def内,host_modules有一个定义:

host_modules= { module= bfd; bootstrap=true; };
host_modules= { module= opcodes; bootstrap=true; };
// ...