modmisc.mk revision 1.1 1 1.1 apb # $Id: modmisc.mk,v 1.1 2014/08/21 13:44:51 apb Exp $
2 1.1 apb #
3 1.1 apb # miscellaneous modifier tests
4 1.1 apb
5 1.1 apb # do not put any dirs in this list which exist on some
6 1.1 apb # but not all target systems - an exists() check is below.
7 1.1 apb path=:/bin:/tmp::/:.:/no/such/dir:.
8 1.1 apb # strip cwd from path.
9 1.1 apb MOD_NODOT=S/:/ /g:N.:ts:
10 1.1 apb # and decorate, note that $'s need to be doubled. Also note that
11 1.1 apb # the modifier_variable can be used with other modifiers.
12 1.1 apb MOD_NODOTX=S/:/ /g:N.:@d@'$$d'@
13 1.1 apb # another mod - pretend it is more interesting
14 1.1 apb MOD_HOMES=S,/home/,/homes/,
15 1.1 apb MOD_OPT=@d@$${exists($$d):?$$d:$${d:S,/usr,/opt,}}@
16 1.1 apb MOD_SEP=S,:, ,g
17 1.1 apb
18 1.1 apb all: modvar modvarloop modsysv
19 1.1 apb
20 1.1 apb modsysv:
21 1.1 apb @echo "The answer is ${libfoo.a:L:libfoo.a=42}"
22 1.1 apb
23 1.1 apb modvar:
24 1.1 apb @echo "path='${path}'"
25 1.1 apb @echo "path='${path:${MOD_NODOT}}'"
26 1.1 apb @echo "path='${path:S,home,homes,:${MOD_NODOT}}'"
27 1.1 apb @echo "path=${path:${MOD_NODOTX}:ts:}"
28 1.1 apb @echo "path=${path:${MOD_HOMES}:${MOD_NODOTX}:ts:}"
29 1.1 apb
30 1.1 apb .for d in ${path:${MOD_SEP}:N.} /usr/xbin
31 1.1 apb path_$d?= ${d:${MOD_OPT}:${MOD_HOMES}}/
32 1.1 apb paths+= ${d:${MOD_OPT}:${MOD_HOMES}}
33 1.1 apb .endfor
34 1.1 apb
35 1.1 apb modvarloop:
36 1.1 apb @echo "path_/usr/xbin=${path_/usr/xbin}"
37 1.1 apb @echo "paths=${paths}"
38 1.1 apb @echo "PATHS=${paths:tu}"
39