Hello,
  I have looked at how the subdirectories of distdir are created.
Let me sum up:

i) automake collects all subdirectories in variable DISTDIRS, and the
top level Makefile.in then contains:
        $(mkdir_p) %DISTDIRS%

ii) During `make dist', before each of the files is copied, the
corresponding subdirectory is created, using $(mkdir_p).  The comment
admits it's very slow, and explains this is necessary because the 
list of subdirectories may depend on AM_CONDITIONALs.

I have two proposals:

First is simple: during `make dist', changing $(mkdir_p) to
        test -d .. || $(mkdir_p) ..
would speed up things.
Patch attached.  Will you accept it?

As the second proposal, I have the radical idea of removing the
DISTDIRS computation completely.  It is simple, and with my proposed
patch, it calls mkdir only once for each subdirectory.

Yes, the DISTDIRS method is slightly more effective, but I don't
think it's worth the amount of code which is needed, and which would
be needed to fix this for conditionals.

What do you think?

Have a nice day,
        Stepan Kasal
2006-05-14  Stepan Kasal  <[EMAIL PROTECTED]>

        * lib/am/distdir.am: Do not call $(mkdir_p) for each
        distributed file, only when it's needed.

Index: lib/am/distdir.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/distdir.am,v
retrieving revision 1.64
diff -u -r1.64 distdir.am
--- lib/am/distdir.am   19 Mar 2006 05:04:28 -0000      1.64
+++ lib/am/distdir.am   14 May 2006 13:27:28 -0000
@@ -114,14 +114,13 @@
 ##
          if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
 ##
-## Make the subdirectory for the file.  This is going to make `dist'
-## really crawl, but it seems like the only way to do it, given that
-## files in subdirectories can be specified for `dist' conditionally.
+## Make sure the subdirectory for the file exists; remember that files
+## in subdirectories can be specified for `dist' conditionally.
 ##
          dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
          if test "$$dir" != "$$file" && test "$$dir" != "."; then \
            dir="/$$dir"; \
-           $(mkdir_p) "$(distdir)$$dir"; \
+           test -d "$(distdir)$$dir" || $(mkdir_p) "$(distdir)$$dir"; \
          else \
            dir=''; \
          fi; \

Reply via email to