GMake Echo 无法正常工作,删除反斜杠 (\)
GMake Echo Not Working Correctly, Dropping Backslash ( \ )
我在使用 GMake 时遇到问题。到上周晚些时候还不错。我将我的编译器重新安装到这台机器上的新位置并 运行 快速(成功)构建,但此后没有构建任何东西。
目前,GMake 的输出如下所示
IDE LSL Lib MCAL_CA MCAL_DB Output Release Source build buildall.bat cleanall.bat compile_window.bat config_ca intro.bat project.pj test.txt
IDE LSL Lib MCAL_CA MCAL_DB Output Release Source build buildall.bat cleanall.bat compile_window.bat config_ca intro.bat project.pj test.txt Cleaning Build Folders IDE LSL Lib MCAL_CA MCAL_DB Output Release Source build buildall.bat cleanall.bat compile_window.bat config_ca intro.bat project.pj test.txt
IDE LSL Lib MCAL_CA MCAL_DB Output Release Source build buildall.bat cleanall.bat compile_window.bat config_ca intro.bat project.pj test.txt
IDE LSL Lib MCAL_CA MCAL_DB Output Release Source build buildall.bat cleanall.bat compile_window.bat config_ca intro.bat project.pj test.txt
IDE LSL Lib MCAL_CA MCAL_DB Output Release Source build buildall.bat cleanall.bat compile_window.bat config_ca intro.bat project.pj test.txt Cleaning Dependencies Folder...
...并以以下错误结束
process_begin: CreateProcess(NULL, del \F .\Output\dep*.dep, ...) failed.
make (e=2): The system cannot find the file specified.
gmake: *** [clean_files] Error 2
我的 makefile 的相关部分如下。
@echo *********************************************
@echo **** Cleaning Build Folders ****
@echo *********************************************
@echo **
@echo ** Cleaning Dependencies Folder...
@$(REMOVE) .\Output\dep\*.dep
@echo ** Cleaning Objects Folder...
@$(REMOVE) .\Output\obj\*.o
@echo ** Cleaning Generated Assembly Files Folder...
@$(REMOVE) .\Output\asm\*.asm
@echo ** Cleaning Release Folder...
@$(REMOVE) .\Release\*.elf
@echo ** Cleaning Finished
@echo **
@echo **
@echo *********************************************
我认为这可能与我的系统配置有关,因为这是我见过此类问题的唯一系统,并且 makefile/setup 也适用于其他用户。 Echo 本身工作正常(当我在标准命令提示符中键入 'echo test' 时,IE 'test' 回显到 window)
输出中有两件事很奇怪。
制作配方行:
@echo *********************************************
@echo **** Cleaning Build Folders ****
@echo *********************************************
@echo **
@echo ** Cleaning Dependencies Folder...
正在生成以下输出:
IDE LSL Lib MCAL_CA MCAL_DB Output Release Source build buildall.bat cleanall.bat compile_window.bat config_ca intro.bat project.pj test.txt
IDE LSL Lib MCAL_CA MCAL_DB Output Release Source build buildall.bat cleanall.bat compile_window.bat config_ca intro.bat project.pj test.txt Cleaning Build Folders IDE LSL Lib MCAL_CA MCAL_DB Output Release Source build buildall.bat cleanall.bat compile_window.bat config_ca intro.bat project.pj test.txt
IDE LSL Lib MCAL_CA MCAL_DB Output Release Source build buildall.bat cleanall.bat compile_window.bat config_ca intro.bat project.pj test.txt
IDE LSL Lib MCAL_CA MCAL_DB Output Release Source build buildall.bat cleanall.bat compile_window.bat config_ca intro.bat project.pj test.txt
IDE LSL Lib MCAL_CA MCAL_DB Output Release Source build buildall.bat cleanall.bat compile_window.bat config_ca intro.bat project.pj test.txt Cleaning Dependencies Folder...
还有一行:
@$(REMOVE) .\Output\dep\*.dep
正在触发包含 del \F .\Output\dep*.dep
的错误。 (假设 $(REMOVE)
包含 del \F
。)
第一个输出异常是由 shell 将 **
glob 扩展到文件名列表来解释的。
第二个奇怪之处是 shell 删除了转义反斜杠(即 echo foo\*bar
产生 foo*bar
作为输出等)。
makefile 显然没有考虑到这些行为。
鉴于这是 Windows 似乎可以合理地假设 SHELL
打算使用的是 cmd.exe
而不是任何 shell (例如 sh
/bash
) 似乎是 运行 当前的命令。
确认确实如此,这意味着在 makefile 中设置 SHELL=cmd.exe
应该可以解决问题。该手册在 Choosing the Shell 部分讨论了 Windows 上 shell 的选择。
我在使用 GMake 时遇到问题。到上周晚些时候还不错。我将我的编译器重新安装到这台机器上的新位置并 运行 快速(成功)构建,但此后没有构建任何东西。
目前,GMake 的输出如下所示
IDE LSL Lib MCAL_CA MCAL_DB Output Release Source build buildall.bat cleanall.bat compile_window.bat config_ca intro.bat project.pj test.txt
IDE LSL Lib MCAL_CA MCAL_DB Output Release Source build buildall.bat cleanall.bat compile_window.bat config_ca intro.bat project.pj test.txt Cleaning Build Folders IDE LSL Lib MCAL_CA MCAL_DB Output Release Source build buildall.bat cleanall.bat compile_window.bat config_ca intro.bat project.pj test.txt
IDE LSL Lib MCAL_CA MCAL_DB Output Release Source build buildall.bat cleanall.bat compile_window.bat config_ca intro.bat project.pj test.txt
IDE LSL Lib MCAL_CA MCAL_DB Output Release Source build buildall.bat cleanall.bat compile_window.bat config_ca intro.bat project.pj test.txt
IDE LSL Lib MCAL_CA MCAL_DB Output Release Source build buildall.bat cleanall.bat compile_window.bat config_ca intro.bat project.pj test.txt Cleaning Dependencies Folder...
...并以以下错误结束
process_begin: CreateProcess(NULL, del \F .\Output\dep*.dep, ...) failed.
make (e=2): The system cannot find the file specified.
gmake: *** [clean_files] Error 2
我的 makefile 的相关部分如下。
@echo *********************************************
@echo **** Cleaning Build Folders ****
@echo *********************************************
@echo **
@echo ** Cleaning Dependencies Folder...
@$(REMOVE) .\Output\dep\*.dep
@echo ** Cleaning Objects Folder...
@$(REMOVE) .\Output\obj\*.o
@echo ** Cleaning Generated Assembly Files Folder...
@$(REMOVE) .\Output\asm\*.asm
@echo ** Cleaning Release Folder...
@$(REMOVE) .\Release\*.elf
@echo ** Cleaning Finished
@echo **
@echo **
@echo *********************************************
我认为这可能与我的系统配置有关,因为这是我见过此类问题的唯一系统,并且 makefile/setup 也适用于其他用户。 Echo 本身工作正常(当我在标准命令提示符中键入 'echo test' 时,IE 'test' 回显到 window)
输出中有两件事很奇怪。
制作配方行:
@echo *********************************************
@echo **** Cleaning Build Folders ****
@echo *********************************************
@echo **
@echo ** Cleaning Dependencies Folder...
正在生成以下输出:
IDE LSL Lib MCAL_CA MCAL_DB Output Release Source build buildall.bat cleanall.bat compile_window.bat config_ca intro.bat project.pj test.txt
IDE LSL Lib MCAL_CA MCAL_DB Output Release Source build buildall.bat cleanall.bat compile_window.bat config_ca intro.bat project.pj test.txt Cleaning Build Folders IDE LSL Lib MCAL_CA MCAL_DB Output Release Source build buildall.bat cleanall.bat compile_window.bat config_ca intro.bat project.pj test.txt
IDE LSL Lib MCAL_CA MCAL_DB Output Release Source build buildall.bat cleanall.bat compile_window.bat config_ca intro.bat project.pj test.txt
IDE LSL Lib MCAL_CA MCAL_DB Output Release Source build buildall.bat cleanall.bat compile_window.bat config_ca intro.bat project.pj test.txt
IDE LSL Lib MCAL_CA MCAL_DB Output Release Source build buildall.bat cleanall.bat compile_window.bat config_ca intro.bat project.pj test.txt Cleaning Dependencies Folder...
还有一行:
@$(REMOVE) .\Output\dep\*.dep
正在触发包含 del \F .\Output\dep*.dep
的错误。 (假设 $(REMOVE)
包含 del \F
。)
第一个输出异常是由 shell 将 **
glob 扩展到文件名列表来解释的。
第二个奇怪之处是 shell 删除了转义反斜杠(即 echo foo\*bar
产生 foo*bar
作为输出等)。
makefile 显然没有考虑到这些行为。
鉴于这是 Windows 似乎可以合理地假设 SHELL
打算使用的是 cmd.exe
而不是任何 shell (例如 sh
/bash
) 似乎是 运行 当前的命令。
确认确实如此,这意味着在 makefile 中设置 SHELL=cmd.exe
应该可以解决问题。该手册在 Choosing the Shell 部分讨论了 Windows 上 shell 的选择。