From fd73da56ab9da9d05c1f8c8a7cdd6486a2f7a39a Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Wed, 21 Feb 2001 08:26:34 +0000 Subject: [PATCH] * dist.am: Remove, merge into... * distdir.am: here. Use the neat sed snippet for banners. BTW, distcheck is phony. * automake.in (&handle_dist_worker): Remove, merge into... (&handle_dist): this. (&file_contents): Strip leading new lines. Be sure to end comments with new lines. --- ChangeLog | 10 +++ Makefile.am | 2 +- Makefile.in | 62 +++++++------ automake.in | 211 ++++++++++++++++++++++----------------------- dist.am | 58 ------------- distdir.am | 46 ++++++++++ lib/am/Makefile.am | 2 +- lib/am/distdir.am | 46 ++++++++++ 8 files changed, 236 insertions(+), 201 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5e47fd48..87373cda 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2001-02-21 Akim Demaille + + * dist.am: Remove, merge into... + * distdir.am: here. Use the neat sed snippet for banners. + BTW, distcheck is phony. + * automake.in (&handle_dist_worker): Remove, merge into... + (&handle_dist): this. + (&file_contents): Strip leading new lines. + Be sure to end comments with new lines. + 2001-02-21 Akim Demaille * distdir.am (GZIP_ENV): Define. diff --git a/Makefile.am b/Makefile.am index 520331a6..669f7b30 100644 --- a/Makefile.am +++ b/Makefile.am @@ -12,7 +12,7 @@ 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 distdir.am dist-vars.am footer.am header-vars.am header.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 \ diff --git a/Makefile.in b/Makefile.in index 9177a544..ab09d4ac 100644 --- a/Makefile.in +++ b/Makefile.in @@ -86,7 +86,7 @@ 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 distdir.am dist-vars.am footer.am header-vars.am header.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 \ @@ -455,37 +455,6 @@ distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - - chmod -R a-w $(distdir); chmod a+w $(distdir) - mkdir $(distdir)/=build - mkdir $(distdir)/=inst - chmod a-w $(distdir) - dc_install_base=`CDPATH=: && cd $(distdir)/=inst && pwd` \ - && cd $(distdir)/=build \ - && ../configure --srcdir=.. --prefix=$$dc_install_base \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) uninstall \ - && test `find $$dc_install_base -type f -print | wc -l` -le 1 \ - && $(MAKE) $(AM_MAKEFLAGS) dist \ - && $(MAKE) $(AM_MAKEFLAGS) distclean \ - && rm -f $(distdir).tar.gz \ - && test `find . -type f -print | wc -l` -eq 0 - -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) - @banner="$(distdir).tar.gz is ready for distribution"; \ - dashes=`echo "$$banner" | sed s/./=/g`; \ - echo "$$dashes"; \ - echo "$$banner"; \ - echo "$$dashes" - GZIP_ENV = --best distdir: $(DISTFILES) @@ -528,6 +497,33 @@ distdir: $(DISTFILES) dist: distdir $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir) +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/=build + mkdir $(distdir)/=inst + chmod a-w $(distdir) + dc_install_base=`CDPATH=: && cd $(distdir)/=inst && pwd` \ + && cd $(distdir)/=build \ + && ../configure --srcdir=.. --prefix=$$dc_install_base \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && test `find $$dc_install_base -type f -print | wc -l` -le 1 \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && $(MAKE) $(AM_MAKEFLAGS) distclean \ + && rm -f $(distdir).tar.gz \ + && test `find . -type f -print | wc -l` -eq 0 + -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) + @echo "$(distdir).tar.gz is ready for distribution" | \ + sed 'h;s/./=/g;p;x;p;x' info-am: $(INFO_DEPS) info: info-recursive dvi-am: $(DVIS) @@ -595,7 +591,7 @@ mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-aminfo mostlyclean-generic mostlyclean-vti .PHONY: all all-am all-recursive check check-am check-recursive clean \ - clean-generic clean-recursive dist dist-all distclean \ + clean-generic clean-recursive dist dist-all distcheck distclean \ distclean-generic distclean-recursive distclean-tags distdir \ dvi dvi-am dvi-recursive info info-am info-recursive install \ install-am install-binSCRIPTS install-data install-data-am \ diff --git a/automake.in b/automake.in index 5d4320eb..a17b4c04 100755 --- a/automake.in +++ b/automake.in @@ -2589,97 +2589,6 @@ sub handle_dist_worker { my ($makefile) = @_; - # Initialization; only at top level. - my $xform = &transform_cond ('TOPDIR' => ($relative_dir eq '.')); - - # Scan EXTRA_DIST to see if we need to distribute anything from a - # subdir. If so, add it to the list. I didn't want to do this - # originally, but there were so many requests that I finally - # relented. - if (&variable_defined ('EXTRA_DIST')) - { - # FIXME: This should be fixed to work with conditionals. That - # will require only making the entries in @dist_dirs under the - # appropriate condition. This is meaningful if the nature of - # the distribution should depend upon the configure options - # used. - foreach (&variable_value_as_list ('EXTRA_DIST', '')) - { - next if /^\@.*\@$/; - next unless s,/+[^/]+$,,; - $dist_dirs{$_} = 1 - unless $_ eq '.'; - } - } - - # We have to check DIST_COMMON for extra directories in case the - # user put a source used in AC_OUTPUT into a subdir. - foreach (&variable_value_as_list ('DIST_COMMON', 'all')) - { - next if /^\@.*\@$/; - next unless s,/+[^/]+$,,; - $dist_dirs{$_} = 1 - unless $_ eq '.'; - } - - if (scalar keys %dist_dirs) - { - # 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); - $xform .= &transform ('DISTDIRS', join (' ', sort keys %dist_dirs)); - } - else - { - $xform .= 's/.*\@DISTDIRS\@.*//g;'; - } - - # If we have SUBDIRS, create all dist subdirectories and do - # recursive build. - if (&variable_defined ('SUBDIRS')) - { - # If SUBDIRS is conditionally defined, then set DIST_SUBDIRS - # to all possible directories, and use it. If DIST_SUBDIRS is - # defined, just use it. - local ($dist_subdir_name); - if (&variable_conditions ('SUBDIRS') - || &variable_defined ('DIST_SUBDIRS')) - { - $dist_subdir_name = 'DIST_SUBDIRS'; - if (! &variable_defined ('DIST_SUBDIRS')) - { - &define_pretty_variable - ('DIST_SUBDIRS', '', - uniq (&variable_value_as_list ('SUBDIRS', 'all'))); - } - } - else - { - $dist_subdir_name = 'SUBDIRS'; - # We always define this because that is what `distclean' - # wants. - &define_pretty_variable ('DIST_SUBDIRS', '', '$(SUBDIRS)'); - } - - my $top_distdir = ($relative_dir eq '.') ? 'distdir' : 'top_distdir'; - $xform .= &transform ('DIST_SUBDIR_NAME' => $dist_subdir_name, - 'TOP_DISTDIR' => $top_distdir); - } - - # 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. - push (@dist_targets, 'dist-hook') - if &target_defined ('dist-hook'); - - $output_rules .= - &file_contents ('distdir', - $xform - . &transform ('DIST-TARGETS' => join " ", @dist_targets) - . &transform_cond ('DIST-TARGETS' => - scalar @dist_targets, - 'SUBDIRS' => - &variable_defined ('SUBDIRS'))); } # Handle 'dist' target. @@ -2786,20 +2695,100 @@ sub handle_dist } $output_rules .= "\n"; - # Generate 'dist' target, and maybe other dist targets. - if ($relative_dir eq '.') + # Scan EXTRA_DIST to see if we need to distribute anything from a + # subdir. If so, add it to the list. I didn't want to do this + # originally, but there were so many requests that I finally + # relented. + if (&variable_defined ('EXTRA_DIST')) { - # Rule to check whether a distribution is viable. - my ($xform) = - &transform_cond ('DISTHOOK' => &target_defined ('distcheck-hook'), - 'GETTEXT' => $seen_gettext); + # FIXME: This should be fixed to work with conditionals. That + # will require only making the entries in @dist_dirs under the + # appropriate condition. This is meaningful if the nature of + # the distribution should depend upon the configure options + # used. + foreach (&variable_value_as_list ('EXTRA_DIST', '')) + { + next if /^\@.*\@$/; + next unless s,/+[^/]+$,,; + $dist_dirs{$_} = 1 + unless $_ eq '.'; + } + } - # Arg, this file should have been named `distcheck'. - $output_rules .= &file_contents ('dist', $xform); + # We have to check DIST_COMMON for extra directories in case the + # user put a source used in AC_OUTPUT into a subdir. + foreach (&variable_value_as_list ('DIST_COMMON', 'all')) + { + next if /^\@.*\@$/; + next unless s,/+[^/]+$,,; + $dist_dirs{$_} = 1 + unless $_ eq '.'; + } + + # Rule to check whether a distribution is viable. + my $xform = + &transform_cond ('TOPDIR' => ($relative_dir eq '.'), + 'DISTCHECK-HOOK' => &target_defined ('distcheck-hook'), + 'GETTEXT' => $seen_gettext); + + if (scalar keys %dist_dirs) + { + # 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); + $xform .= &transform ('DISTDIRS', join (' ', sort keys %dist_dirs)); + } + else + { + $xform .= 's/.*\@DISTDIRS\@.*//g;'; } - # Generate distdir target. - &handle_dist_worker ($makefile); + # If we have SUBDIRS, create all dist subdirectories and do + # recursive build. + if (&variable_defined ('SUBDIRS')) + { + # If SUBDIRS is conditionally defined, then set DIST_SUBDIRS + # to all possible directories, and use it. If DIST_SUBDIRS is + # defined, just use it. + local ($dist_subdir_name); + if (&variable_conditions ('SUBDIRS') + || &variable_defined ('DIST_SUBDIRS')) + { + $dist_subdir_name = 'DIST_SUBDIRS'; + if (! &variable_defined ('DIST_SUBDIRS')) + { + &define_pretty_variable + ('DIST_SUBDIRS', '', + uniq (&variable_value_as_list ('SUBDIRS', 'all'))); + } + } + else + { + $dist_subdir_name = 'SUBDIRS'; + # We always define this because that is what `distclean' + # wants. + &define_pretty_variable ('DIST_SUBDIRS', '', '$(SUBDIRS)'); + } + + my $top_distdir = ($relative_dir eq '.') ? 'distdir' : 'top_distdir'; + $xform .= &transform ('DIST_SUBDIR_NAME' => $dist_subdir_name, + 'TOP_DISTDIR' => $top_distdir); + } + + # 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. + push (@dist_targets, 'dist-hook') + if &target_defined ('dist-hook'); + + $output_rules .= + &file_contents ('distdir', + $xform + . &transform ('DIST-TARGETS' => join " ", @dist_targets) + . &transform_cond ('DIST-TARGETS' => + scalar @dist_targets, + 'SUBDIRS' => + &variable_defined ('SUBDIRS'))); } @@ -6902,11 +6891,17 @@ sub file_contents # perl goes loopy if you try to # # $result_rules =~ /^($TARGET_PATTERN *)+: ($TARGET_PATTERN *)+\n\n/sm - local ($result_vars) = ''; - local ($result_rules) = ''; - local ($comment) = ''; + my $result_vars = ''; + my $result_rules = ''; + my $comment = ''; foreach (split (/(? /dev/null 2>&1; rm -rf $(distdir) - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - -## Make the new source tree read-only. Distributions ought to work in -## this case. However, make the top-level directory writable so we -## can make our new subdirs. - chmod -R a-w $(distdir); chmod a+w $(distdir) - mkdir $(distdir)/=build - mkdir $(distdir)/=inst -## Undo the write access. - chmod a-w $(distdir) - dc_install_base=`CDPATH=: && cd $(distdir)/=inst && pwd` \ -?DISTHOOK? && $(MAKE) $(AM_MAKEFLAGS) distcheck-hook \ - && cd $(distdir)/=build \ - && ../configure --srcdir=.. --prefix=$$dc_install_base \ -?GETTEXT? --with-included-gettext \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) uninstall \ -## We use -le 1 because the `dir' file might still exist after uninstall. - && test `find $$dc_install_base -type f -print | wc -l` -le 1 \ - && $(MAKE) $(AM_MAKEFLAGS) dist \ - && $(MAKE) $(AM_MAKEFLAGS) distclean \ -## Make sure to remove the dist file we created in the test build -## directory. - && rm -f $(distdir).tar.gz \ - && test `find . -type f -print | wc -l` -eq 0 - -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) - @banner="$(distdir).tar.gz is ready for distribution"; \ - dashes=`echo "$$banner" | sed s/./=/g`; \ - echo "$$dashes"; \ - echo "$$banner"; \ - echo "$$dashes" diff --git a/distdir.am b/distdir.am index 5704f87c..ef759db7 100644 --- a/distdir.am +++ b/distdir.am @@ -154,3 +154,49 @@ distdir: $(DISTFILES) ?TOPDIR??ZIP? -rm -f $(distdir).zip ?TOPDIR??ZIP? zip -rq $(distdir).zip $(distdir) ?TOPDIR??ZIP? -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir) + + + +## ------------------------- ## +## Checking a distribution. ## +## ------------------------- ## + + +?TOPDIR?# This target untars the dist file and tries a VPATH configuration. Then +?TOPDIR?# it guarantees that the distribution is self-contained by making another +?TOPDIR?# tarfile. +?TOPDIR?.PHONY: distcheck +?TOPDIR?distcheck: dist +## Make sure we can remove distdir before trying to remove it. +?TOPDIR? -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) +?TOPDIR? GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - +## Make the new source tree read-only. Distributions ought to work in +## this case. However, make the top-level directory writable so we +## can make our new subdirs. +?TOPDIR? chmod -R a-w $(distdir); chmod a+w $(distdir) +?TOPDIR? mkdir $(distdir)/=build +?TOPDIR? mkdir $(distdir)/=inst +## Undo the write access. +?TOPDIR? chmod a-w $(distdir) +?TOPDIR? dc_install_base=`CDPATH=: && cd $(distdir)/=inst && pwd` \ +?TOPDIR??DISTCHECK-HOOK? && $(MAKE) $(AM_MAKEFLAGS) distcheck-hook \ +?TOPDIR? && cd $(distdir)/=build \ +?TOPDIR? && ../configure --srcdir=.. --prefix=$$dc_install_base \ +?TOPDIR??GETTEXT? --with-included-gettext \ +?TOPDIR? && $(MAKE) $(AM_MAKEFLAGS) \ +?TOPDIR? && $(MAKE) $(AM_MAKEFLAGS) dvi \ +?TOPDIR? && $(MAKE) $(AM_MAKEFLAGS) check \ +?TOPDIR? && $(MAKE) $(AM_MAKEFLAGS) install \ +?TOPDIR? && $(MAKE) $(AM_MAKEFLAGS) installcheck \ +?TOPDIR? && $(MAKE) $(AM_MAKEFLAGS) uninstall \ +## We use -le 1 because the `dir' file might still exist after uninstall. +?TOPDIR? && test `find $$dc_install_base -type f -print | wc -l` -le 1 \ +?TOPDIR? && $(MAKE) $(AM_MAKEFLAGS) dist \ +?TOPDIR? && $(MAKE) $(AM_MAKEFLAGS) distclean \ +## Make sure to remove the dist file we created in the test build +## directory. +?TOPDIR? && rm -f $(distdir).tar.gz \ +?TOPDIR? && test `find . -type f -print | wc -l` -eq 0 +?TOPDIR? -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) +?TOPDIR? @echo "$(distdir).tar.gz is ready for distribution" | \ +?TOPDIR? sed 'h;s/./=/g;p;x;p;x' diff --git a/lib/am/Makefile.am b/lib/am/Makefile.am index 520331a6..669f7b30 100644 --- a/lib/am/Makefile.am +++ b/lib/am/Makefile.am @@ -12,7 +12,7 @@ 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 distdir.am dist-vars.am footer.am header-vars.am header.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 \ diff --git a/lib/am/distdir.am b/lib/am/distdir.am index 5704f87c..ef759db7 100644 --- a/lib/am/distdir.am +++ b/lib/am/distdir.am @@ -154,3 +154,49 @@ distdir: $(DISTFILES) ?TOPDIR??ZIP? -rm -f $(distdir).zip ?TOPDIR??ZIP? zip -rq $(distdir).zip $(distdir) ?TOPDIR??ZIP? -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir) + + + +## ------------------------- ## +## Checking a distribution. ## +## ------------------------- ## + + +?TOPDIR?# This target untars the dist file and tries a VPATH configuration. Then +?TOPDIR?# it guarantees that the distribution is self-contained by making another +?TOPDIR?# tarfile. +?TOPDIR?.PHONY: distcheck +?TOPDIR?distcheck: dist +## Make sure we can remove distdir before trying to remove it. +?TOPDIR? -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) +?TOPDIR? GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - +## Make the new source tree read-only. Distributions ought to work in +## this case. However, make the top-level directory writable so we +## can make our new subdirs. +?TOPDIR? chmod -R a-w $(distdir); chmod a+w $(distdir) +?TOPDIR? mkdir $(distdir)/=build +?TOPDIR? mkdir $(distdir)/=inst +## Undo the write access. +?TOPDIR? chmod a-w $(distdir) +?TOPDIR? dc_install_base=`CDPATH=: && cd $(distdir)/=inst && pwd` \ +?TOPDIR??DISTCHECK-HOOK? && $(MAKE) $(AM_MAKEFLAGS) distcheck-hook \ +?TOPDIR? && cd $(distdir)/=build \ +?TOPDIR? && ../configure --srcdir=.. --prefix=$$dc_install_base \ +?TOPDIR??GETTEXT? --with-included-gettext \ +?TOPDIR? && $(MAKE) $(AM_MAKEFLAGS) \ +?TOPDIR? && $(MAKE) $(AM_MAKEFLAGS) dvi \ +?TOPDIR? && $(MAKE) $(AM_MAKEFLAGS) check \ +?TOPDIR? && $(MAKE) $(AM_MAKEFLAGS) install \ +?TOPDIR? && $(MAKE) $(AM_MAKEFLAGS) installcheck \ +?TOPDIR? && $(MAKE) $(AM_MAKEFLAGS) uninstall \ +## We use -le 1 because the `dir' file might still exist after uninstall. +?TOPDIR? && test `find $$dc_install_base -type f -print | wc -l` -le 1 \ +?TOPDIR? && $(MAKE) $(AM_MAKEFLAGS) dist \ +?TOPDIR? && $(MAKE) $(AM_MAKEFLAGS) distclean \ +## Make sure to remove the dist file we created in the test build +## directory. +?TOPDIR? && rm -f $(distdir).tar.gz \ +?TOPDIR? && test `find . -type f -print | wc -l` -eq 0 +?TOPDIR? -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) +?TOPDIR? @echo "$(distdir).tar.gz is ready for distribution" | \ +?TOPDIR? sed 'h;s/./=/g;p;x;p;x' -- 2.43.5