From 9052b52dfc69d9567e2e664b0f096bfae535bcad Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Fri, 10 May 2002 03:15:07 +0000 Subject: 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. --- tests/scripts/functions/call | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'tests/scripts/functions/call') 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)); -- cgit v1.2.3