
reverse=$(if $(wordlist 2,2,$(1)),$(call reverse,$(wordlist 2,$(words $(1)),$(1))) $(firstword $(1)),$(1))

__EMPTY:=
__SPACE:=$(__EMPTY) $(__EMPTY)

define __NL


endef

filter2=$(foreach v,$(2),$(if $(findstring $(1),$(v)),$(v),))
filter-out2=$(foreach v,$(2),$(if $(findstring $(1),$(v)),,$(v)))

uniq=$(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1)))

flatten=$(filter %,$(subst $(__NL), ,$1))

tolower=$(shell echo "$1" | tr '[:upper:]' '[:lower:]')
toupper=$(shell echo "$1" | tr '[:lower:]' '[:upper:]')

files_missing=$(strip $(foreach f,$(1),$(shell test -e "${f}" || echo "${f}";)))

cached-shell=$(eval $1:=$(shell $2))$($1)

