title: MinGW makefile with or without MSYS (del vs rm)
body: <p>I am using MinGW for compiling some stuff on Windows. I call <code>mingw32-make</code> directly from <code>cmd.exe</code> and everything (I need) works fine. However I found out I will need to be able to compile from the MSYS environment and I run in problems with <code>copy</code> and <code>del</code> commands not beeing recognized. I know it is only matter of replacing them with <code>cp</code> and <code>rm</code>, but I would like to use single makefile for both cases.</p>
  
  <p>Is there a way to force msys environment to call system <code>del</code> and <code>cp</code> commands?</p>
  
  <p>Or better yet, is there a way to distinguish whether the makefile is called from <code>cmd.exe</code> or msys? Than I could set appropriate variables for the commands. This would be quite helpfull, because I could then remove some other duplicate makefiles.</p>
  
  <p>Any help is appreciated.</p>
  
  <p>Thanks</p>
  
  <p><strong>EDIT:</strong> And to make things more difficult: <code>mingw32-make</code> seems to be using <code>sh.exe</code> if found in PATH when run from <code>cmd.exe</code>. This has completely different set of environment variables.</p>
  
  <p><strong>EDIT:</strong> OK, if anyone is still interested, I ended up with the following file, which I include to my other Makefiles:</p>
  
  <pre><code>ifeq ($(OS),Windows_NT) 
  RM = del /Q /F
  CP = copy /Y
  ifdef ComSpec
  SHELL := $(ComSpec)
  endif
  ifdef COMSPEC
  SHELL := $(COMSPEC)
  endif
  else
  RM = rm -rf
  CP = cp -f
  endif
  </code></pre>
  
  <p>If not, and you still think this is a duplicate question I can of course delete this question.</p>
  
  <p>For reasons unknown to me <code>ComSpec</code> and <code>COMPSPEC</code> make a difference.</p>