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: Eli Zaretskii
Subject: Re: Why does the shell I invoke Make with have an effect on its output?
Date: Tue, 08 Mar 2022 22:18:28 +0200

> Date: Tue, 08 Mar 2022 19:36:12 +0000
> Cc: <help-make@gnu.org>
> From: "Peter0x44" <peter0x44@snopyta.org>
> 
> > 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

Then that's the reason: Make does case-sensitive comparison of
environment variables, even on Windows.

> Is there a way to determine which shell the build rules of a Makefile are 
> being
> executed with?

The answer in most cases is "none".  GNU Make tries very hard to avoid
invoking the shell, so as to be faster, so it only goes through the
shell when something in the command line actually requires a shell,
like redirection or wildcards.

But the rules Make applies are supposed to follow the semantics of the
shell that Make would have invoked.  So if you have sh.exe on PATH, I
think Make will try to use the Posix shell semantics.



reply via email to

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