| 1 | # -*-perl-*-
|
|---|
| 2 |
|
|---|
| 3 | $description = "Test proper handling of SHELL.";
|
|---|
| 4 |
|
|---|
| 5 | # Find the default value when SHELL is not set. On UNIX it will be /bin/sh,
|
|---|
| 6 | # but on other platforms who knows?
|
|---|
| 7 | $oshell = $ENV{SHELL};
|
|---|
| 8 | delete $ENV{SHELL};
|
|---|
| 9 | $mshell = `echo 'all:;\@echo \$(SHELL)' | $make_name -f-`;
|
|---|
| 10 | chop $mshell;
|
|---|
| 11 |
|
|---|
| 12 | # According to POSIX, the value of SHELL in the environment has no impact on
|
|---|
| 13 | # the value in the makefile.
|
|---|
| 14 |
|
|---|
| 15 | $ENV{SHELL} = '/dev/null';
|
|---|
| 16 | run_make_test('all:;@echo "$(SHELL)"', '', $mshell);
|
|---|
| 17 |
|
|---|
| 18 | # According to POSIX, any value of SHELL set in the makefile should _NOT_ be
|
|---|
| 19 | # exported to the subshell! I wanted to set SHELL to be $^X (perl) in the
|
|---|
| 20 | # makefile, but make runs $(SHELL) -c 'commandline' and that doesn't work at
|
|---|
| 21 | # all when $(SHELL) is perl :-/. So, we just add an extra initial / and hope
|
|---|
| 22 | # for the best on non-UNIX platforms :-/.
|
|---|
| 23 |
|
|---|
| 24 | $ENV{SHELL} = $mshell;
|
|---|
| 25 |
|
|---|
| 26 | run_make_test("SHELL := /$mshell\n".'
|
|---|
| 27 | all:;@echo "$(SHELL) $$SHELL"
|
|---|
| 28 | ', '', "/$mshell $mshell");
|
|---|
| 29 |
|
|---|
| 30 | # As a GNU make extension, if make's SHELL variable is explicitly exported,
|
|---|
| 31 | # then we really _DO_ export it.
|
|---|
| 32 |
|
|---|
| 33 | run_make_test("export SHELL := /$mshell\n".'
|
|---|
| 34 | all:;@echo "$(SHELL) $$SHELL"
|
|---|
| 35 | ', '', "/$mshell /$mshell");
|
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 | # Test out setting of SHELL, both exported and not, as a target-specific
|
|---|
| 39 | # variable.
|
|---|
| 40 |
|
|---|
| 41 | run_make_test("all: SHELL := /$mshell\n".'
|
|---|
| 42 | all:;@echo "$(SHELL) $$SHELL"
|
|---|
| 43 | ', '', "/$mshell $mshell");
|
|---|
| 44 |
|
|---|
| 45 | run_make_test("all: export SHELL := /$mshell\n".'
|
|---|
| 46 | all:;@echo "$(SHELL) $$SHELL"
|
|---|
| 47 | ', '', "/$mshell $mshell");
|
|---|
| 48 |
|
|---|
| 49 | 1;
|
|---|