【发布时间】:2017-12-10 03:03:18
【问题描述】:
所以我为一个 c 程序制作了一个 makefile。出于某种原因,我的“清洁”不起作用。这是我的makefile的一点点:
CC=gcc
FLAGS=-c -Wall -I.
CLEANC=rm -rf *.o
move.o: move.c
$(CC) $(FLAGS) move.c
/*Lot more codes like this^^^*/
clean:
$(CLEANC)
当我在命令提示符下运行“make clean”时,我会看到以下内容:
rm -rf *.o
process_begin: CreateProcess(NULL, rm -rf *.o, ...) failed.
make (e=2): The system cannot find the file specified.
makefile:116: recipe for target 'clean' failed
make: *** [clean] Error 2
我不知道我做错了什么。我尝试将 CLEANC 更改为
rm -f *.o
rm *.o
rm *o
rm -f *.o test.exe //test.exe is executable
但无论我尝试什么,它仍然给我同样的错误。我真的可以使用帮助。提前致谢。
【问题讨论】:
-
无法重现。您的 Makefile 与 GNU Make 3.81 和 GNU Make 4.2.1 完美配合。
-
什么操作系统?在命令行上尝试
rm -f *.o会发生什么? -
它给了我同样的错误。我正在使用安装了 MinGW 和 MSYS 的 Windows 10。 'make' 和 'make compile' 完美运行,但由于某种原因,'make clean' 总是给我同样的错误。