mirror of
https://github.com/mirror/make.git
synced 2026-08-31 03:38:03 +08:00
- Enhance .POSIX to set -e when invoking shells, as demanded by a
backward-incompatible change in the 2008 POSIX specification. - Add the .SHELLFLAGS variable so people can choose their own shell flags. - Add tests for this. - Add documentation for this.
This commit is contained in:
26
tests/scripts/targets/POSIX
Normal file
26
tests/scripts/targets/POSIX
Normal file
@@ -0,0 +1,26 @@
|
||||
# -*-perl-*-
|
||||
|
||||
$description = "Test the behaviour of the .PHONY target.";
|
||||
|
||||
$details = "";
|
||||
|
||||
|
||||
# Ensure turning on .POSIX enables the -e flag for the shell
|
||||
|
||||
run_make_test(q!
|
||||
.POSIX:
|
||||
all: ; @false; true
|
||||
!,
|
||||
'', "#MAKE#: *** [all] Error 1\n", 512);
|
||||
|
||||
# User settings must override .POSIX
|
||||
|
||||
run_make_test(q!
|
||||
.SHELLFLAGS = -xc
|
||||
.POSIX:
|
||||
all: ; @false; true
|
||||
!,
|
||||
'', "+ false\n+ true\n");
|
||||
|
||||
# This tells the test driver that the perl test script executed properly.
|
||||
1;
|
||||
@@ -56,4 +56,18 @@ two: export SHELL := /./$mshell\n".'
|
||||
one two:;@echo "$@: $(SHELL) $$SHELL"
|
||||
', '', "two: /./$mshell /./$mshell\none: /././$mshell $mshell\n");
|
||||
|
||||
# Test .SHELLFLAGS
|
||||
|
||||
run_make_test(q!
|
||||
.SHELLFLAGS = -xc
|
||||
all: ; @true
|
||||
!,
|
||||
'', "+ true\n");
|
||||
|
||||
run_make_test(q!
|
||||
.SHELLFLAGS = -xec
|
||||
all: ; @true; false; true
|
||||
!,
|
||||
'', "+ true\n+ false\n#MAKE#: *** [all] Error 1\n", 512);
|
||||
|
||||
1;
|
||||
|
||||
Reference in New Issue
Block a user