On Thu, May 20, 2010 at 11:58:29AM +0200, Joachim Schipper wrote:
> On Thu, May 20, 2010 at 11:11:51AM +0200, Joachim Schipper wrote:
> > Makefile:
> >
> > A=This is the variable A
> > FOO=$$A
> > BAR:=$$A
> >
> > test:
> > echo '${FOO}'
> > echo '${BAR}'
> >
> > I expected, and GNU make gives,
> >
> > echo '$A'
> > $A
> > echo '$A'
> > $A
> >
> > However, our make gives
> >
> > echo '$A'
> > $A
> > echo 'This is the variable A'
> > This is the variable A
> >
> > Is this sensible, a historical accident that should be preserved, or a
> > bug? I, at least, was rather surprised...
>
> An addendum to the above: := really does expand exactly twice (and not
> "until done"), although this is not obvious from the above. Consider:
>
> A=$$B
> B=b
> FOO=$$A
> BAR:=$$A
>
> test:
> echo '${FOO}'
> echo '${BAR}'
>
> This results in (with our make):
>
> echo '$A'
> $A
> echo '$B'
> $B
To anyone wondering/for the archives: FreeBSD make gives the same
output, so I suppose this is intentional.
Joachim