Apologies if this is a rather dumb question but I'm working on getting C++ set up in NetBeans (which requires MinGW). It says in the documentation for the C/C++ part of NetBeans that it will only work with MSYS's make, not MinGW's make. I wanted to know the difference between the two, so I Googled it and came up with this question which says there are two different makes included with MinGW, mingw32-make
(MinGW's make) and make
(MSYS's make). I then dug a little on the MinGW website's wiki and found this post buried in the FAQ:
The "native" (i.e.: MSVCRT dependent) port of make is lacking in some functionality and has modified functionality due to the lack of POSIX on Win32. There also exists a version of make in the MSYS distribution that is dependent on the MSYS runtime. This port operates more as make was intended to operate and gives less headaches during execution. Based on this, the MinGW developers/maintainers/packagers decided it would be best to rename the native version so that both the "native" version and the MSYS version could be present at the same time without file name collision.
So, if there's two copies of make, which one is available in the MSYS shell and which one is available in cmd.exe
? What are the main differences between the two?
The main practical difference between the two makes, the MSYS version and the native version, is that former uses the MSYS shell to execute its commands, while the later uses cmd
. This means with the MSYS version of make you can write recipes much the same as you would on Unix or Linux system, while with the native Windows version you might have to do things differently. For simple command execution they work the same, but for more complicated actions the recipes will have to differ because cmd
has a much different syntax than Unix shells.
For example you might handle recursive builds like this with MSYS make:
recurse-subdirs:
for i in $(SUBDIRS); \
do \
cd $$i && make all || exit; \
done
While with the native version of make you'd have to do something like this instead:
recurse-subdirs: FORCE
for %%i in ($(SUBDIRS)) do \
cd %%i && make all || exit
With the MSYS make its also safe to assume the usual Unix commands are available (eg. rm *.o
), while with the native make you'll want to use Windows commands instead (eg. del *.o
).
Which version of make is available is dependent on how you set the PATH
. If both versions of make, one named make
, and one named mingw32-make
, can be found by searching PATH
then both commands will be available. This true whether you're using the MSYS shell or cmd
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With