Merge illumos-gate
[unleashed.git] / bin / make / unit-tests / forloop.mk
blob9aad7c6b998abb8fed8499cf1e048e57a62e333f
1 # $Id: forloop.mk,v 1.1.1.1 2014/08/30 18:57:18 sjg Exp $
3 all: for-loop
5 LIST = one "two and three" four "five"
7 .if make(for-fail)
8 for-fail:
10 XTRA_LIST = xtra
11 .else
13 .for x in ${LIST}
14 X!= echo 'x=$x' >&2; echo
15 .endfor
17 CFL = -I/this -I"This or that" -Ithat "-DTHIS=\"this and that\""
18 cfl=
19 .for x in ${CFL}
20 X!= echo 'x=$x' >&2; echo
21 .if empty(cfl)
22 cfl= $x
23 .else
24 cfl+= $x
25 .endif
26 .endfor
27 X!= echo 'cfl=${cfl}' >&2; echo
29 .if ${cfl} != ${CFL}
30 .error ${.newline}'${cfl}' != ${.newline}'${CFL}'
31 .endif
33 .for a b in ${EMPTY}
34 X!= echo 'a=$a b=$b' >&2; echo
35 .endfor
36 .endif
38 .for a b in ${LIST} ${LIST:tu} ${XTRA_LIST}
39 X!= echo 'a=$a b=$b' >&2; echo
40 .endfor
42 for-loop:
43 @echo We expect an error next:
44 @(cd ${.CURDIR} && ${.MAKE} -f ${MAKEFILE} for-fail) && \
45 { echo "Oops that should have failed!"; exit 1; } || echo OK