From 1494c8e5da2ec716ed7a1c9b354390cc7ae3f434 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sun, 4 Feb 2001 15:10:21 +0000 Subject: [PATCH] * distdir.am (distdir): New file, extracted from... * automake.in (handle_dist_worker): here. Adjust. --- ChangeLog | 6 +++ Makefile.am | 6 +-- Makefile.in | 10 +++-- automake.in | 96 ++++++++++++++++++---------------------------- lib/am/Makefile.am | 6 +-- m4/Makefile.in | 1 + tests/Makefile.in | 1 + 7 files changed, 58 insertions(+), 68 deletions(-) diff --git a/ChangeLog b/ChangeLog index a2186268..51eb6083 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2001-02-04 Akim Demaille + + * distdir.am (distdir): New file, extracted from... + * automake.in (handle_dist_worker): here. + Adjust. + 2001-02-04 Akim Demaille * automake.in (@clean): Remove, replaced by... diff --git a/Makefile.am b/Makefile.am index d5774855..d417b311 100644 --- a/Makefile.am +++ b/Makefile.am @@ -12,9 +12,9 @@ info_TEXINFOS = automake.texi amfiles = check.am clean-hdr.am clean-kr.am clean.am comp-vars.am \ compile.am data-clean.am data.am dejagnu.am depend.am depend2.am \ -dist.am dist-vars.am footer.am header-vars.am header.am java-clean.am \ -java.am kr-extra.am library.am libs-clean.am libs.am libtool.am \ -lisp-clean.am lisp.am ltlib-clean.am ltlib.am ltlibrary.am \ +dist.am distdir.am dist-vars.am footer.am header-vars.am header.am \ +java-clean.am java.am kr-extra.am library.am libs-clean.am libs.am \ +libtool.am lisp-clean.am lisp.am ltlib-clean.am ltlib.am ltlibrary.am \ mans-vars.am mans.am multilib.am program.am progs-clean.am progs.am \ python.am python-clean.am remake-hdr.am remake.am scripts.am \ subdirs.am tags-clean.am tags.am texi-vers.am texinfos.am diff --git a/Makefile.in b/Makefile.in index f14e504c..98637403 100644 --- a/Makefile.in +++ b/Makefile.in @@ -79,9 +79,9 @@ info_TEXINFOS = automake.texi amfiles = check.am clean-hdr.am clean-kr.am clean.am comp-vars.am \ compile.am data-clean.am data.am dejagnu.am depend.am depend2.am \ -dist.am dist-vars.am footer.am header-vars.am header.am java-clean.am \ -java.am kr-extra.am library.am libs-clean.am libs.am libtool.am \ -lisp-clean.am lisp.am ltlib-clean.am ltlib.am ltlibrary.am \ +dist.am distdir.am dist-vars.am footer.am header-vars.am header.am \ +java-clean.am java.am kr-extra.am library.am libs-clean.am libs.am \ +libtool.am lisp-clean.am lisp.am ltlib-clean.am ltlib.am ltlibrary.am \ mans-vars.am mans.am multilib.am program.am progs-clean.am progs.am \ python.am python-clean.am remake-hdr.am remake.am scripts.am \ subdirs.am tags-clean.am tags.am texi-vers.am texinfos.am @@ -504,6 +504,7 @@ dist-all: distdir || chmod -R a+r $(distdir) $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c > $(distdir).tar.gz -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) + distdir: $(DISTFILES) @if sed 15q $(srcdir)/NEWS | fgrep -e "$(VERSION)" > /dev/null; then :; else \ echo "NEWS not updated; not releasing" 1>&2; \ @@ -527,7 +528,8 @@ distdir: $(DISTFILES) test -d $(distdir)/$$subdir \ || mkdir $(distdir)/$$subdir \ || exit 1; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \ || exit 1; \ fi; \ done diff --git a/automake.in b/automake.in index d95df1c4..f2ad07a7 100755 --- a/automake.in +++ b/automake.in @@ -2613,28 +2613,26 @@ sub handle_multilib # Worker for handle_dist. sub handle_dist_worker { - local ($makefile) = @_; - - $output_rules .= 'distdir: $(DISTFILES)' . "\n"; + my ($makefile) = @_; + my $xform = ''; # Initialization; only at top level. if ($relative_dir eq '.') { - if (defined $options{'check-news'}) - { - # For Gnits users, this is pretty handy. Look at 15 lines - # in case some explanatory text is desirable. - $output_rules .= ' @if sed 15q $(srcdir)/NEWS | fgrep -e "$(VERSION)" > /dev/null; then :; else \\ - echo "NEWS not updated; not releasing" 1>&2; \\ - exit 1; \\ - fi -'; - } - + $xform .= 's/\@TOPDIR\@//g;'; + } + else + { + $xform .= 's/\@TOPDIR\@.*//g;'; + } - # Create dist directory. - $output_rules .= ("\t-chmod -R a+w \$(distdir) > /dev/null 2>&1; rm -rf \$(distdir)\n" - . "\tmkdir \$(distdir)\n"); + if (defined $options{'check-news'}) + { + $xform .= 's/\@CK-NEWS\@//g;'; + } + else + { + $xform .= 's/\@CK-NEWS\@.*//g;'; } # Scan EXTRA_DIST to see if we need to distribute anything from a @@ -2672,8 +2670,11 @@ sub handle_dist_worker # Prepend $(distdir) to each directory given. Doing it via a # hash lets us ensure that each directory is used only once. grep ($dist_dirs{'$(distdir)/' . $_} = 1, keys %dist_dirs); - $output_rules .= "\t"; - &pretty_print_rule ('$(mkinstalldirs)', "\t ", sort keys %dist_dirs); + $xform .= &transform ('DISTDIRS', join (' ', sort keys %dist_dirs)); + } + else + { + $xform .= 's/.*\@DISTDIRS\@.*//g;'; } # In loop, test for file existence because sometimes a file gets @@ -2686,25 +2687,14 @@ sub handle_dist_worker $output_rules .= "\t\@for file in \$(DISTFILES); do \\\n"; if ($cygnus_mode) { - $output_rules .= "\t if test -f \$\$file; then d=.; else d=\$(srcdir); fi; \\\n"; + $xform .= 's/\@CYGNUS\@\t*/\t/g;'; + $xform .= 's/.*\@NCYGNUS\@.*//g;'; } else { - $output_rules .= "\t d=\$(srcdir); \\\n"; - } - $output_rules .= ("\t if test -d \$\$d/\$\$file; then \\\n" - # Don't mention $$file in destination argument, - # since this fails if destination directory - # already exists. Also, use `-R' and not `-r'. - # `-r' is almost always incorrect. - . "\t cp -pR \$\$d/\$\$file \$(distdir) \\\n" - . "\t || exit 1; \\\n" - . "\t else \\\n" - . "\t test -f \$(distdir)/\$\$file \\\n" - . "\t || cp -p \$\$d/\$\$file \$(distdir)/\$\$file \\\n" - . "\t || exit 1; \\\n" - . "\t fi; \\\n" - . "\tdone\n"); + $xform .= 's/\@NCYGNUS\@\t*/\t/g;'; + $xform .= 's/.*\@CYGNUS\@.*//g;'; + } # If we have SUBDIRS, create all dist subdirectories and do # recursive build. @@ -2742,29 +2732,20 @@ sub handle_dist_worker &define_pretty_variable ('DIST_SUBDIRS', '', '$(SUBDIRS)'); } - # Test for directory existence here because previous automake - # invocation might have created some directories. Note that - # we explicitly set distdir for the subdir make; that lets us - # mix-n-match many automake-using packages into one large - # package, and have "dist" at the top level do the right - # thing. If we're in the topmost directory, then we use - # `distdir' instead of `top_distdir'; this lets us work - # correctly with an enclosing package. - $output_rules .= - ("\t" . 'for subdir in $(' . $dist_subdir_name . '); do ' . "\\\n" - . "\t" . ' if test "$$subdir" = .; then :; else ' . "\\\n" - . "\t" . ' test -d $(distdir)/$$subdir ' . "\\\n" - . "\t" . ' || mkdir $(distdir)/$$subdir ' . "\\\n" - . "\t" . ' || exit 1; ' . "\\\n" - . "\t" . ' (cd $$subdir' - . ' && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(' - . (($relative_dir eq '.') ? 'distdir' : 'top_distdir') - . ') distdir=../$(distdir)/$$subdir distdir) ' . "\\\n" - . "\t" . ' || exit 1; ' . "\\\n" - . "\t" . ' fi; ' . "\\\n" - . "\tdone\n"); + $xform .= ('s/\@SUBDIRS\@//g;' + . &transform ('DIST_SUBDIR_NAME' + => $dist_subdir_name, + 'TOP_DISTDIR' + => (($relative_dir eq '.') + ? 'distdir' : 'top_distdir'))); + } + else + { + $xform .= 's/\@SUBDIRS\@.*//g;'; } + $output_rules .= &file_contents ('distdir', $xform); + # If the target `dist-hook' exists, make sure it is run. This # allows users to do random weird things to the distribution # before it is packaged up. @@ -2779,8 +2760,6 @@ sub handle_dist_worker . " top_distdir=\"\$(top_distdir)\"" . " distdir=\"\$(distdir)\" $targ\n"); } - - &depend ('.PHONY', 'distdir'); } # Handle 'dist' target. @@ -2911,6 +2890,7 @@ sub handle_dist $xform .= 's/^GETTEXT.*$//;'; } + # Arg, this file should have been named `distcheck'. $output_rules .= &file_contents ('dist', $xform); local ($dist_all) = ('dist-all: distdir' . "\n" diff --git a/lib/am/Makefile.am b/lib/am/Makefile.am index d5774855..d417b311 100644 --- a/lib/am/Makefile.am +++ b/lib/am/Makefile.am @@ -12,9 +12,9 @@ info_TEXINFOS = automake.texi amfiles = check.am clean-hdr.am clean-kr.am clean.am comp-vars.am \ compile.am data-clean.am data.am dejagnu.am depend.am depend2.am \ -dist.am dist-vars.am footer.am header-vars.am header.am java-clean.am \ -java.am kr-extra.am library.am libs-clean.am libs.am libtool.am \ -lisp-clean.am lisp.am ltlib-clean.am ltlib.am ltlibrary.am \ +dist.am distdir.am dist-vars.am footer.am header-vars.am header.am \ +java-clean.am java.am kr-extra.am library.am libs-clean.am libs.am \ +libtool.am lisp-clean.am lisp.am ltlib-clean.am ltlib.am ltlibrary.am \ mans-vars.am mans.am multilib.am program.am progs-clean.am progs.am \ python.am python-clean.am remake-hdr.am remake.am scripts.am \ subdirs.am tags-clean.am tags.am texi-vers.am texinfos.am diff --git a/m4/Makefile.in b/m4/Makefile.in index 51acd9bc..6e6c8b40 100644 --- a/m4/Makefile.in +++ b/m4/Makefile.in @@ -125,6 +125,7 @@ TAGS: distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 862e691a..e847f64a 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -420,6 +420,7 @@ check-TESTS: $(TESTS) distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ -- 2.43.5