Hi all, I have the following Makefile:
SHELLTYPE := posix ifeq (.exe, $(findstring .exe,$(ComSpec))) SHELLTYPE := msdos endif default: $(info SHELLTYPE is $(SHELLTYPE)) del I am running it under Windows, using GNU Make 4.2 Note that in all cases, I have the executable `sh.exe` present in the PATH. It is busybox-w32, renamed to sh.exe. https://frippery.org/busybox `del` is only present in the Makefile because it is a cmd.exe builtin command, so if the build rules are being executed using cmd.exe, it should show "The syntax of the command is incorrect.", while if it is a UNIX shell, it should show an error relating to CreateProcess failing. If I invoke this Makefile from cmd.exe, I get this output: SHELLTYPE is msdos del process_begin: CreateProcess(NULL, del, ...) failed. make (e=2): The system cannot find the file specified. make: *** [Makefile:8: default] Error 2 If I invoke it from sh.exe, I get this different output: make SHELLTYPE is posix del process_begin: CreateProcess(NULL, del, ...) failed. make (e=2): The system cannot find the file specified. make: *** [Makefile:8: default] Error 2 Does anyone know why does the shell I invoke the Makefile with determines whether it outputs "msdos" or "posix"? The built rules for both are *not* being executed using cmd.exe, as you can tell by the error when trying to invoke `del`, and the build rules of both Makefiles are being executed with the same shell. Lastly, I tried with msys2, and its bash shell: HELLTYPE is posix del make: del: No such file or directory make: *** [Makefile:9: default] Error 127 Best wishes, Peter D.