Daniel Richard G. wrote: > I would suggest unconditionally qualifying the generated source > filenames with $(srcdir).
Ralf Wildenhues wrote: > Prepending all files generated in the source tree with $(srcdir)/ > usually works. Last time we discussed this, on 2009-05-03, <http://lists.gnu.org/archive/html/bug-gnulib/2009-05/msg00061.html> we realized that generated files _that_are_distributed_ should be created in the source dir. > One has to note though that it really needs to be done > in every place, ie., als EXTRA_DIST, and bits which might be generated > by automake. Really? This was not done and apparently not necessary in the commit I did on 2009-05-03. Daniel Richard G. wrote: > On Wed, 2010 Apr 28 07:45+0200, Ralf Wildenhues wrote: > > > > Prepending all files generated in the source tree with $(srcdir)/ > > usually works. One has to note though that it really needs to be done > > in every place, ie., als EXTRA_DIST, and bits which might be generated > > by automake. > > Automake already has a lot of shell logic under the hood that explicitly > addresses srcdir vs. builddir (look at e.g. the "distdir" rule) so you > shouldn't need to touch EXTRA_DIST and the like. I think the fix would > be to replace the .y.c suffix rule with explicit per-file rules I agree. This would be in line with what we did on 2009-05-03. Here's a proposed patch. It takes care to - create getdate.c in the source directory, - put into getdate.c #line statements that refer to "getdate.c", i.e. don't depend on $(srcdir), - use all Makefile variables that the automake generated .y.c rule would use, - interoperate with the automake flag 'silent-rules', - not move a file onto itself. Jim, is that ok to commit? 2010-04-28 Bruno Haible <br...@clisp.org> getdate: Generate getdate.c in the source directory. * modules/getdate (Makefile.am): Add rule for getdate.c. Augment MOSTLYCLEANFILES. Suggested by Daniel Richard G. <sk...@iskunk.org> and Ralf Wildenhues. --- modules/getdate.orig Wed Apr 28 11:54:24 2010 +++ modules/getdate Wed Apr 28 11:54:22 2010 @@ -25,8 +25,20 @@ gl_GETDATE Makefile.am: +# This rule overrides the Automake generated .y.c rule, to ensure that the +# getdate.c file gets generated in the source directory, not in the build +# directory. +getdate.c: getdate.y + $(AM_V_GEN)$(SHELL) $(YLWRAP) $(srcdir)/getdate.y \ + y.tab.c getdate.c \ + y.tab.h getdate.h \ + y.output getdate.output \ + -- $(YACC) $(YFLAGS) $(AM_YFLAGS) && \ + mv getdate.c getdate.c-t && \ + mv getdate.c-t $(srcdir)/getdate.c lib_SOURCES += getdate.y BUILT_SOURCES += getdate.c +MOSTLYCLEANFILES += getdate.c-t MAINTAINERCLEANFILES += getdate.c EXTRA_DIST += getdate.c