I try to use commands like curl, rm, start in makefiles in Windows using the following makefile processor: http://gnuwin32.sourceforge.net/packages/make.htm
It does not seem to be possible, rather it seems like I am very limited with the commands. Which ways are there to extend my set of commands?
I would appreciate any help. Thanks
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>
SHELL := pwsh -NoProfile
at the top of the MakeFile
, after which you can invoke PowerShell (Core) commands directly.You can use the power of powershell by prefixing the corresponding commands with powershell.
Example:
.PHONY: psStuff
psStuff:
powershell <your command>
powershell curl google.de
powershell rm -r folder
powershell start yourwebsite.de
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With