Skip site navigation (1)Skip section navigation (2)
Date:      12 Mar 2002 00:55:25 +0200
From:      Maxim Sobolev <sobomax@FreeBSD.org>
To:        Ernst de Haan <znerd@FreeBSD.org>
Cc:        ports@FreeBSD.org
Subject:   Re: .for woes
Message-ID:  <1015887321.1763.42.camel@notebook>
In-Reply-To: <02031123024601.00964@heinz>
References:  <02031123024601.00964@heinz>

next in thread | previous in thread | raw e-mail | index | archive | help

--=-6h6zXhjxz1yCcGJVqSiV
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Tue, 2002-03-12 at 00:02, Ernst de Haan wrote:
> Hi,
>=20
> I'm noticing some weird behaviour. This is my test Makefile:
>=20
>    PORTNAME=3D       testport
>    PORTVERSION=3D    1
>    FILES:=3D ${FILESDIR}/a \
>                    ${FILESDIR}/b
>    CATEGORIES=3D     #
> =20
>    DISTFILES=3D      #
>    EXTRACT_ONLY=3D   #
> =20
>    do-build:
>            @${ECHO_CMD} "Files: ${FILES}"
>    .for f in ${FILES}
>            @${ECHO_CMD}  "File $f..."
>    .endfor
> =20
>    .include <bsd.port.mk>
>=20
> Surprisingly, the result of running 'make' is:
>=20
>    =3D=3D=3D>  Extracting for testport-1
>    =3D=3D=3D>  Patching for testport-1
>    =3D=3D=3D>  Configuring for testport-1
>    =3D=3D=3D>  Building for testport-1
>    Files: /usr/home/ernst/testport/files/a  /usr/home/ernst/testport/file=
s/b
>    File /a...
>    File /b...
>=20
> How do I get the full file names within the .for ?

That because expansion of the variable ${FOO} in the `.for bar in
${FOO}' statement is performed immediately at the time of parsing, while
expansion of all other variables is deferred until they are actually
used in target. Since in your case ${FILESDIR} isn't defined when
make(1) parses .for statement it expands to "". To make your snippet
working you can use one of the following two ways:

1. Include <bsd.port.pre.mk> before .for statement and use `=3D' instead
of `:=3D' to assign value to ${FILES};

2. Rewrite the code to be:

FILES=3D foo bar
[...]
do-build:
[...]
.for f in ${FILES}
	@${ECHO_CMD}  "File ${FILESDIR}/$f..."
.endfor

-Maxim


--=-6h6zXhjxz1yCcGJVqSiV
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (FreeBSD)
Comment: For info see http://www.gnupg.org

iD8DBQA8jTXYoNu5t4iCBa8RArr2AJ0WBlkBF4fUmiwarjlDlRqLacfXxACfR9r5
buOYmSRkav7UAeBNUZ6vr14=
=MXGw
-----END PGP SIGNATURE-----

--=-6h6zXhjxz1yCcGJVqSiV--



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1015887321.1763.42.camel>