11.9 The Make Macro
Posix-compliant make internally uses the
macro to spawn shell processes and execute Make rules. This
is a builtin macro supplied by make, but it can be modified
by a makefile or by a command-line argument.
Not all make implementations define this
make is an example; this implementation always uses
/bin/sh. So it's a good idea to always define
your makefiles. If you use Autoconf, do
SHELL = @[email protected]
Do not force
SHELL = /bin/sh because that is not correct
everywhere. For instance DJGPP lacks
/bin/sh, and when
make port sees such a setting it enters a special
emulation mode where features like pipes and redirections are emulated
on top of DOS's command.com. Unfortunately this emulation is
incomplete; for instance it does not handle command substitutions.
SHELL should point to Bash.
Posix-compliant make should never acquire the value of
$(SHELL) from the environment, even when
make -e is used
(otherwise, think about what would happen to your rules if
However not all make implementations have this exception.
For instance it's not surprising that OSF/Tru64 make doesn't
SHELL, since it doesn't use it.
$ cat Makefile
SHELL = /bin/sh
FOO = foo
$ env SHELL=/bin/tcsh FOO=bar make -e # OSF1 V4.0 Make
$ env SHELL=/bin/tcsh FOO=bar gmake -e # GNU make