I previously sent this message to Eli Zaretskii, whose [EZWinPorts](
https://sourceforge.net/projects/ezwinports/files/) binary I am using. He
asked me to move this conversation here.

I'm trying to choose the shell for my Makefile recipes when I run
EZWinPorts's Windows port of Make 4.3 (without Guile, [installed by Scoop](
https://github.com/ScoopInstaller/Main/blob/master/bucket/make.json)), but
can't seem to get it to work.

For example, I'm running on Windows with PowerShell installed and on the
`PATH`. If I make a target whose recipe is just "`ls`", I get this error:

    process_begin: CreateProcess(NULL, ls, ...) failed.
    make (e=2): The system cannot find the file specified.
    make: *** [Makefile:4: ls] Error 2

That's fine. Maybe it's using `cmd` as the shell for that line (but it
really looks like it ignores all shells and directly calls Windows's
equivalent of `popen`). Then I run through the different [options](
https://www.gnu.org/software/make/manual/html_node/Choosing-the-Shell.html)
for choosing the shell as laid out in the docs.

- I can see that `ComSpec` is set in my default environment. In PowerShell,
I can read it as `$env:ComSpec` or `$env:COMSPEC`, but in a Makefile, it is
only available as `${ComSpec}`. If I remove and re-add the variable under
the name `$env:COMSPEC`, it becomes available in the Makefile as
`${COMSPEC}`, but I still get the same error from the `ls` recipe.
- The default value of `SHELL` in the Makefile is `sh.exe`. If I set
`SHELL` in the Makefile to either `powershell` or the full path to
`powershell.exe`, I get the same error.

How can I achieve my goal? Is this a bug? Is the documentation for a
different version of Make, or out-of-date?

Thank you,
John

Reply via email to