If you're content with a Windows-only solution, you can make do with invoking powershell.exe
directly from your Makefile
, as in your answer.
However, I strongly suggest avoiding Unix-like PowerShell aliases such as curl
for Invoke-WebRequest
and rm
for Remove-Item
, because while their purpose is similar in the abstract, their syntax is generally very different. Just use PowerShell's native command names to avoid ambiguity.
Note that using Shell := <default shell executable>
appears to be ignored by the Windows port of make
you link to.
If you want cross-platform compatibility:
either: Use WSL, which offers you a choice of Linux distros in which both make
and the standard Unix utilities are natively available - you then need neither cmd.exe
nor PowerShell.
and/or: Use PowerShell Core and invoke your commands as follows:
pwsh -noprofile -command <your command>
- In a cross-platform solution that uses WSL on Windows, you can simplify invocations by declaring
SHELL := pwsh -NoProfile
at the top of the MakeFile
, after which you can invoke PowerShell (Core) commands directly.