Makefile Windows -- 如果存在则删除目录

3
我正在尝试将Makefile移植到Windows(使用GNU Make)。我在删除目录方面遇到了问题。我在这个问题上找到了答案(Delete a directory and its files using command line but don't throw error if it doesn't exist),但是我在尝试使用该解决方案时出现错误,大约翻译为“在此上下文中语法上不允许使用”doc \ html“”。
导致错误的代码片段是:
```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仍会抛出错误并停止。
如何使其工作?
1个回答

7

该命令应为exist而不是exists。我提供的链接中有一个拼写错误...


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接