summaryrefslogtreecommitdiff
path: root/tests/scripts/variables/MAKE_RESTARTS
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2005-06-25 18:57:28 +0000
committerPaul Smith <psmith@gnu.org>2005-06-25 18:57:28 +0000
commit978819e1d6e9354b5b20d15c875bef98579873ae (patch)
treee601b286b4cd0ceb5cace61bea3d1bc6074480b3 /tests/scripts/variables/MAKE_RESTARTS
parent467115baae38eba41b3800b4e0e84afb7f3ec99b (diff)
downloadgunmake-978819e1d6e9354b5b20d15c875bef98579873ae.tar.gz
Add a new variable: MAKE_RESTARTS, to count how many times make has re-exec'd.
When rebuilding makefiles, unset -B if MAKE_RESTARTS is >0.
Diffstat (limited to 'tests/scripts/variables/MAKE_RESTARTS')
-rw-r--r--tests/scripts/variables/MAKE_RESTARTS62
1 files changed, 62 insertions, 0 deletions
diff --git a/tests/scripts/variables/MAKE_RESTARTS b/tests/scripts/variables/MAKE_RESTARTS
new file mode 100644
index 0000000..53ab738
--- /dev/null
+++ b/tests/scripts/variables/MAKE_RESTARTS
@@ -0,0 +1,62 @@
+# -*-perl-*-
+
+$description = "Test the MAKE_RESTARTS variable.";
+
+# Test basic capability
+
+run_make_test('
+all: ; @:
+$(info MAKE_RESTARTS=$(MAKE_RESTARTS))
+include foo.x
+foo.x: ; @touch $@
+',
+ '', 'MAKE_RESTARTS=
+#MAKEFILE#:4: foo.x: No such file or directory
+MAKE_RESTARTS=1');
+
+rmfiles('foo.x');
+
+# Test multiple restarts
+
+run_make_test('
+all: ; @:
+$(info MAKE_RESTARTS=$(MAKE_RESTARTS))
+include foo.x
+foo.x: ; @echo "include bar.x" > $@
+bar.x: ; @touch $@
+',
+ '', 'MAKE_RESTARTS=
+#MAKEFILE#:4: foo.x: No such file or directory
+MAKE_RESTARTS=1
+foo.x:1: bar.x: No such file or directory
+MAKE_RESTARTS=2');
+
+rmfiles('foo.x', 'bar.x');
+
+# Test multiple restarts and make sure the variable is cleaned up
+
+run_make_test('
+recurse:
+ @echo recurse MAKE_RESTARTS=$$MAKE_RESTARTS
+ @$(MAKE) -f #MAKEFILE# all
+all:
+ @echo all MAKE_RESTARTS=$$MAKE_RESTARTS
+$(info MAKE_RESTARTS=$(MAKE_RESTARTS))
+include foo.x
+foo.x: ; @echo "include bar.x" > $@
+bar.x: ; @touch $@
+',
+ '', "MAKE_RESTARTS=
+#MAKEFILE#:8: foo.x: No such file or directory
+MAKE_RESTARTS=1
+foo.x:1: bar.x: No such file or directory
+MAKE_RESTARTS=2
+recurse MAKE_RESTARTS=
+MAKE_RESTARTS=
+#MAKE#[1]: Entering directory `#PWD#'
+all MAKE_RESTARTS=
+#MAKE#[1]: Leaving directory `#PWD#'");
+
+rmfiles('foo.x', 'bar.x');
+
+1;