Subject: bug#18286: distcheck fails to detect missing files

From: Stefano Lattarini <[email-masked]>
Date: Mon, 22 Dec 2014 20:30:33 +0100

Reference: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18286

On 08/18/2014 02:30 AM, Peter Johansson wrote:
> Hi,
>
> I have this snippet in my 'Makefile.am'
>
>
> include am/test_data.am
>
> $(srcdir)/am/test_data.am: $(srcdir)/test/data.txt $(srcdir)/am/test_data.am.in
>      cd $(srcdir) && $(SHELL) bootstrap am/test_data.am
>
>
> It first includes (at Automake time) a snippet, which is generated while bootstrapping. Now I forgot to include $(srcdir)/test/data.txt $(srcdir)/am/test_data.am.in in the distball, which caused the embarrassing
>
> make: *** No rule to make target `am/test_data.am.in', needed by `am/test_data.am'.  Stop.
>
> The surprising thing is that distcheck does not detect this problem,
 > but 'make distcheck' passes through without problem.
 >
This issue has been reported already in the past:

http://lists.gnu.org/archive/html/automake/2006-09/msg00008.html
http://lists.gnu.org/archive/html/automake/2013-01/msg00049.html

(BTW, sorry Nicola for missing your report and your fix
for so long!)

> The reason for
 > this is probably because while $(srcdir)/test/data.txt does not exist,
 > make also looks in $(srcdir)/$(srcdir)/test/data.txt and that file exists
 > as it is part of my development directory. If I change my Makefile.am to
>
> $(srcdir)/am/test_data.am: test/data.txt am/test_data.am.in
>      cd $(srcdir) && $(SHELL) bootstrap am/test_data.am
>
> 'make distcheck' will detect the problem, but I have this habit of type
 > $(srcdir) for things that are supposed to be in $(srcdir). Is that a bad
 > habit?
>
It can sometimes lead to strange interactions, if not used consistently;
see http://lists.gnu.org/archive/html/automake/2006-09/msg00008.html
and follow-up messages.

But the issue you are experiencing is not due to that, but rather
to a bug/limitation of the current 'distcheck' implementation.

> A fix could be to let distcheck not work in $(distdir) but instead create
 > 'tmp_/$(distdir)', builddir 'tmp_/$(distdir)/build_', and installdir
 > 'tmp_/$(distdir)/inst_' which would hide the development files from the
 > distcheck.
 >
> What do you think?
>
Seems like a viable plan.  In such a setup, relatively to $(builddir),
$(srcdir) will be '..', while the "developement" copy of the source
tree will be in '../..'; so the incomplete tarball should be diagnosed.

Definitely a nice fix to have for Automake 1.15...  Let's see if I can
make it happen.