Subject: Re: BSD make question
To: Pavel Arno?t <pavel.arnost@clnet.cz>
From: Luke Mewburn <lukem@NetBSD.org>
List: netbsd-help
Date: 09/10/2003 04:08:53
On Mon, Sep 08, 2003 at 05:34:05PM +0200, Pavel Arno?t wrote:
| hi,
|
| pls, why this BSD makefile snippet doesn't work?
|
| ARRAY= member1 member2 member3
|
| .for member in ${ARRAY}
| . if ${member} == "member1"
| . endif
| .endfor
|
| it says:
|
| bmake: "/usr/pkgsrc/wip/mc/Makefile" line 1: Malformed conditional
| (member1 == "member1")
| bmake: "/usr/pkgsrc/wip/mc/Makefile" line 1: Need an operator
| bmake: "/usr/pkgsrc/wip/mc/Makefile" line 2: if-less endif
| bmake: "/usr/pkgsrc/wip/mc/Makefile" line 2: Need an operator
Welcome to one of those annoying make "features".
Try this instead:
.for member in ${ARRAY}
__member:=${member}
.if ${__member} == "member1"
#
# do your thing
#
# note: use ${member} here in variable assignment
# e.g., FOO+= ${member}
#
.endif
.endfor
Luke.