I am using MinGW for compiling some stuff on Windows. I call mingw32-make
directly from cmd.exe
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 copy
and del
commands not beeing recognized. I know it is only matter of replacing them with cp
and rm
, but I would like to use single makefile for both cases.
Is there a way to force msys environment to call system del
and cp
commands?
Or better yet, is there a way to distinguish whether the makefile is called from cmd.exe
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.
Any help is appreciated.
Thanks
EDIT: And to make things more difficult: mingw32-make
seems to be using sh.exe
if found in PATH when run from cmd.exe
. This has completely different set of environment variables.
EDIT: OK, if anyone is still interested, I ended up with the following file, which I include to my other Makefiles:
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
If not, and you still think this is a duplicate question I can of course delete this question.
For reasons unknown to me ComSpec
and COMPSPEC
make a difference.