premake / premake-core

Premake
https://premake.github.io/
BSD 3-Clause "New" or "Revised" License
3.13k stars 611 forks source link

The Makefile generated by `premake5 gmake2` calls `sh.exe` #2196

Open ghost opened 3 months ago

ghost commented 3 months ago

I'm using a standalone MinGW distro with mingw32-make. If the Makefile generated by premake5 gmake2 requires a POSIX environment then it's useless for me. The reason why I use a standalone MinGW distro is because I don't want to install a full MSYS2.

ghost commented 3 months ago

The document is confusing. It said:

gmake2 : Generate GNU Makefiles (including Cygwin and MinGW)

The original MinGW.org is pretty much dead. No one remember it. People are now all using MinGW-w64. Even so, the statement above is wrong. The original MinGW.org is also pure Win32 like MinGW-w64. But it does have something called MSYS to provide a POSIX environment. MSYS to the original MinGW.org is the same as MSYS2 to MinGW-w64.

Peter0x44 commented 3 months ago

@iahung2 it does not require a "posix" environment. cmd.exe works fine too. Are you encountering some issues regarding using gcc?

ghost commented 3 months ago

@iahung2 it does not require a "posix" environment. cmd.exe works fine too. Are you encountering some issues regarding using gcc?

I can confirm with you that it calls sh.exe. Since there is no sh.exe in PATH, it failed to create the process. Not to mention that when using MSYS2, only the POSIX version of make works. mingw32-make will not work.

https://github.com/SpartanJ/ecode/issues/141

Peter0x44 commented 3 months ago

@iahung2 make (or mingw32-make, it doesn't matter) will search your PATH for an sh.exe and use it if it's present. This is documented behavior.

Peter0x44 commented 3 months ago

If you wish to enforce a certain shell, you should use: make SHELL=cmd (if this is a problem) Premake's generated makefiles should work under both.

ghost commented 3 months ago

If you wish to enforce a certain shell, you should use: make SHELL=cmd (if this is a problem) Premake's generated makefiles should work under both.

This statement is plainly wrong. It needs a POSIX environment. I have tested in Windows Command Prompt. The error is always about it's failed to CreateProcess a random POSIX utility that simply doesn't exist in a pure Windows environment.

p/s: I have removed anything related to MSYS2 in the PATH environment variable. The MinGW in PATH is a standalone MinGW distro by niXman.

ghost commented 3 months ago

This is the command I used in Windows Command Prompt:

premake5 gmake2
mingw32-make SHELL=cmd config=release_x86_64 -C make/windows -j4

I downloaded premake-5.0.0-beta2-windows.zip from your website and extracted it into the root of eepp directory.

With SHELL=cmd and MSYS2 removed from PATH, it seems to no longer call sh.exe, but now it's trying to call cc.

p/s: If you want to prove me wrong, please give me a command that works.

Peter0x44 commented 3 months ago

@iahung2 the "mingw environment by NixMan" does not provide an alias for cc->gcc. You can make one, or test by adding CC=gcc to your command.

Peter0x44 commented 3 months ago

This statement is plainly wrong. It needs a POSIX environment.

YOUR statement is plainly wrong. I have done exactly this, and even fixed bugs with the configuration you described before. You need to make your tone more calm.