Calling Windows commands (e.g. del) from a GNU makefile
Because DOS-based systems have two different commands for removing files and directories, I find that having two different defines works the best:
ifeq ($(OS),Windows_NT) RM = cmd //C del //Q //F RRM = cmd //C rmdir //Q //Selse RM = rm -f RRM = rm -f -rendifclean: $(RM) $(TARGET).elf $(TARGET).map $(RRM) $(BUILD_DIR)
Happened to me too. At the top of your makefile add:
SHELL=cmd
Since you are compiling on windows, select 'cmd' as the default shell. Thisis important because GNU make will search the path for a linux/unix like shell and if it finds one it will use it instead. This is the case when cygwin is installed. The side effect of this behavior is that commands like 'del' and 'echo' are not found. If we tell GNU make to use 'cmd' as its shell, then 'del' and such will be available.