找出 makefile 的预期目标系统

发布于 2025-01-03 15:14:23 字数 363 浏览 1 评论 0原文

我试图了解 make 文件所采取的确切操作(第一次使用 make 进行构建)。

我想知道 make 文件是供 BSD make、GNU make 还是 Windows nmake 使用的。 1)如果不阅读这三者的文档并了解它们的差异,我该如何做到这一点?

2) 在阅读了几篇文章后,我得出的结论是,make 是一个实用程序,其主要目的是将源代码构建为可执行文件或 DLL 或某种形式的输出,这是 IDE 通常允许我们做的事情。 Makefile 是向 make 实用程序发出指令的方式。这是对的吗?

3) make 和构建代码的平台之间有什么关系?

4) 在依赖行(目标:组件)下发出的命令是 shell 命令吗?

提前致谢。

I am trying to understand the exact actions being taken by a make file (first time working with builds using make).

I want to know whether the make file is intended to be used by BSD make, GNU make or Windows nmake. 1) How can I do this without reading documentation of all three and understanding their differences?

2) After reading several articles, I have come to the conclusion that make is a utility for the primary purpose of building source code into an executable or a DLL or some form of output, something that IDEs usually allow us to do. Makefile is the means of giving instructions to the make utility. Is this right?

3) What is the relation between make and the platform for which the code will be built?

4) The commands that are issued under a dependency line (target:components) are shell commands?

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

迷乱花海 2025-01-10 15:14:23
  1. 如果不阅读这三个文档并了解它们的差异,我该如何做到这一点?

    那么,您很可能会使用 GNU Make。我相信,区分不同版本的Make编写的Makefile是比较简单的。

    AFAIK、GNU Make 和 BSD Make 有很多差异,至少在它们的语言语法上是这样。例如,在 GNU Make 中,典型的条件指令如下所示:

    ifdef 变量
    # ...
    恩迪夫
    

    在 BSD Make 中它是这样的(尽管我不确定):

    <前><代码>.if
    # ...
    .endif

    另请参阅:

  2. Makefile 是向 make 实用程序发出指令的方式。这是正确的吗?

    是的,绝对正确。

  3. ma​​ke 与构建代码的平台之间有什么关系?

    Make 只是一个实用程序,用于跟踪要构建的工件之间的依赖关系,并以正确的顺序运行命令来满足这些依赖关系。应该使用哪些确切的命令来完成任务取决于用户。因此,您也可以使用 Make 进行交叉编译。

  4. 在依赖行(目标:组件)下发出的命令是 shell 命令?

    是的,通常 Make 会生成一个执行指定配方的子 shell。

  1. How can I do this without reading documentation of all three and understanding their differences?

    Well, most likely, that you will use GNU Make. I believe, it is relatively simple to distinguish Makefiles written for different versions of Make.

    AFAIK, GNU Make and BSD Make have many differences, at least in their language syntax. For example, in GNU Make a typical conditional directive looks like:

    ifdef VARIABLE
    # ...
    endif
    

    And in BSD Make it is something like this (though I'm not sure):

    .if
    # ...
    .endif
    

    See also:

  2. Makefile is the means of giving instructions to the make utility. Is this right?

    Yep, absolutely right.

  3. What is the relation between make and the platform for which the code will be built?

    Make is just an utility for tracking dependencies between artifacts to be built and running commands in the proper order to satisfy these dependencies. Which exact commands should be used to accomplish the task is up to the user. Thus you can use Make for cross compilation as well.

  4. The commands that are issued under a dependency line (target : components) are shell commands?

    Yes, typically Make spawns a sub-shell which executes the specified recipe.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文