'make clean' not working

允我心安 提交于 2020-01-03 04:51:30

问题


so I made a makefile for a c program. For some reason my 'clean' is not working. Here's a little bit of my 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)

When I run 'make clean' in command prompt, I'm shown the following:

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

I can't figure out what I'm doing wrong. I've tried changing CLEANC to

rm -f *.o
rm *.o 
rm *o
rm -f *.o test.exe //test.exe is executable

but it still gave me the same error no matter what I tried. I could really use the help. Thanks in advance.


回答1:


Judging from the CreateProcess appearing in your error output I assume you are running make under Windows.

This means that there is no rm command, you should use del instead and -rf flags should also be adjusted accordingly.



来源:https://stackoverflow.com/questions/47735464/make-clean-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!