summaryrefslogtreecommitdiff
path: root/tests/scripts
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2002-05-10 03:15:07 +0000
committerPaul Smith <psmith@gnu.org>2002-05-10 03:15:07 +0000
commit9052b52dfc69d9567e2e664b0f096bfae535bcad (patch)
tree39e24d1a4d38996e5ffc42601d98d5b47289ee3f /tests/scripts
parent5dedf7be638113e65df4bab535386db212a0e812 (diff)
downloadgunmake-9052b52dfc69d9567e2e664b0f096bfae535bcad.tar.gz
Fix Debian bug #144306: pass target-specific variables into the environment
properly. Fix configure: allow cross-compilation; fix getloadavg (still needs _lots_ of work!) Let $(call ...) functions to be self-referencing. Lets us do transitive closures, for example.
Diffstat (limited to 'tests/scripts')
-rw-r--r--tests/scripts/functions/call16
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/scripts/functions/call b/tests/scripts/functions/call
index bdb8e89..a8834cd 100644
--- a/tests/scripts/functions/call
+++ b/tests/scripts/functions/call
@@ -31,6 +31,15 @@ my-if = $(if $(1),$(2),$(3))
one = $(1) $(2) $(3)
two = $(call one,$(1),foo,$(2))
+# Test recursion on the user-defined function. As a special case make
+# won't error due to this.
+# Implement transitive closure using $(call ...)
+#
+DEP_foo = bar baz quux
+DEP_baz = quux blarp
+rest = $(wordlist 2,$(words ${1}),${1})
+tclose = $(if $1,$(firstword $1) \
+ $(call tclose,$(sort ${DEP_$(firstword $1)} $(call rest,$1))))
all: ; @echo '$(call reverse,bar,foo)'; \
echo '$(call map,origin,MAKE reverse map)'; \
@@ -38,7 +47,10 @@ all: ; @echo '$(call reverse,bar,foo)'; \
echo '$(call my-foreach)'; \
echo '$(call my-foreach,a,,,)'; \
echo '$(call my-if,a,b,c)'; \
- echo '$(call two,bar,baz)'
+ echo '$(call two,bar,baz)'; \
+ echo '$(call tclose,foo)'
+
+
EOMAKE
@@ -53,7 +65,7 @@ EOMAKE
close(MAKEFILE);
&run_make_with_options($makefile, "", &get_logfile);
-$answer = "foo bar\ndefault file file\nb d f\n\n\nb\nbar foo baz\n";
+$answer = "foo bar\ndefault file file\nb d f\n\n\nb\nbar foo baz\nfoo bar baz blarp quux \n";
&compare_output($answer, &get_logfile(1));