mirror of
https://github.com/mirror/make.git
synced 2026-09-03 13:13:01 +08:00
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.
This commit is contained in:
@@ -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));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user