On Tue Mar 8, 2022 at 11:23 PM GMT, Kaz Kylheku wrote: > On 2022-03-08 13:37, Peter0x44 wrote: > >> But the rules Make applies are supposed to follow the semantics of the > >> shell that Make would have invoked. So if you have sh.exe on PATH, I > >> think Make will try to use the Posix shell semantics. > > So, there is there no way to tell which shell Make is trying to > > invoke/follow > > the semantics of in my Makefile? > > > > That's all I really want to know. > > This topic is covered in the GNU Make manual: > > https://www.gnu.org/software/make/manual/make.html#Choosing-the-Shell > > I suspect any of these aspects could be influenced by exactly how GNU > Make > is ported to Windows. As an example, I wouldn't expect GNU Make ported > to a POSIX environment on Windows like Cygwin to follow this. > > I believe the documentation refers to a version of GNU Make built > for Windows according to one of the project's own recommended > methods: > > http://git.savannah.gnu.org/cgit/make.git/tree/README.W32.template I have read this page, but I am not sure how to apply the contained information.
I simply want to have a variable SHELLTYPE, that is set to msdos if cmd.exe is being used as the shell, and posix if sh.exe is being used. Checking the value of SHELL in the Makefile does not work, because as documented on that page: "However, if none of these is found, the value of SHELL will not be changed" If Make finds no sh.exe on my path, the value of SHELL will simply contain sh.exe, despite the fact that is not accurate. Is there any other way I can obtain this information? I am also not sure if this information applies: On MS-DOS, if SHELL is not set, the value of the variable COMSPEC (which is always set) is used instead. I am obviously not running MS-DOS, and from my testing, COMSPEC always contains a path to the location of cmd.exe Best wishes, Peter D.