Date: Mon, 29 Sep 1997 10:02:44 +0200 (IST) From: Eli Zaretskii To: Shawn Hargreaves cc: djgpp AT delorie DOT com Subject: Re: Make v3.76.1 bug? In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Sat, 27 Sep 1997, Shawn Hargreaves wrote: > The latest version of make seems to be doing some quite strange things > when conditional expressions are used to change the default target! This seems to be a subtle bug in Make that is not DOS-specific. The part that deals with reading the Makefile and figuring out what each line means is notoriously intertwined, and a change was done there in the last version. But I didn't have enough time to see what exactly triggers this bug. Anyway, it only takes a change as simple as removing the extra blank between "target1" and the colon, and your Makefile works: ifeq ($(VAL),1) target1: @echo this is target #1 endif This works for me (please see that it does for you also). (Personally, I'd advise against extra white space before the colon, since this part of Makefile syntax is extremely tricky. It is possible that I never saw this bug because I *NEVER* leave excess blanks before the colon.) And btw, why did you have to use this weird way of choosing between two targets? I think the following is much better: ifeq ($(VAL),1) target = target1 endif ifeq ($(VAL),2) target = target2 endif default: $(target) @echo Done. target1: @echo this is target 1 target2: @echo this is target 2 IMHO, conditionals in the middle of rules, or conditionals that make targets disappear, are dangerous. I'm not even sure whether non-GNU Make's support such a feature.