在 Windows 上的 makefile 中。
使用以下 make 版本:
PS C:\projects> make --version
GNU Make 4.1
Built for i686-w64-mingw32
Copyright (C) 1988-2014 Free Software Foundation, Inc.
Run Code Online (Sandbox Code Playgroud)
我试图在没有明确指定 shell 的情况下设置SHELL := pwsh/COMSPEC := pwsh和运行命令:
# COMSPEC := pwsh -c
SHELL := pwsh -c
VAR=asdf/asdf
.PHONY: get_var
get_var:
@Write-Output $(VAR)
Run Code Online (Sandbox Code Playgroud)
没有成功。我有一个错误:
PS C:\projects\makefile_factory> make -f .\fi.makefile get_var
process_begin: CreateProcess(NULL, Write-Output asdf/asdf, ...) failed.
make (e=2): ?? ?????? ????? ????????? ????.
.\fi.makefile:10: recipe for target 'get_var' failed
make: *** [get_var] …Run Code Online (Sandbox Code Playgroud)