Subject: bin/5116: Odd conditional/escaping behavior in make
To: None <>
From: David Holland <>
List: netbsd-bugs
Date: 03/04/1998 16:00:05
>Number:         5116
>Category:       bin
>Synopsis:       Odd conditional/escaping behavior in make
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Mar  4 13:20:01 1998
>Originator:     David A. Holland <>
   - David A. Holland             |    VINO project home page:    |
>Release:        1.2.1
System: NetBSD 1.2.1 NetBSD 1.2.1 (CHIANTI) #1: Tue Sep 9 16:52:39 EDT 1997 i386

This also occurs in a -current I have from last April 10 (I know, that's
not much help.)

	The parsing of makefiles seems to depend in this particular 
	case on the truth of an earlier enclosing conditional. 
	Specifically, an .endif seems to evaporate under the given
	circumstances when embedded in the non-evaluating branch of
	another conditional, thus leading to a mistaken claim of an
	unclosed conditional.
	Take the following makefile and run it both with and without
	a file CONFIG present in the current directory. It fails with
	a parse error only if CONFIG is not present.


.if !exists(CONFIG)
	@echo no config


.if ($(SWITCH)==0)
SOMEVAR= bbb \
SOMEVAR= aaa \
	aaa \


	@echo $(SOMEVAR)

	The problem may be worked around by omitting the trailing slash
	on the second "aaa \". Inserting an additional blank line before
	the first .endif also seems to make it go away.

	I don't have a real fix.