make-w32
[Top][All Lists]
Advanced

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

Re: powershell as a default GNU make SHELL in windows


From: Eli Zaretskii
Subject: Re: powershell as a default GNU make SHELL in windows
Date: Wed, 13 May 2020 17:12:12 +0300

> From: Илья <address@hidden>
> Date: Tue, 12 May 2020 19:43:05 +0300
> 
> Hello! Could you please help me with the following trouble?
> 
> https://stackoverflow.com/q/61754413/4105482

Try this:

  SHELL := pwsh.exe

  VAR=asdf/asdf

  .PHONY: get_var

  get_var:
        @Write-Output $(VAR) 2>&1

Explanation:

 1) The value of SHELL should be with the .exe extension and without
    the -c switch (or any other switches -- it's supposed to be the
    name of the shell's executable file)
 2) GNU Make doesn't invoke the shell unless it (a) sees a shell
    built-in command, or (b) sees some character special to the
    shell.  Since the built-in commands of PowerShell are not known to
    GNU Make, you are left with the second option, and the no-op
    redirection achieves that.

More generally, for an unusual shell such as PowerShell, my
recommendation is to use the explicit "pwsh -c COMMAND" invocation in
the Makefile.

HTH



reply via email to

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