[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Why does the shell I invoke Make with have an effect on its output?
From: |
Peter0x44 |
Subject: |
Why does the shell I invoke Make with have an effect on its output? |
Date: |
Tue, 08 Mar 2022 05:06:41 +0000 |
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.
- Why does the shell I invoke Make with have an effect on its output?,
Peter0x44 <=
- Re: Why does the shell I invoke Make with have an effect on its output?, Eli Zaretskii, 2022/03/08
- Re: Why does the shell I invoke Make with have an effect on its output?, Peter0x44, 2022/03/08
- Re: Why does the shell I invoke Make with have an effect on its output?, Eli Zaretskii, 2022/03/08
- Re: Why does the shell I invoke Make with have an effect on its output?, Peter0x44, 2022/03/08
- Re: Why does the shell I invoke Make with have an effect on its output?, Kaz Kylheku, 2022/03/08
- Re: Why does the shell I invoke Make with have an effect on its output?, Peter0x44, 2022/03/08
- Re: Why does the shell I invoke Make with have an effect on its output?, Kaz Kylheku, 2022/03/09
- Re: Why does the shell I invoke Make with have an effect on its output?, Eli Zaretskii, 2022/03/08