1237578Sobrien# $Id: forloop,v 1.1.1.1 2012/06/19 23:30:49 sjg Exp $
2237578Sobrien
3237578Sobrienall: for-loop
4237578Sobrien
5237578SobrienLIST = one "two and three" four "five"
6237578Sobrien
7237578Sobrien.if make(for-fail)
8237578Sobrienfor-fail:
9237578Sobrien
10237578SobrienXTRA_LIST = xtra
11237578Sobrien.else
12237578Sobrien
13237578Sobrien.for x in ${LIST}
14237578SobrienX!= echo 'x=$x' >&2; echo
15237578Sobrien.endfor
16237578Sobrien
17237578SobrienCFL = -I/this -I"This or that" -Ithat "-DTHIS=\"this and that\""
18237578Sobriencfl=
19237578Sobrien.for x in ${CFL}
20237578SobrienX!= echo 'x=$x' >&2; echo
21237578Sobrien.if empty(cfl)
22237578Sobriencfl= $x
23237578Sobrien.else
24237578Sobriencfl+= $x
25237578Sobrien.endif
26237578Sobrien.endfor
27237578SobrienX!= echo 'cfl=${cfl}' >&2; echo
28237578Sobrien
29237578Sobrien.if ${cfl} != ${CFL}
30237578Sobrien.error ${.newline}'${cfl}' != ${.newline}'${CFL}'
31237578Sobrien.endif
32237578Sobrien
33237578Sobrien.for a b in ${EMPTY}
34237578SobrienX!= echo 'a=$a b=$b' >&2; echo
35237578Sobrien.endfor
36237578Sobrien.endif
37237578Sobrien
38237578Sobrien.for a b in ${LIST} ${LIST:tu} ${XTRA_LIST}
39237578SobrienX!= echo 'a=$a b=$b' >&2; echo
40237578Sobrien.endfor
41237578Sobrien
42237578Sobrienfor-loop:
43237578Sobrien	@echo We expect an error next:
44237578Sobrien	@(cd ${.CURDIR} && ${.MAKE} -f ${MAKEFILE} for-fail) && \
45237578Sobrien	{ echo "Oops that should have failed!"; exit 1; } || echo OK
46