0

I'm running Mingw64, and I'm compiling GLFW. I've run cmake . -G "MinGW Makefiles" successfully, and it's generated the Makefile in my current working directory.

However, when I run make, or make all, it seems to open a new shell??

timle@HUMBOLDT MINGW64 /c/Users/timle/src/glfw-3.3.3
$ make
Microsoft Windows [Version 10.0.19042.867]
(c) 2020 Microsoft Corporation. All rights reserved.

C:\Users\timle\src\glfw-3.3.3>

Running make again seems to nest the problem:

timle@HUMBOLDT MINGW64 /c/Users/timle/src/glfw-3.3.3
$ make
Microsoft Windows [Version 10.0.19042.867]
(c) 2020 Microsoft Corporation. All rights reserved.

C:\Users\timle\src\glfw-3.3.3>make
make
make[1]: Entering directory '/c/Users/timle/src/glfw-3.3.3'
Microsoft Windows [Version 10.0.19042.867]
(c) 2020 Microsoft Corporation. All rights reserved.

C:\Users\timle\src\glfw-3.3.3>

and quitting with ctrl+c gives:

C:\Users\timle\src\glfw-3.3.3>make: *** [Makefile:620: cmake_check_build_system] Interrupt
make[1]: *** [Makefile:620: cmake_check_build_system] Interrupt

What on earth is going on? How do I make it make?

Output of make -v:

GNU Make 4.3
Built for x86_64-pc-msys
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

(which makes it even weirder that we get a Microsoft copyright when we run it??)

(This is also why I don't believe this to be a duplicate of this question - it seems I do have the proper version of make installed)

Tim Leach
  • 87
  • 10

2 Answers2

0

Turns out on MinGW64 you want to use mingw32-make, not just plain make, which appears to run Microsoft make ‍♂️

If anyone knows why the output of make -v suggests GNU make, but running it suggests Microsoft make, please let me know!

Tim Leach
  • 87
  • 10
0

You are misunderstanding what's happening. make is not Microsoft make. Microsoft make is nmake. The make you are running IS GNU make as you can see from the --version output.

Make is a tool that controls the execution of other tools; in this case, compilers and linkers but it doesn't have to be that. In order to run those tools, make will invoke a shell. So any command that make runs can be any legal shell script.

On a POSIX system like Linux or MacOS this is all very simple because there's only one default POSIX shell, /bin/sh, on the system so it's very clear what will happen.

On Windows, where there's no POSIX shell by default, so people may install multiple other shells, including POSIX shells, in random places that make can't know about, AND there are even multiple Windows shells (cmd.exe and Powershell for example), it's all very complicated. Usually each install of GNU make will have a "default shell" that it will try to use. Which shell that is, is determined at compile time, usually with a fallback to search for at runtime. Some versions of make will use cmd.exe by default, some will assume a POSIX shell.

You have two versions of make installed on your system, and they apparently default to invoking different shells.

It's clear from your examples that (a) you have invoked cmake and asked it to generate MinGW Makefiles, which means that the commands included in the makefile will assume that make will invoke a cmd.exe Windows shell (you can see this from the cmake documentation), and (b) whatever make you are actually using does not expect this shell.

The reason you see a shell prompt is that make is invoking the shell but is giving it a command to run in a form that it does not expect, and so it starts an interactive shell instead. The copyright you see here is the copyright on the shell that make is invoking, Microsoft cmd.exe, not the copyright of make itself. If you run the shell yourself from your command prompt, without make involved at all, by typing cmd.exe you'll see this same copyright.

If you want to see what commands a cmake-generated Makefile are invoking, you can add the VERBOSE=1 option to your make invocation.

MadScientist
  • 92,819
  • 9
  • 109
  • 136