Subject: Makefile targets and variables
To: None <tech-pkg@netbsd.org>
From: Mike M. Volokhov <mishka@terabyte.com.ua>
List: tech-pkg
Date: 09/08/2003 17:28:08
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 extract
===> Checking for vulnerabilities in foo-1.0
=> Checksum OK for foo-1.0.tar.gz.
===> Extracting for foo-1.0
echo "false"
false
/bin/ls -l /usr/pkgsrc/wip/foo/work/foo-1.0/some-file
-rwxr-xr-x  1 mishka  users  647 Jan  6  2003 
/usr/pkgsrc/wip/foo/work/foo-1.0/some-file
%

It looks strange for me. Running "make -d d extract" shows
the following out:

% make -d d extract |& grep 'some-file'
Searching for /some-file...failed. Trying exact path 
matches.../usr/pkgsrc/wip/foo...failed. Looking for "/some-file"...failed. 
Returning NULL
Searching for /some-file...failed. Trying exact path 
matches.../usr/pkgsrc/wip/foo...failed. Looking for "/some-file"...failed. 
Returning NULL
Searching for /some-file...failed. Trying exact path 
matches.../usr/pkgsrc/wip/foo...failed. Looking for "/some-file"...failed. 
Returning NULL

Any ideas?

--
Mishka