GNU make 如何决定是直接运行规则中的一行还是通过批处理文件运行?我在Windows Server 2008平台上使用GNU Make v3.80,所以我的shell是cmd.exe。
打开调试 (-d) 并注意到规则中的某些行不是通过子 shell 运行(在我的例子中使用 cmd.exe 进行批处理),而是似乎由 make 直接调用。
请参阅下面的示例。看看xcopy命令是如何直接运行的:
CreateProcess(C:\Windows\system32\xcopy.exe,xcopy /?,...)
Run Code Online (Sandbox Code Playgroud)
但 echo 命令是通过批处理文件运行的:
Creating temporary batch file C:\Users\fbloggs\AppData\Local\Temp\95\make732002.bat
Run Code Online (Sandbox Code Playgroud)
示例生成文件:
stackoverflow :
xcopy /?
@echo Done
Run Code Online (Sandbox Code Playgroud)
完整的 dDebug 输出:
GNU Make 3.80 Tool Version v1.3 build for Linux on 20060503
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
find_and_set_shell …Run Code Online (Sandbox Code Playgroud) makefile ×1