Subject: Re: make: .if exists weirdness
To: None <tech-pkg@netbsd.org>
From: Luke Mewburn <lukem@NetBSD.org>
List: tech-pkg
Date: 07/12/2003 10:42:48
On Fri, Jul 11, 2003 at 05:57:24PM -0400, Jan Schaumann wrote:
  | Hi,
  | 
  | I seem to experience some particular weirdness wrt make(1)'s idea of
  | when a file exists or not:
  | 
  | In a Makefile:
  | 
  | FILE1=  ${PREFIX}/lib/libGL.so.5
  | FILE2=  /usr/pkg/lib/libGL.so.5
  | .if exists(${FILE1})
  | BAR=    blah     
  | .endif
  | .if exists(${FILE2})
  | BLAH=   blah
  | .endif


try
	FILE1:=	${PREFIX}/lib/libGL.so.5
instead


  | Now, we would assume that, given that /usr/pkg/lib/libGL.so.5 exists,
  | and that PREFIX is indeed /usr/pkg (ie FILE1 == FILE2 and exists) both
  | BAR and BLAH should be set, right?
  | 
  | Behold:
  | 
  | red-stripe# make show-var VARNAME=BAR
  | 
  | red-stripe# make show-var VARNAME=BLAH
  | blah
  | red-stripe# 
  | 
  | 
  | Now let's change /usr/pkg/lib/libGL.so.5 to /usr/pkg/lib/libGL.so (and
  | FILE1 accordingly), and we get:
  | 
  | red-stripe# !119
  | make show-var VARNAME=BAR
  | blah
  | red-stripe# !120
  | make show-var VARNAME=BLAH
  | blah
  | red-stripe# 

in this case, does
	/lib/libGL.so.5
exist as a file or symlink?


  | Ok, now change libGL.so to libGL.so.5.501:
  | 
  | red-stripe# !119
  | make show-var VARNAME=BAR
  | 
  | red-stripe# !120
  | make show-var VARNAME=BLAH
  | blah
  | red-stripe# 
  | 
  | Now change /usr/pkg/lib/libGL.so to /usr/pkg/include/GL/gl.h:
  | 
  | red-stripe# !119
  | make show-var VARNAME=BAR
  | blah
  | red-stripe# !120
  | make show-var VARNAME=BLAH
  | blah
  | red-stripe# 
  | 
  | 
  | This does not make any sense to me.  Note that libGL.so and libGL.so.5
  | are symlinks, libGL.so.5.501 the actual file. 
  | 
  | What's up with this - anybody have any idea?



luke.