tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: another make(1) .for loop problem



David Laight --> tech-userlevel (2009-01-27 18:47:25 +0000):
> On Tue, Jan 27, 2009 at 11:22:22AM +0100, Jukka Salmi wrote:
> > Hello,
> > 
> > on a 5.99.5 system with make(1) built from todays soures, the attached
> > makefile fails:
> > 
> > $ make
> > testing VAR0: not defined
> > *** Error code 1
> > [...]
> 
> The test is to try it without the .for loop...
> 
> I'm fairly sure that:
>     .ifndef $(var)
> is actually the test:
>     .if $(var) != ""
> not:
>     .if defined($(var))
> 
> The .for loop now behaves the same way.

Hmm, without a .for loop this gets even stranger (makefiles are attached):

$ make
a (containing 'x') is...
...defined
...not defined

But at least this is consistent with what older make(1) said, so I'm not
sure whether it's make or me who is confused ;-p

However, wrapping it inside a .foor loop shows the original problem:

$ make -f makefile.loop
a (containing 'x') is...
...defined
...not defined
b (containing '') is...
...defined
...not defined

$ make.netbsd-5 -f makefile.loop
a (containing 'x') is...
...defined
...defined
b (containing '') is...
...not defined
...not defined


Regards, Jukka

-- 
bashian roulette:
$ ((RANDOM%6)) || rm -rf ~
var = a
a   = x
test:
        @echo "$(var) (containing '$($(var))') is..."
.ifdef $(var)
        @echo '...defined'
.else
        @echo '...not defined'
.endif
.ifndef $(var)
        @echo '...not defined'
.else
        @echo '...defined'
.endif
vars = a b
a   = x
test:
.for var in $(vars)
        @echo "$(var) (containing '$($(var))') is..."
.ifdef $(var)
        @echo '...defined'
.else
        @echo '...not defined'
.endif
.ifndef $(var)
        @echo '...not defined'
.else
        @echo '...defined'
.endif
.endfor


Home | Main Index | Thread Index | Old Index