GNU bug report logs - #9238
"make dist" when "." is in SUBDIRS

Previous Next

Package: automake;

Reported by: Jim Meyering <jim <at> meyering.net>

Date: Thu, 4 Aug 2011 09:19:01 UTC

Severity: minor

To reply to this bug, email your comments to 9238 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-automake <at> gnu.org:
bug#9238; Package automake. (Thu, 04 Aug 2011 09:19:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jim Meyering <jim <at> meyering.net>:
New bug report received and forwarded. Copy sent to bug-automake <at> gnu.org. (Thu, 04 Aug 2011 09:19:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Pete Zaitcev <zaitcev <at> redhat.com>
Cc: bug-automake <at> gnu.org,
	"iwhd-devel <at> lists.fedorahosted.org" <iwhd-devel <at> lists.fedorahosted.org>
Subject: Re: help help2man to find iwhd
Date: Thu, 04 Aug 2011 11:17:32 +0200
Pete Zaitcev wrote:
> I have a problem that I'm failing to solve.
>
> If "make distcheck" is ran on a freshly-cloned iwhd repo, just after the
> configuring it, the following happens:
...
>
> But the above causes this to happen:
>
> $ sh autogen.sh
> $ ./configure
> $ make distcheck
> ............
> checking where the gettext function comes from... libc
> configure: creating ./config.status
> config.status: creating Makefile
> config.status: creating gnulib-tests/Makefile
> config.status: creating lib/Makefile
> config.status: error: cannot find input file: `man/Makefile.in'
>
> So, what to do?

Life is already short enough ;-)
I simply insert a "make" before the "make distcheck":

    $ sh autogen.sh
    $ ./configure
    $ make && make distcheck

However, I took a look at the generated Makefile.in and conclude that
there's an automake weakness when we use Makefile.am's SUBDIRS variable
to kludge dependencies by specifying "." not at the end of the list.

Notice how iwhd's Makefile.am is careful to list "." before "man"
in the SUBDIRS list:

    SUBDIRS = lib . gnulib-tests t man po

With normal "recursive" rules, that ensures that iwhd is built
in "." before the binary is needed by help2man in man/.

However, the problem is that while all of automake's so-called
RECURSIVE_TARGETS handle that special case of "." as expected, the
"distdir" rule does not.  The distdir rule is at the core of what
is run when you do "make distcheck", and it merely skips ".".

Then I thought "Hey, use the "dist*-hook" mechanism!".
Unfortunately, that doesn't work, either, since "."
is simply skipped in this "distdir:" loop.  The hook
is run only after all subdirs have been processed:

      @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
      if test "$$subdir" = .; then :; else \
        dir1=$$subdir;
        ...
      fi
      $(MAKE) $(AM_MAKEFLAGS) \
          top_distdir="$(top_distdir)" distdir="$(distdir)" \
          dist-hook

Contrast that with how it's done for RECURSIVE_TARGETS:
(here, the position of "." in SUBDIRS *is* honored):

$(RECURSIVE_TARGETS):
	@fail= failcom='exit 1'; \
	for f in x $$MAKEFLAGS; do \
	  case $$f in \
	    *=* | --[!k]*);; \
	    *k*) failcom='fail=yes';; \
	  esac; \
	done; \
	dot_seen=no; \
	target=`echo $@ | sed s/-recursive//`; \
	list='$(SUBDIRS)'; for subdir in $$list; do \
	  echo "Making $$target in $$subdir"; \
	  if test "$$subdir" = "."; then \
	    dot_seen=yes; \
	    local_target="$$target-am"; \
	  else \
	    local_target="$$target"; \
	  fi; \
	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
	  || eval $$failcom; \
	done; \
	if test "$$dot_seen" = "no"; then \
	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
	fi; test -z "$$fail"

-------------------------------------------------------
In case you're wondering why this is not a problem for other
projects, at least for some, it's because they put programs
in a sub-directory (often named src/), and so it works fine.
No need to special-case ".".




Information forwarded to owner <at> debbugs.gnu.org, bug-automake <at> gnu.org:
bug#9238; Package automake. (Sat, 06 Aug 2011 01:54:05 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Pete Zaitcev <zaitcev <at> redhat.com>
To: Jim Meyering <jim <at> meyering.net>
Cc: bug-automake <at> gnu.org,
	"iwhd-devel <at> lists.fedorahosted.org" <iwhd-devel <at> lists.fedorahosted.org>
Subject: Re: help help2man to find iwhd
Date: Thu, 4 Aug 2011 13:46:47 -0600
On Thu, 04 Aug 2011 11:17:32 +0200
Jim Meyering <jim <at> meyering.net> wrote:

> I simply insert a "make" before the "make distcheck":
> 
>     $ sh autogen.sh
>     $ ./configure
>     $ make && make distcheck

I see. Thanks for the explaining, too. I looked at RECURSIVE_TARGETS
and just could not understand what it meant for the evaluation order.

-- Pete




Information forwarded to bug-automake <at> gnu.org:
bug#9238; Package automake. (Wed, 04 Jan 2012 12:14:01 GMT) Full text and rfc822 format available.

Message #11 received at 9238 <at> debbugs.gnu.org (full text, mbox):

From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
To: 9238 <at> debbugs.gnu.org
Subject: "make dist" when "." is in SUBDIRS (was: Re: help help2man to find
	iwhd)
Date: Wed, 04 Jan 2012 13:09:40 +0100
retitle 9238 "make dist" when "." is in SUBDIRS
severity 9238 minor
thanks

References:
  <https://fedorahosted.org/pipermail/iwhd-devel/2011-August/000769.html>
  <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9238>

Hi Jim, sorry for the delay.

Jim Meyering wrote:
>
> I took a look at the generated Makefile.in and conclude that
> there's an automake weakness when we use Makefile.am's SUBDIRS
> variable to kludge dependencies by specifying "." not at the
> end of the list.
>
> Notice how iwhd's Makefile.am is careful to list "." before "man"
> in the SUBDIRS list:
>
>    SUBDIRS = lib . gnulib-tests t man po
>
> With normal "recursive" rules, that ensures that iwhd is built
> in "." before the binary is needed by help2man in man/.
>
> However, the problem is that while all of automake's so-called
> RECURSIVE_TARGETS handle that special case of "." as expected,
> the "distdir" rule does not.  The distdir rule is at the core
> of what is run when you do "make distcheck", and it merely skips
> ".".
>
I'm not sure this can be qualified as a real weakness; could you show an
real-world (or potentially so) example where the behaviour of `distdir'
causes some concrete problem?

And yes, I believe that the iwhd issue is *not* such an example, because
even if you had everything under a single top-level directory, you would
still need to run "make all" before "make dist" to correctly have the
distributed `iwhd.8' manpage generated from the `iwhd' program (which
wouldn't be there if you hadn't run "make all" in advance!).

>
> [SNIP]
>

Thanks,
  Stefano




Changed bug title to '"make dist" when "." is in SUBDIRS' from 'help help2man to find iwhd' Request was from Stefano Lattarini <stefano.lattarini <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 04 Jan 2012 12:14:02 GMT) Full text and rfc822 format available.

Severity set to 'minor' from 'normal' Request was from Stefano Lattarini <stefano.lattarini <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 04 Jan 2012 12:14:02 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 166 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.