make-w32
[Top][All Lists]
Advanced

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

Re: How to choose the shell?


From: Eli Zaretskii
Subject: Re: How to choose the shell?
Date: Sun, 05 Sep 2021 19:15:37 +0300

> From: John Freeman <jfreeman08@gmail.com>
> Date: Sun, 5 Sep 2021 10:48:26 -0500
> Cc: Paul Smith <psmith@gnu.org>, make-w32@gnu.org
> 
>  My suggestion for running commands that are only known to some
>  non-standard shell is either write the commands in recipes to invoke
>  the shell explicitly, or create a batch file, in your case ls.cmd,
>  which would call PowerShell internally, and put it somewhere on PATH.
>  Then everything should work without any tricks.
> 
> I'm trying to write a particular Makefile that works on both Windows and 
> Linux without requiring my users to
> add a bunch of binaries to either system.

That won't work, neither on Posix systems nor on Windows.  Not with
GNU Make.  Your Windows users should install the port of Coreutils.
It's not hard, such ports are available out there (I have one of them
installed).  Relying on built-in commands of non-standard shells,
without having the same commands as standalone executables, is not a
good idea, IME.

>  The manual isn't supposed to explain how to trick Make into doing
>  something it wasn't supposed to do.  Of course, if the GNU Make
>  maintainers decide to document these internals in the manual, it's
>  their prerogative.
> 
> I'm just trying to trick Make into doing what it _says_ it does. This 
> optimization to skip the shell is a
> regression when Make doesn't sufficiently understand the selected shell. 
> Perhaps the optimization should
> only be enabled for shells that Make understands. Then no explanation of the 
> optimization would be
> necessary because it would be completely transparent to users.

That's how GNU Make worked since day one, AFAIK.  Explaining that in
more detail could help you understand what's going on, but it won't
necessarily allow you to solve every such problem, because not every
command in a Makefile recipe can be made to run through a shell
without changing its semantics.  Even redirection could be a problem.



reply via email to

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