2004-11-28 23:11:23 +00:00
|
|
|
# -*-perl-*-
|
|
|
|
|
|
|
|
$description = "Test proper handling of SHELL.";
|
|
|
|
|
|
|
|
# Find the default value when SHELL is not set. On UNIX it will be /bin/sh,
|
|
|
|
# but on other platforms who knows?
|
2005-07-12 04:35:13 +00:00
|
|
|
resetENV();
|
2004-11-28 23:11:23 +00:00
|
|
|
delete $ENV{SHELL};
|
2005-07-04 03:50:59 +00:00
|
|
|
$mshell = `echo 'all:;\@echo \$(SHELL)' | $make_path -f-`;
|
2004-11-28 23:11:23 +00:00
|
|
|
chop $mshell;
|
|
|
|
|
|
|
|
# According to POSIX, the value of SHELL in the environment has no impact on
|
|
|
|
# the value in the makefile.
|
2005-07-12 04:35:13 +00:00
|
|
|
# Note %extraENV takes precedence over the default value for the shell.
|
2004-11-28 23:11:23 +00:00
|
|
|
|
2005-07-12 04:35:13 +00:00
|
|
|
$extraENV{SHELL} = '/dev/null';
|
2004-11-28 23:11:23 +00:00
|
|
|
run_make_test('all:;@echo "$(SHELL)"', '', $mshell);
|
|
|
|
|
|
|
|
# According to POSIX, any value of SHELL set in the makefile should _NOT_ be
|
|
|
|
# exported to the subshell! I wanted to set SHELL to be $^X (perl) in the
|
|
|
|
# makefile, but make runs $(SHELL) -c 'commandline' and that doesn't work at
|
2005-08-25 04:40:10 +00:00
|
|
|
# all when $(SHELL) is perl :-/. So, we just add an extra initial /./ which
|
|
|
|
# works well on UNIX and seems to work OK on at least some non-UNIX systems.
|
2004-11-28 23:11:23 +00:00
|
|
|
|
2005-07-12 04:35:13 +00:00
|
|
|
$extraENV{SHELL} = $mshell;
|
2004-11-28 23:11:23 +00:00
|
|
|
|
2005-08-25 04:40:10 +00:00
|
|
|
run_make_test("SHELL := /./$mshell\n".'
|
2004-11-28 23:11:23 +00:00
|
|
|
all:;@echo "$(SHELL) $$SHELL"
|
2005-08-25 04:40:10 +00:00
|
|
|
', '', "/./$mshell $mshell");
|
2004-11-28 23:11:23 +00:00
|
|
|
|
|
|
|
# As a GNU make extension, if make's SHELL variable is explicitly exported,
|
|
|
|
# then we really _DO_ export it.
|
|
|
|
|
2005-07-12 04:35:13 +00:00
|
|
|
$extraENV{SHELL} = $mshell;
|
|
|
|
|
2005-08-25 04:40:10 +00:00
|
|
|
run_make_test("export SHELL := /./$mshell\n".'
|
2004-11-28 23:11:23 +00:00
|
|
|
all:;@echo "$(SHELL) $$SHELL"
|
2005-08-25 04:40:10 +00:00
|
|
|
', '', "/./$mshell /./$mshell");
|
2004-11-28 23:11:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Test out setting of SHELL, both exported and not, as a target-specific
|
|
|
|
# variable.
|
|
|
|
|
2005-07-12 04:35:13 +00:00
|
|
|
$extraENV{SHELL} = $mshell;
|
|
|
|
|
2005-08-25 04:40:10 +00:00
|
|
|
run_make_test("all: SHELL := /./$mshell\n".'
|
2004-11-28 23:11:23 +00:00
|
|
|
all:;@echo "$(SHELL) $$SHELL"
|
2005-08-25 04:40:10 +00:00
|
|
|
', '', "/./$mshell $mshell");
|
2004-11-28 23:11:23 +00:00
|
|
|
|
2005-07-12 04:35:13 +00:00
|
|
|
$extraENV{SHELL} = $mshell;
|
|
|
|
|
2009-06-06 23:16:46 +00:00
|
|
|
run_make_test("
|
|
|
|
SHELL := /././$mshell
|
|
|
|
one: two
|
|
|
|
two: export SHELL := /./$mshell\n".'
|
|
|
|
one two:;@echo "$@: $(SHELL) $$SHELL"
|
|
|
|
', '', "two: /./$mshell /./$mshell\none: /././$mshell $mshell\n");
|
2004-11-28 23:11:23 +00:00
|
|
|
|
|
|
|
1;
|