Thank you Paul! Well, the recipe I am using is the simplest possible recipe: all: echo $(SHELL)
OK, what do you mean by "runs the command directly rather than invoking a shell" I tested that possibility (even though the manual clearly says that is not the case). I custom modified /bin/sh, then ran that, so that my _current_shell_ was the modified one. Then _in_that_context_ ran GNU Make with the simple recipe. I had shell modified so that each time it interpreted a command, it would print something to a log file. Nope. When I ran GNU Make , the log file was not updated, so that meant, the current modified shell, was not interpreting any command. From: Paul Smith <psm...@gnu.org> To: Mark Galeck <mark_gal...@pacbell.net> Cc: "help-make@gnu.org" <help-make@gnu.org> Sent: Tuesday, October 13, 2015 5:02 AM Subject: Re: how to use a different /bin/sh with GNU Make? On Tue, 2015-10-13 at 04:35 +0000, Mark Galeck wrote: > as root, I replaced the default /bin/sh with a shell compiled by me > with custom changes. I expected GNU Make will use that shell by > default , but it does not - it still uses the original /bin/sh (which > was really bash) even though it is not there anymore. It would be very helpful if you provided an example of the recipe you're using. Without that we can only speculate. GNU make contains a special "fast path" capability. If it knows that the shell is a POSIX-compliant shell (because the shell is one of a set of known POSIX-compliant shells such as /bin/sh, /bin/bash, or others... for the complete list see the unix_shells[] array in the jobs.c file in the GNU make source code), and it determines that the recipe is "simple enough": it's a single command, has no IO redirection or pipes, the quoting is straightforward, and there are no shell variables in it, then make runs the command directly rather than invoking a shell. So for example, this recipe is run directly by make rather than starting a shell: cc -Wall -o foo.o -c foo.c but this recipe would always start a shell: cc -Wall -o foo.o -c foo.c; echo "Compilation complete" If you want to force make to always start a shell and never use the fast path the best way is to name your shell something else, like /bin/mgsh or something, then set make's SHELL variable to that path. Since make is no longer sure if your shell is a POSIX shell, it will never use the fast path. _______________________________________________ Help-make mailing list Help-make@gnu.org https://lists.gnu.org/mailman/listinfo/help-make