# Define general purpose functions. # Return non null string if the variable name is defined. # A = hello # $(call defined,A) # => file # $(call defined,B) # => defined = $(filter-out undefined,$(origin $1)) # Return $2 unless $1 is defined, in this case, return $($1). # $(call default,A,hello) # => hello # A = world # $(call default,A,hello) # => world default = $(if $(call defined,$1),$($1),$2) # Return $3 unless $2 is defined, in this case, return $($2), unless $1 is # defined, in this case, return $($1). # $(call default2,A,B,hello) # => hello # B = world # $(call default,A,B,hello) # => world # A = everybody # $(call default,A,B,hello) # => everybody default2 = $(if $(call defined,$1),$($1),$(if $(call defined,$2),$($2),$3)) # Return null string if lists are the same. # $(call list-neq,a b c,b a c) # => # $(call list-neq,a b c,a c) # => list-neq = $(strip $(filter-out $1,$2) $(filter-out $2,$1))