NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
bin/43669: another problem parsing conditionals in make
>Number: 43669
>Category: bin
>Synopsis: another problem parsing conditionals in make
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jul 26 07:50:00 +0000 2010
>Originator: David A. Holland
>Release: NetBSD 5.99.29 (make from today though)
>Organization:
>Environment:
System: NetBSD valkyrie 5.99.29 NetBSD 5.99.29 (VALKYRIE) #1: Sat May 29
23:00:44 EDT 2010 dholland@valkyrie:/usr/src/sys/arch/amd64/compile/VALKYRIE
amd64
Architecture: amd64
Machine: x86_64
>Description:
Make horks unexpectedly on some conditionals and not others that ought
to be entirely equivalent.
Consider the following two makefiles:
---- Makefile1 ----
moo:
.if defined(MOO) && !empty(MOO:Myes)
@echo moo
.else
@echo no moo
.endif
---- Makefile2 ----
moo:
.if defined(MOO) && !empty(MOO:Myes) && 1
@echo moo
.else
@echo no moo
.endif
---- (end) ----
and observe the following behavior:
valkyrie% make -f Makefile1 MOO=yes
moo
valkyrie% make -f Makefile1 MOO=no
no moo
valkyrie% make -f Makefile1 MOO=
no moo
valkyrie% make -f Makefile1
no moo
valkyrie% make -f Makefile2 MOO=yes
moo
valkyrie% make -f Makefile2 MOO=no
no moo
valkyrie% make -f Makefile2 MOO=
no moo
valkyrie% make -f Makefile2
make: "/tmp/test/Makefile2" line 2: Malformed conditional (defined(MOO) &&
!empty(MOO:Myes) && 1)
make: Fatal errors encountered -- cannot continue
make: stopped in /tmp/test
Exit 1
valkyrie%
I really can't think of any sane reason that make should accept the
conditional in Makefile1 when MOO isn't defined but not the form in
Makefile2.
For that matter, I can't think of any reason make should reject the
conditional in Makefile2; both defined(MOO) and !empty(MOO:Myes)
should yield false when MOO is undefined, not something like an empty
string that would legitimately upset make.
However, sanity isn't make's long suit. :-)
>How-To-Repeat:
as above
>Fix:
no idea.
(well, other than restructure the whole thing as I've proposed in the past)
Home |
Main Index |
Thread Index |
Old Index