Subject: Re: bug#7884: Yacc and FreeBSD make in VPATH builds

From: Stefano Lattarini <[email-masked]>
Date: Thu, 27 Jan 2011 20:26:42 +0100

On Thursday 27 January 2011, Ralf Wildenhues wrote:
> * Stefano Lattarini wrote on Thu, Jan 27, 2011 at 11:54:50AM CET:
> > On Tuesday 25 January 2011, Ralf Wildenhues wrote:
> > > * Stefano Lattarini wrote on Tue, Jan 25, 2011 at 08:52:56PM CET:
> > > > Hmm... maybe a variation of this might be a good solution after all, at
> > > > least for FreeBSD make: the special `.BEGIN' target[1][2] might be used
> > > > to copy Yacc-derived *.c and *.h files from $(srcdir) to $(builddir),
> > > > unless they are already there.
> > > 
> > > How do you ensure that you don't overwrite newer such files in the build
> > > tree?
> > >
> > Because we won't copy a file `foo.c' from srcdir to builddir if a `foo.c'
> > already exists in builddir -- even if this `foo.c' in builddir is older
> > than the one in the srcdir.  This should be good enough for the intended
> > usages (VPATH builds with FreeBSD make), no?
> 
> Hmm.
> 
> I must admit that I still don't like this a lot.  BSD is free software,
> we shouldn't have to put ugly workarounds in place for it, and this
> workaround does have some ugliness to it.
>
But IMHO its ugliness pales when confronted with that of other
VPATH-related workarounds that are currently in automake:
   `test -f '$<' || echo $(srcdir)`/$<
And moreover, while this last ugliness is imposed to every make
implementation, even the well-behaved ones, the ugliness introduced
by my patch only affects the "offending" make implementations
(here, BSD make).

> Here's a radically different idea: get them to fix/improve their make.
> 
> What do you think about this?
>
That's surely good in the long run and for the future, but it won't help
with older versions of FreeBSD.

Also, I'm halfway through an automake patch on the lines I've sketched,
and I can say that it seems remarkably easy at this point ...

> If you like it, would you be willing to write a PR and/or patch?
>
I might try to write a PR if you don't have time, but I don't feel
qualified to write a patch (nor very motivated either, TBH).  Sorry.

> (I could otherwise try, but I'm not sure I have time for a patch.)
> 
> Thanks,
> Ralf
> 
> 

Regards,
   Stefano