help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why does the shell I invoke Make with have an effect on its output?


From: Peter0x44
Subject: Re: Why does the shell I invoke Make with have an effect on its output?
Date: Tue, 08 Mar 2022 19:36:12 +0000

> Are you sure your sh.exe lets Make see the ComSpec environment
> variable as it is defined by Windows? Maybe it's COMSPEC instead, or
> maybe sh.exe removes that variable entirely from the environment
> passed to Make?
Hmm, I checked and it seems this is the case echo $COMSPEC works, (but shows a
path to cmd.exe), while echo $ComSpec does not

It is my fault, but I should have just mentioned what I needed to begin with.
Is there a way to determine which shell the build rules of a Makefile are being
executed with?  This method is used by the GNU Makefile generator of premake,
and it does not work properly.
>
> > The built rules for both are *not* being
> > executed using cmd.exe, as you can tell by the error when trying to invoke
> > `del`, and the build rules of both Makefiles are being executed with the 
> > same
> > shell.
>
> As a special "feature", the MS-Windows port of GNU Make uses sh.exe as
> its shell if it finds it on PATH. If you want to countermand that,
> you need to say explicitly
>
> SHELL = cmd.exe
>
> in your Makefile.
I am aware of this behavior, and understand that the assumption the shell is
always cmd.exe on Windows is a bad one

Thanks for your time,
Peter D.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]