2 $description = "Test the call function.\n";
4 $details = "Try various uses of call and ensure they all give the correct
7 open(MAKEFILE, "> $makefile");
9 # The Contents of the MAKEFILE ...
11 print MAKEFILE <<'EOMAKE';
12 # Simple, just reverse two things
16 # A complex `map' function, using recursive `call'.
18 map = $(foreach a,$2,$(call $1,$a))
20 # Test using a builtin; this is silly as it's simpler to do without call
22 my-notdir = $(call notdir,$(1))
24 # Test using non-expanded builtins
26 my-foreach = $(foreach $(1),$(2),$(3))
27 my-if = $(if $(1),$(2),$(3))
29 all: ; @echo '$(call reverse,bar,foo)'; \
30 echo '$(call map,origin,MAKE reverse map)'; \
31 echo '$(call my-notdir,a/b c/d e/f)'; \
32 echo '$(call my-foreach)'; \
33 echo '$(call my-foreach,a,,,)'; \
34 echo '$(call my-foreach,a,x y z,$(a)$(a))'; \
35 echo '$(call my-if,a,b,c)'; \
36 echo '$(call my-if,,$(warning don't print this),ok)'
40 # END of Contents of MAKEFILE
44 &run_make_with_options($makefile, "", &get_logfile);
45 $answer = "foo bar\ndefault file file\nb d f\n\n\nxx yy zz\nb\nok\n";
46 &compare_output($answer, &get_logfile(1));