Subject: Re: Makefile targets and variables
To: Mike M. Volokhov <mishka@terabyte.com.ua>
From: Julio M. Merino Vidal <jmmv@menta.net>
List: tech-pkg
Date: 09/08/2003 16:41:01
On Mon, 08 Sep 2003 17:28:08 +0300
"Mike M. Volokhov" <mishka@terabyte.com.ua> wrote:

> Greetings!
> 
> I'm faced within problem, when some variable doesn't defined
> yet when make(1) doing some target, but commands passed to
> sh(1) have this variables defined.
> 
> Lets follow some example:
> ---- cut ---
> post-extract:
> .if exists(${WRKSRC}/some-file)
>          echo "true"
>          ${LS} -l ${WRKSRC}/some-file
> .else
>          echo "false"
>          ${LS} -l ${WRKSRC}/some-file
> .endif
> ---- cut ---

make evaluates expressions while the file is beeing read.  If the variable
is not defined at that point (which happens with WRKSRC, which is defined by
bsd.pkg.mk), then its value will be unset, and this is why make tries to
locate /some-file.

Cheers

-- 
Julio M. Merino Vidal <jmmv@menta.net>
The NetBSD Project - http://www.NetBSD.org/