2012-06-06 16:24:31 +02:00
|
|
|
# $Id: modmisc,v 1.7 2011/04/11 15:10:15 sjg Exp $
|
2010-02-04 17:52:54 +01:00
|
|
|
#
|
|
|
|
# miscellaneous modifier tests
|
|
|
|
|
2012-06-06 16:24:31 +02:00
|
|
|
# do not put any dirs in this list which exist on some
|
|
|
|
# but not all target systems - an exists() check is below.
|
|
|
|
path=:/bin:/tmp::/:.:/no/such/dir:.
|
2010-02-04 17:52:54 +01:00
|
|
|
# strip cwd from path.
|
|
|
|
MOD_NODOT=S/:/ /g:N.:ts:
|
|
|
|
# and decorate, note that $'s need to be doubled. Also note that
|
|
|
|
# the modifier_variable can be used with other modifiers.
|
|
|
|
MOD_NODOTX=S/:/ /g:N.:@d@'$$d'@
|
|
|
|
# another mod - pretend it is more interesting
|
|
|
|
MOD_HOMES=S,/home/,/homes/,
|
|
|
|
MOD_OPT=@d@$${exists($$d):?$$d:$${d:S,/usr,/opt,}}@
|
|
|
|
MOD_SEP=S,:, ,g
|
|
|
|
|
2012-06-06 16:24:31 +02:00
|
|
|
all: modvar modvarloop modsysv
|
|
|
|
|
|
|
|
modsysv:
|
|
|
|
@echo "The answer is ${libfoo.a:L:libfoo.a=42}"
|
2010-02-04 17:52:54 +01:00
|
|
|
|
|
|
|
modvar:
|
|
|
|
@echo "path='${path}'"
|
|
|
|
@echo "path='${path:${MOD_NODOT}}'"
|
|
|
|
@echo "path='${path:S,home,homes,:${MOD_NODOT}}'"
|
|
|
|
@echo "path=${path:${MOD_NODOTX}:ts:}"
|
|
|
|
@echo "path=${path:${MOD_HOMES}:${MOD_NODOTX}:ts:}"
|
|
|
|
|
|
|
|
.for d in ${path:${MOD_SEP}:N.} /usr/xbin
|
|
|
|
path_$d?= ${d:${MOD_OPT}:${MOD_HOMES}}/
|
|
|
|
paths+= ${d:${MOD_OPT}:${MOD_HOMES}}
|
|
|
|
.endfor
|
|
|
|
|
|
|
|
modvarloop:
|
|
|
|
@echo "path_/usr/xbin=${path_/usr/xbin}"
|
|
|
|
@echo "paths=${paths}"
|
|
|
|
@echo "PATHS=${paths:tu}"
|