[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Creating subdirs of distdir
From: |
Stepan Kasal |
Subject: |
Re: Creating subdirs of distdir |
Date: |
Tue, 23 May 2006 22:43:50 +0200 |
User-agent: |
Mutt/1.4.2.1i |
Hello Ralf,
thank you for your review and improvements.
A few quick comments:
On Tue, May 23, 2006 at 09:31:18PM +0200, Ralf Wildenhues wrote:
> [...] nobody uses `|' in a file name. I think it's pretty safe
> to assume this. [...]
Sure it is. The current code already assumed that:
case ... in $(srcdir)/*) ... $(top_srcdir)/*) ...
> I think we can kill the per-file forks before the mkdir_p, too.
You mean the $(srcdir) and $(top_srcdir) stripping. But it takes
place only in certain situations:
- if the make implementation inserts $(srcdir) (GNU make doesn't)
- or if the author of Makefile.am usees $(srcdir) or $(top_srcdir)
(well educated maintainers don't)
So when you replaced all the per-file forks by a constant number of
three forks, you actually slowed down the most common usecase.
I think it should be either reverted, or wrapped in a case command,
see below.
Moreover, your sed program is not portable; you cannot use semicolon
after the `t' command nor after the `:' command.
What about the following (quick untested sketch):
> + list='$(DISTFILES)'; \
> +## The `case' command eliminates unnecesary forks in most of the cases
> +## when $list would stay intact.
> + case $$list in $(srcdir)/*|$(top_srcdir)/*) \
> + list=`for file in $$list; do echo $$file; done | \
> + | sed -e "s|^$$srcdirstrip/||;t" \
> + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`;; \
> +## (The second `t' command clears the flag for the next round.)
> + esac; \
> +##
> +## Make the subdirectories for the files.
> +## (The DISTDIRS list can be incomplete, because files in subdirectories can
> +## be specified for `dist' conditionally.)
> +##
> + case $$list in */*) \
> + ( cd "$(distdir)"; \
> + $(mkdir_p) `echo "$$list" | sed -n 's,/[^/]*$$,,p' | sort -u`; \
> + ) ;; \
> + esac; \
> +##
> +##
> + for file in $$list; do \
Good night,
Stepan