【问题标题】:What is the difference between gmake and make?gmake 和 make 有什么区别?
【发布时间】:2010-11-14 18:18:09
【问题描述】:

我想了解“gmake”和“make”之间的区别?

在我的 linux 机器上它们是相同的:

% gmake --version
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

% make --version
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

我猜这在所有平台上都不一样? 有充分的理由使用其中一个吗?
为什么会有这两个名字,有什么历史意义吗?

【问题讨论】:

    标签: build makefile gnu-make


    【解决方案1】:

    'gmake' 特指 GNU make。 'make' 是指系统默认的 make 实现;在大多数 Linux 发行版上,这是 GNU make,但在其他 unix 上,它可以指代 make 的其他一些实现,例如 BSD make,或各种商业 unix 的 make 实现。

    GNU make 接受的语言是传统 make 实用程序支持的语言的超集。

    通过专门使用“gmake”,您可以使用 GNU make 扩展,而不必担心它们会被其他 make 实现误解。

    【讨论】:

    • 好答案。请注意,gcc 和 cc 遵循相同的约定
    • 它也适用于其他 gtools:例如,gawk 和 gtar 是在 Solaris 上绊倒人们的工具。
    • GNU Make 在其语言扩展中没有提供兼容的功能超集。例如,$^ 在 gmake(1) 中不存在,但在其 BSD 的 pmake(1) 中存在。当尝试编写一个可供 GNU Make 和 pmake 使用的 Makefile 时,这可能会导致灾难性的结果(人为的无害示例,想象一下:gcc -o $@ $< = gmake 没有输入源,因为 $
    • @Sean $^ 是怎么回事? variable with that name 肯定存在于 GNU Make 中,据我所知,它与旧版 Make 兼容。 BSD Make 中的语义是否不同?
    • 问题:make 和 gmake 脚本是否交叉兼容?
    【解决方案2】:

    在我的系统上没有区别(gmake 是要制作的软链接):

    -> ls -l $(which gmake make)
    lrwxrwxrwx 1 root root      4 Jun  5  2007 /usr/bin/gmake -> make
    -rwxr-xr-x 1 root root 168976 Jul 13  2006 /usr/bin/make
    

    gmake 代表 GNU make。 make 有不同的实现。在 Linux 机器上,GNU 的 make 最有可能是为了让用户的生活更美好,make 与 gmake 软链接。

    【讨论】:

      【解决方案3】:

      gmake 的通常“对立面”是 BSD make,这在 BSD 系统上往往是 make,这不足为奇。如果你想看看 BSD 是怎样的,在 Debian 衍生产品上可以使用 apt-get install pmake

      【讨论】:

      • 为什么pmake 不出所料是BSD 制造的? >.
      • 默认 make 是 BSD 系统上的 BSD make 也就不足为奇了。
      【解决方案4】:

      显然,GNU make 是practically universal now,所以几乎不会有任何区别。

      【讨论】:

      • 除非使用不同版本的 make 在这种情况下应该有所不同。
      • 嗯......你需要说 - GNU make 现在在 LINUX 系统上几乎是通用的。假设 BSD 正在使用它自己的 make,它有不同的语法等。
      • 是的,Solaris 也肯定使用自己的 make,这与 gnu make 不同
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-10-20
      • 1970-01-01
      • 2019-01-21
      • 2013-12-02
      • 1970-01-01
      • 2021-11-04
      • 2017-10-22
      相关资源
      最近更新 更多