summaryrefslogtreecommitdiffstats
path: root/src/kmk/tests/scripts/features/recursion
diff options
context:
space:
mode:
Diffstat (limited to 'src/kmk/tests/scripts/features/recursion')
-rw-r--r--src/kmk/tests/scripts/features/recursion55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/kmk/tests/scripts/features/recursion b/src/kmk/tests/scripts/features/recursion
new file mode 100644
index 0000000..862b6c4
--- /dev/null
+++ b/src/kmk/tests/scripts/features/recursion
@@ -0,0 +1,55 @@
+# -*-perl-*-
+$description = "Test recursion.";
+
+$details = "DETAILS";
+
+# Test some basic recursion.
+run_make_test('
+all:
+ $(MAKE) -f #MAKEFILE# foo
+foo:
+ @echo $(MAKE)
+ @echo MAKELEVEL = $('. (!$is_kmk ? 'MAKELEVEL' : 'KMK_LEVEL') .')
+ $(MAKE) -f #MAKEFILE# last
+last:
+ @echo $(MAKE)
+ @echo MAKELEVEL = $('. (!$is_kmk ? 'MAKELEVEL' : 'KMK_LEVEL') .')
+ @echo THE END
+',
+ ('CFLAGS=-O -w' . ($parallel_jobs ? ' -j 2' : '')),
+ ($vos
+ ? "#MAKE#: Entering directory '#PWD#'
+make 'CFLAGS=-O' -f #MAKEFILE# foo
+make CFLAGS=-O
+MAKELEVEL = 0
+make 'CFLAGS=-O' -f #MAKEFILE# last
+make CFLAGS=-O
+MAKELEVEL = 0
+THE END
+#MAKE#: Leaving directory '#PWD#'"
+ : "#MAKE#: Entering directory '#PWD#'
+#MAKEPATH# -f #MAKEFILE# foo
+#MAKE#[1]: Entering directory '#PWD#'
+#MAKEPATH#
+MAKELEVEL = 1
+#MAKEPATH# -f #MAKEFILE# last
+#MAKE#[2]: Entering directory '#PWD#'
+#MAKEPATH#
+MAKELEVEL = 2
+THE END
+#MAKE#[2]: Leaving directory '#PWD#'
+#MAKE#[1]: Leaving directory '#PWD#'
+#MAKE#: Leaving directory '#PWD#'"));
+
+
+# Test command line overrides.
+run_make_test('
+recur: all ; @$(MAKE) --no-print-directory -f #MAKEFILE# a=AA all
+all: ; @echo "MAKEOVERRIDES = $('. (!$is_kmk ? 'MAKEOVERRIDES' : 'KMK_OVERRIDES') .')"
+',
+ 'a=ZZ',
+ 'MAKEOVERRIDES = a=ZZ
+MAKEOVERRIDES = a=AA
+');
+
+1;