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

From: Stefano Lattarini <[email-masked]>
Date: Tue, 25 Jan 2011 20:52:56 +0100

Hello automakers.

A small update on this ...

On Saturday 22 January 2011, Ralf Wildenhues wrote:
> * Stefano Lattarini wrote on Fri, Jan 21, 2011 at 10:28:24PM CET:
> >  - Always create yacc-derived and distributed .c and .h files in
> >    $(srcdir), and explicitly instruct make to alwsys look fr them
> >    there at first -- similarly to what is done for info files
> >    (yuck)
> 
> Yes, this is ugly, but it is a way that can be made to work.
> One complication is that, for portable semantics, if a file is
> ever mentioned as $(srcdir)/file as a prerequisite, then it also
> needs to be listed that way as a target.  (I think; it might've
> been the other way round.)
> 
> Downside of this is that now builds fail to work as expected when
> there are newer versions of the files in the build tree.  GNU make
> users would likely complain.
>
Yes... and they would be right IMO.  To be honest, if I were just an
automake user, I'd complain myself about such a behaviour.  So IMVHO
this is not a viable solution, after all.

> Still, this could be viable as optional behavior.
> 
> >  - Tell the developer to add proper AC_CONFIG_LINKS to configure in
> >    order to support VPATH builds with FreeBSD make (yuck^2, since
> >    that means keeping track of renamed files when object-specific
> >    flags are involved).
> >
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.

 [1] See <http://www.freebsd.org/cgi/man.cgi?query=make> for more info.
 [2] This variable doesn't seem to cause problems with GNU make, Solaris
     XPG4/CCS make, Solaris dmake, not Heirloom make.

Note that the 'distcleancheck' target would still fail with this change,
but that's more of an annoyance rather than a serious bug (like the one
under discussion is IMHO).  And we could try to fix that later.

> >  - Make the `parse.c' and `parse.h' rules look for same named files
> >    in $(srcdir) during a VPATH build, and copy them in $(builddir)
> >    if they're neweer than `parse.y'.  But then how can distclean be
> >    made to work in evey situation?
> 
> I doubt that these two options can be made to work sanely.  A
>   file: $(srcdir)/file
> 
> doesn't work with GNU make, for example: it will rightfully complain
> about a circular dependency.
> 
> >  - Tell that FreeBSD make is not supported in VPATH builds (not
> >    really a solution, I admit).
> 
> Why not?  VPATH is not specified by Posix, and there is a reason for
> that: behavior is just too variable and different between makes.  This
> means that only some setups work well, others don't.
> 
> I'm concerned mostly with users downloading stuff: they should be able
> to build source packages.  If VPATH doesn't work, that is not a big
> problem because they can still use an in-tree build.  It doesn't make
> the package unusable for them.
> 
Anyway, I think this bug woul be worth fixing, if that can be done
without too much fuss.

> The actual complication, as far as I can see, comes from the fact that
> I want VPATH builds to work for the packages I'm interested in.  ;-)
> 
:-)

Regards,
  Stefano