2015-10-24 114 views
1

我试图将Makefile移植到Windows(使用GNU Make)。我在删除目录时遇到问题。我发现如何有条件地删除目录这个问题(Delete a directory and its files using command line but don't throw error if it doesn't exist),但我在尝试使用该解决方案的错误,约需翻译到The use of ""doc\html"" is syntactically impermissible in this contextMakefile Windows - 删除目录(如果存在)

的片段导致它是这样的:

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仍然会抛出错误并停止。

我该如何做这项工作?

回答

2

该命令是exist而不是exists。在我链接的线程中有一个错字...