The way I share them is to use the default Cygwin environment exclusively. MinGW stuff is not included in my PATH by default, and I do not use MSYS programs. For everyday use, you cannot say that I have MinGW.
On those rare occasions when I need to test something with MinGW, I run this shell script from the Cygwin Bash prompt, which I call mingw :
#!/bin/sh PATH=/cygpath/c/mingw/bin:/cygpath/c/windows/system32:/cygpath/c/cygwin/bin echo "Say 'exit' to leave MinGW shell and restore Cygwin environment." /usr/bin/bash --rcfile ~/.mingwrc
Adjust the PATH to taste. The only important thing is that it puts the MinGW bin directory in front of the Cygwin bin directory. You probably still need the Cygwin bin directory in the PATH for vi, ls, etc.
The last line of this script runs this script, ~/.mingwrc :
alias make=mingw32-make PS1='MinGW: \W \$ '
You cannot combine these two scenarios because of how Bash works. The second script contains things that can happen only after running the "MinGW shell". The PS1 assignment reminds you that you are in the MinGW shell, and the alias ensures that the input βmakeβ launches its own make (1) MinGW program instead of Cygwin, since my MinGW Makefiles use DOS commands and not Bourne shell commands, and this is one of the differences in the MinGW GNU make port. You will leave this alias if you want to use the MinGW compiler with Cygwin make.
When you βexitβ the MinGW sub-shell, you restore the previous PS1, PATH, and aliases.
Warren young
source share