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