"make clean" issue in MSYS/Cygwin

Peter picture Peter · Jan 18, 2013 · Viewed 10.5k times · Source

I finally managed to compile a program in Windows, which took a while and would have not been possible without some help from here. It all works now, except: "make clean" yields

/bin/sh: del: command not found
Makefile:44: recipe for target `clean' failed
make: *** [clean] Error 127

In the makefile, the clean command looks like

clean:
del /S *.o *~ *.out [...], eliminating all resulting .o and executables resulting from make.

mingw64 is in the path, and I tried with cygwin/bin in the path and without, both with the same result. "Make" was done with mingw32-make in msys. I also tried "mingw-32-make clean" in msys, still no luck; I am also not sure if "make clean" is supported in Cygwin at all. I run the whole thing on Windows 7, 64 bit.

How can I fix this problem?

Error with rm instead of del

Answer

Steven Penny picture Steven Penny · Jan 18, 2013

It seems like you are mixing your platforms. del is a cmd.exe builtin, which is why it cannot be found by Bash. The analog to del is rm.

Try running make under cmd.exe

or

editing the Makefile, replacing del /S with rm -f