2006-05-22 Stepan Kasal * lib/am/distdir.am: Do not call $(mkdir_p) for each distributed file, collect them and create them in one run. 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 23 May 2006 10:04:51 -0000 @@ -60,7 +60,7 @@ ## @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ + list='$(DISTFILES)'; dist_files=; for file in $$list; do \ ## ## Yet another hack to support SUN make. ## @@ -106,6 +106,22 @@ ## be prepended latter. $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ + dist_files="$$dist_files $$file"; \ + done; \ +## +## Make the subdirectories for the files. +## (The DISTDIRS list can be incomplete, because files in subdirectories can +## be specified for `dist' conditionally.) +## + case $$dist_files in */*) \ + ( cd "$(distdir)"; \ + $(mkdir_p) `for file in $$dist_files; do echo "$$file"; done \ + | sed -n -e 's,/[^/]*$$,,p' | sort -u`; \ + ) ;; \ + esac; \ +## +## + for file in $$dist_files; do \ ## ## Always look for the file in the build directory first. That way ## for something like yacc output we will correctly pick up the latest @@ -114,18 +130,6 @@ ## 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. -## - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ -## ## Use cp, not ln. There are situations in which "ln" can fail. For ## instance a file to distribute could actually be a cross-filesystem ## symlink -- this can easily happen if "gettextize" was run on the @@ -142,6 +146,7 @@ ## source files _and_ generated files. It is also important when the ## directory exists only in $(srcdir), because some vendor Make (such ## as Tru64) will magically create an empty directory in `.' + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \