gpt4 book ai didi

c - Makefile.def 与 Makefile.am

转载 作者:行者123 更新时间:2023-11-30 14:55:15 24 4
gpt4 key购买 nike

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

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

Makefile  Makefile.def  Makefile.in  Makefile.tpl

Makefile.tpl旁边有一条注释说Makefile是由autogen Makefile.def从Makefile.tpl生成的

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

Makefile.defMakefile.am 之间到底有什么区别?

最佳答案

What exactly is the difference between Makefile.def and Makefile.am?

让我们看看 GCC,它也是使用 binutils 的大型项目。引用Regenerating GCC Configuration :

The Makefile.in file is sometimes big, and can be generated by automake from a Makefile.am file. Some Makefile.in files (used to generate Makefile in the build tree) are generated by autogen from Makefile.tpl and Makefile.def files. Autogen is a (GUILE scriptable) tool designed to simplify the creation and maintenance of programs that contain large amounts of repetitious text.

因此,区别实际上在于如何以及在何处存储 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; };
// ...

关于c - Makefile.def 与 Makefile.am,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46055110/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com