tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bmake: .if !empty(i:M[0-9]*)



I once again ran into an oddity with bmake's .for loops.
It looks like that .if !empty(i:Mxxx) doesn't work if i is a .for loop variable.
Assigning the loop variable to another var makes it work.
Oddly enough, .if !empty(:U123:Mxxx) (outside a .for loop) works as expected.

[I'm aware that [0-9]* will match "2nd"|


.for i in 123 abc 456
.info ${i} ${i:M[0-9]*}
.if !empty(i:M[0-9]*)
.info ${i}: num
.else
.info ${i}: alpha
.endif
i_:= ${i:M[0-9]*}
.if !empty(i_)
.info ${i}: _num
.else
.info ${i}: _alpha
.endif
.endfor

.if !empty(:U123:M[0-9]*)
.info num
.else
.info alpha
.endif

default:


bmake: "/tmp/x.mk" line 4: 123 123
bmake: "/tmp/x.mk" line 8: 123: alpha
bmake: "/tmp/x.mk" line 12: 123: _num
bmake: "/tmp/x.mk" line 4: abc 
bmake: "/tmp/x.mk" line 8: abc: alpha
bmake: "/tmp/x.mk" line 14: abc: _alpha
bmake: "/tmp/x.mk" line 4: 456 456
bmake: "/tmp/x.mk" line 8: 456: alpha
bmake: "/tmp/x.mk" line 12: 456: _num
bmake: "/tmp/x.mk" line 19: num


Do I have some stupid error in that?


Home | Main Index | Thread Index | Old Index