> From: Илья <roster...@yandex.ru> > 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