make-alpha
[Top][All Lists]
Advanced

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

Re: 3.83 testing


From: Boris Kolpackov
Subject: Re: 3.83 testing
Date: Sun, 20 Nov 2011 21:09:59 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

Hi Paul,

Paul D. Smith <address@hidden> writes:

> On Thu, 2011-10-06 at 09:40 +0200, Boris Kolpackov wrote:
> > 1. Change of behavior compared to 3.82 and earlier:
> > 
> > This makefile:
> > all: v := foo bar \
> > baz
> > all:; @echo "[$v]"
> > 
> > With 3.83 prints:
> > [foo bar  baz]
> > 
> > And with 3.82:
> > [foo bar baz]
> > 
> > I.e., there is now an extra space introduced by the new line escaping.
> 
> This behavior is required by POSIX:
> 
>         When an escaped <newline> (one preceded by a <backslash>) is
>         found anywhere in the makefile except in a command line, an
>         include line, or a line immediately preceding an include line,
>         it shall be replaced, along with any leading white space on the
>         following line, with a single <space>.

I see. I guess this is now consistent with how newline escaping works
in function call and which makes writing long functions a real pain
in the butt. Consider:

define foo
foo $1
endef

define bar
bar $1
endef

v := $(if $(filter x,$x),$(call foo,foo),$(call bar,bar))

all:; @echo "[$v]"

This prints either [foo foo] or [bar bar] depending on $x. Imagine
that the $(if ) expression is very long and doesn't fit into an 80
char line. So we would like to break it up to make it more readable.
This is actually trickier than one may initially think. The natural
way is to put the condition, the then-block, and the else-block 
each on a seperate line:

v := $(if $(filter x,$x),\
$(call foo,foo),\
$(call bar,bar))

This, however, will change what this makefile prints to [ foo foo]
and [ bar bar]. To retain the original semantics one must place new
lines at "strategic" points where they don't matter:

v := $(if $(filter \
x,$x),$(call \
foo,foo),$(call \
bar,bar))

The result is an unreadable mess.

Don't you think that having a way to switch make to the sane newline
handling from the POSIXly-correct one would be useful? Something like
a special target in the Makefile? I could definitely use such an
option.


> > make: INTERNAL: Exiting with 3 jobserver tokens (should be 0)!
> > make: INTERNAL: Exiting with 14 jobserver tokens available; should be 16!
> 
> I made a change that might help.  If you can reproduce this with the
> latest CVS please let me know (and if you can dig into it at all that
> would be great).

Ok, I got the latest CVS code and will monitor this.


> > make[1]: Leaving directory
> > `/home/boris/work/odb/tests-pgsql/common/readonly'
> > �P�:35: recipe for target `_all' failed
> 
> If you can repro this please dig a bit and see if you can
> figure it out.

Ok, I will try to find time to do this.

Boris

-- 
Boris Kolpackov, Code Synthesis      http://codesynthesis.com/~boris/blog
Compiler-based ORM system for C++    http://codesynthesis.com/products/odb



reply via email to

[Prev in Thread] Current Thread [Next in Thread]