lo *_*cre 3 directory if-statement makefile exists rmdir
我正在尝试将 Makefile 移植到 Windows(使用 GNU Make)。我在删除目录时遇到问题。我发现了关于如何有条件地删除目录的这个问题(使用命令行删除目录及其文件,但如果它不存在则不抛出错误),但是我在尝试使用该解决方案时遇到错误,大约转换为The use of ""doc\html"" is syntactically impermissible in this context
导致它的片段是这样的:
if exists "doc\html\" rmdir /Q /S doc\html
我也试过
cmd /c if exists "doc\html" cmd /c rmdir /Q /S doc\html
和
cmd /c if exists "doc\html\" cmd /c rmdir /Q /S doc\html
.
我也试过了rmdir /Q /S doc\html 2>nul
。这有点工作。错误被重定向,但 Make 仍然抛出错误并停止。
我怎样才能使这项工作?