152

I am trying to understand the difference between 'gmake' and 'make'?

On my linux box they are identical:

% 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.

I am guessing this isn't the same on all platforms? Is there a good reason to use one over the other?
Is there some historical significance to why there are the two names?

Nick Haddad
  • 8,767
  • 3
  • 34
  • 38

4 Answers4

197

'gmake' refers specifically to GNU make. 'make' refers to the system's default make implementation; on most Linux distros this is GNU make, but on other unixes, it could refer to some other implementation of make, such as BSD make, or the make implementations of various commercial unixes.

The language accepted by GNU make is a superset of the one supported by the traditional make utility.

By using 'gmake' specifically you can use GNU make extensions without worrying about them being misinterpreted by some other make implementation.

dmckee --- ex-moderator kitten
  • 98,632
  • 24
  • 142
  • 234
bdonlan
  • 224,562
  • 31
  • 268
  • 324
  • 36
    good answer. note that the same convention follows for gcc and cc – Tim Hoolihan Jul 28 '09 at 15:43
  • 4
    It also applies to other gtools: gawk and gtar, for example, are the ones that trip people up on Solaris. – Dan Davies Brackett Jul 28 '09 at 19:25
  • 3
    GNU Make does not present a compatible superset of features in its language extensions. $^, for example doesn't exist in gmake(1), but does in its BSD's pmake(1). This can lead to disastrous results when trying to write a Makefile that can be used by both GNU Make and pmake (contrived harmless example, imagine: `gcc -o $@ $<` = no input sources with gmake because $< evaluates to an empty string. Worse combinations exist that can result in gcc clobbering files). – Sean May 24 '11 at 19:27
  • 4
    @Sean What's this about `$^`? A [variable with that name](https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html) certainly exists in GNU Make, and as far as I can tell is compatible with legacy Make. Are the semantics in BSD Make different? – tripleee Aug 30 '14 at 11:57
  • Question: are the make and gmake scripts cross compatible? – rsonx Feb 20 '19 at 13:07
  • @Revolver Depends on which `make` you are talking about. – Franklin Yu Jun 04 '19 at 21:17
  • missed a note on POSIX. GNU make is not compatible with it, most of BSD are. – Volodymyr Boiko Jan 23 '22 at 23:51
12

On my system no difference (gmake is soft link to make):

-> 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 stands for GNU make. There're different implementations of make. On Linux machine most probably make will by GNU and to make user's life isier make is soft linked to gmake.

dimba
  • 26,717
  • 34
  • 141
  • 196
2

The usual "opposite" of gmake is BSD make, which will tend to be make on BSD systems, unsurprisingly. If you want to see what BSD make is like, on Debian derivatives it's available as apt-get install pmake.

chaos
  • 122,029
  • 33
  • 303
  • 309
-3

Apparently, GNU make is practically universal now, so there should almost never be a difference.

Paul Biggar
  • 27,579
  • 21
  • 99
  • 152
  • 2
    Unless a different version of make is used in which case there should be a difference. –  Sep 24 '14 at 08:12
  • 13
    Well... you need to say - GNU make is practically universal now ON LINUX systems. Say BSD is using its own make which has different syntax, etc. – Alex Jan 16 '15 at 22:02
  • Yup, Solaris also definitely uses its own make, which is different to gnu make – Paulus Mar 08 '21 at 13:55
  • mst of BSDs make implmentations are POSIX. And you wont achieve POSIX compatibility with GNU make – Volodymyr Boiko Jan 23 '22 at 23:53