summaryrefslogtreecommitdiff
path: root/tests/scripts/options/dash-r
diff options
context:
space:
mode:
Diffstat (limited to 'tests/scripts/options/dash-r')
-rw-r--r--tests/scripts/options/dash-r63
1 files changed, 61 insertions, 2 deletions
diff --git a/tests/scripts/options/dash-r b/tests/scripts/options/dash-r
index 7157f715..16eda104 100644
--- a/tests/scripts/options/dash-r
+++ b/tests/scripts/options/dash-r
@@ -2,8 +2,6 @@
$description = "Test removing default rules and variables";
-$details = "DETAILS";
-
touch('xxx.c');
# Simple check
@@ -41,4 +39,65 @@ MAKEFLAGS := -R
all: hello.o
!, '', "#MAKE#: *** No rule to make target 'hello.o', needed by 'all'. Stop.", 512);
+my @flavors = ('=', ':=', ':::=', '+=');
+
+# sv 64107.
+
+# Use $answer to test that -R in the makefile has the same effect as -R on the
+# command line.
+
+my $answer = "at parse time TEX=\nat build time TEX=\n#MAKE#: 'all' is up to date.\n";
+
+# Subtest 1.
+# First run with -R command line switch.
+
+for my $fl (@flavors) {
+run_make_test("
+\$(info at parse time TEX=\$(TEX))
+all:; \$(info at build time TEX=\$(TEX))
+", '-R', "$answer");
+}
+
+# Subtest 2.
+# Set -R in the makefile.
+# Also, test that setting -R in MAKEFLAGS takes effect immediately.
+
+for my $fl (@flavors) {
+run_make_test("
+\$(info at start time TEX=\$(TEX))
+MAKEFLAGS ${fl} -R
+\$(info at parse time TEX=\$(TEX))
+all:; \$(info at build time TEX=\$(TEX))
+", '', "at start time TEX=tex\n$answer");
+}
+
+# Same as above, but also set TEX conditionally.
+
+$answer = "at parse time TEX=hello\nat build time TEX=hello\n#MAKE#: 'all' is up to date.\n";
+
+# Subtest 3.
+# -R on the command line.
+
+for my $fl (@flavors) {
+run_make_test("
+TEX ?= hello
+\$(info at parse time TEX=\$(TEX))
+all:; \$(info at build time TEX=\$(TEX))
+", '-R', "$answer");
+}
+
+# Subtest 4.
+# -R in the makefile.
+
+for my $fl (@flavors) {
+run_make_test("
+\$(info at start time TEX=\$(TEX))
+MAKEFLAGS ${fl} -R
+TEX ?= hello
+\$(info at parse time TEX=\$(TEX))
+all:; \$(info at build time TEX=\$(TEX))
+", '', "at start time TEX=tex\n$answer");
+}
+
+
1;