What are the differences between MinGW's make and MSYS's make and which one is available where?

后端 未结 1 1918
名媛妹妹
名媛妹妹 2021-02-12 11:36

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 NetBean

相关标签:
1条回答
  • 2021-02-12 11:57

    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.

    0 讨论(0)
提交回复
热议问题