This is the mail archive of the automake@gnu.org mailing list for the automake project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

33-dist-flavors.patch


This patch includes all the diffs of Makefile.ins, i.e., subdirs'
Makefile have not changed.  The big change in the top Makefile.in
comes from the fact that the so called `find complex command' is
attached to distdir (where it belongs IMHO), rather than to each
dist-like target.

But I also introduced a bug, due to my misunderstanding the
functioning of the @dist_targets handling.  Patch 35 fixes it.  The
bug can be observed in ./Makefile.in: *after* tarball was made, the
dist-info hook is run.

Index: ChangeLog
from  Akim Demaille  <akim@epita.fr>

	* distdir.am (distdir): Be sure to have permissive rights on its
	contents.
	(dist-all, dist-bzip2, dist-zip, dist-tarZ): New conditional
	targets.
	And BTW, all these guys are phony.
	* automake.in (&handle_dist_worker): As its name doesn't indicate,
	output distributions.
	(&handle_dist): As its name doesn't indicate, don't.
	(&initialize_global_constants): Don't define variables which
	content is now handled by distdir.am.
	But register `dist-all' as a factored target.
	(&handle_factored_dependencies): Don't output empty targets.

Index: automake.in
--- automake.in Sat, 17 Feb 2001 17:56:59 +0100 akim (am/f/39_automake.i 1.40 755)
+++ automake.in Sat, 17 Feb 2001 18:10:07 +0100 akim (am/f/39_automake.i 1.40 755)
@@ -2663,9 +2663,13 @@ sub handle_dist_worker
     $output_rules .=
       &file_contents ('distdir',
 		      $xform
-		      . &transform_cond ('CYGNUS' => $cygnus_mode,
-					 'SUBDIRS'
-					 => &variable_defined ('SUBDIRS')));
+		      . &transform_cond ('CYGNUS'   => $cygnus_mode,
+					 'SHAR'     => $options{'dist-shar'},
+					 'BZIP2'    => $options{'dist-bzip2'},
+					 'ZIP'      => $options{'dist-zip'},
+					 'COMPRESS' => $options{'dist-tarZ'},
+					 'SUBDIRS'  =>
+					    &variable_defined ('SUBDIRS')));

     # If the target `dist-hook' exists, make sure it is run.  This
     # allows users to do random weird things to the distribution
@@ -2798,23 +2802,6 @@ sub handle_dist

 	# Arg, this file should have been named `distcheck'.
 	$output_rules .= &file_contents ('dist', $xform);
-
-	local ($dist_all) = ('dist-all: distdir' . "\n"
-			     . $dist_header);
-	local ($curs);
-	foreach $curs ('dist', 'dist-shar', 'dist-zip', 'dist-tarZ',
-		       'dist-bzip2')
-	{
-	    if (defined $options{$curs} || $curs eq 'dist')
-	    {
-		$output_rules .= ($curs . ': distdir' . "\n"
-				  . $dist_header
-				  . $dist{$curs}
-				  . $dist_trailer);
-		$dist_all .= $dist{$curs};
-	    }
-	}
-	$output_rules .= $dist_all . $dist_trailer;
     }

     # Generate distdir target.
@@ -3909,6 +3896,9 @@ sub handle_factored_dependencies
 {
     foreach (sort target_cmp keys %dependencies)
     {
+        # If there is nothing about this guy, skip it.
+        next
+	  unless @{$dependencies{$_}} || $actions{$_};
         &pretty_print_rule ("$_:", "\t",
 			    sort @{$dependencies{$_}});
 	$output_rules .= $actions{$_};
@@ -6618,45 +6608,6 @@ sub initialize_global_constants
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.
 ";
-
-    # This complex find command will try to avoid changing the modes of
-    # links into the source tree, in case they're hard-linked.  It will
-    # also make directories writable by everybody, because some
-    # brain-dead tar implementations change ownership and permissions of
-    # a directory before extracting the files, thus becoming unable to
-    # extract them.
-    # Ignore return result from chmod, because it might give an error
-    # if we chmod a symlink.
-    # Another nastiness: if the file is unreadable by us, we make it
-    # readable regardless of the number of links to it.  This only
-    # happens in perverse cases.
-    # We use $(install_sh) because that is a known-portable way to
-    # modify the file in place in the source tree.
-    $dist_header = '	-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \\
-	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \\
-	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \\
-	  ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \\
-	|| chmod -R a+r $(distdir)
-';
-    $dist{'dist-bzip2'} = ("\t"
-			   . '$(AMTAR) chof - $(distdir) | bzip2 -9 -c > $(distdir).tar.bz2'
-			   . "\n");
-    $dist{'dist-tarZ'} = ("\t"
-		     . '$(AMTAR) chof - $(distdir) | compress -c > $(distdir).tar.Z'
-		     . "\n");
-    $dist{'dist-shar'} = ("\t"
-		     . 'shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c > $(distdir).shar.gz'
-		     . "\n");
-    $dist{'dist-zip'} = ("\t" . '-rm -f $(distdir).zip' . "\n" .
-			 "\t" . 'zip -rq $(distdir).zip $(distdir)' . "\n");
-
-    # Note that we don't use GNU tar's `-z' option.  One reason (but
-    # not the only reason) is that some versions of tar (e.g., OSF1)
-    # interpret `-z' differently.
-    $dist{'dist'} = ("\t"
-		     .  '$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c > $(distdir).tar.gz'
-		     . "\n");
-    $dist_trailer = "\t" . '-chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)' . "\n";
 }

 # (Re)-Initialize per-Makefile.am variables.
@@ -6751,6 +6702,10 @@ sub initialize_per_input
        'mostlyclean'          => [],
        'maintainer-clean'     => [],
        'distclean'            => [],
+
+       # Building all the flavors of distributions.
+       'dist-all'             => [],
+
        '.PHONY'               => []
       );
     # Holds the factored actions.  Tied to %DEPENDENCIES, i.e., filled
Index: distdir.am
--- distdir.am Fri, 09 Feb 2001 04:37:00 +0100 akim (am/h/17_distdir.am 1.4 644)
+++ distdir.am Sat, 17 Feb 2001 18:13:43 +0100 akim (am/h/17_distdir.am 1.4 644)
@@ -23,14 +23,14 @@
 ## For Gnits users, this is pretty handy.  Look at 15 lines
 ## in case some explanatory text is desirable.
 ##
-?TOPDIR??CK-NEWS?	@if sed 15q $(srcdir)/NEWS | fgrep -e "$(VERSION)" > /dev/null; then :; else \
+?TOPDIR??CK-NEWS?	@if sed 15q $(srcdir)/NEWS | fgrep -e "$(VERSION)" >/dev/null; then :; else \
 ?TOPDIR??CK-NEWS?	  echo "NEWS not updated; not releasing" 1>&2; \
 ?TOPDIR??CK-NEWS?	  exit 1; \
 ?TOPDIR??CK-NEWS?	fi
 ##
 ## Only for the top dir.
 ##
-?TOPDIR?	-chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
+?TOPDIR?	-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
 ?TOPDIR?	mkdir $(distdir)
 ##
 ##
@@ -80,3 +80,69 @@
 ?SUBDIRS?	      || exit 1; \
 ?SUBDIRS?	  fi; \
 ?SUBDIRS?	done
+##
+## This complex find command will try to avoid changing the modes of
+## links into the source tree, in case they're hard-linked.  It will
+## also make directories writable by everybody, because some
+## brain-dead tar implementations change ownership and permissions of
+## a directory before extracting the files, thus becoming unable to
+## extract them.
+##
+## Ignore return result from chmod, because it might give an error
+## if we chmod a symlink.
+##
+## Another nastiness: if the file is unreadable by us, we make it
+## readable regardless of the number of links to it.  This only
+## happens in perverse cases.
+##
+## We use $(install_sh) because that is a known-portable way to modify
+## the file in place in the source tree.
+##
+?TOPDIR?	-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+?TOPDIR?	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+?TOPDIR?	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+?TOPDIR?	  ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+?TOPDIR?	|| chmod -R a+r $(distdir)
+
+
+
+
+## --------------------------------------- ##
+## Building various distribution flavors.  ##
+## --------------------------------------- ##
+
+## Note that we don't use GNU tar's `-z' option.  One reason (but not
+## the only reason) is that some versions of tar (e.g., OSF1)
+## interpret `-z' differently.
+
+?TOPDIR?.PHONY: dist-all dist
+?TOPDIR?dist-all: dist
+?TOPDIR?dist: distdir
+?TOPDIR?	$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+?TOPDIR?	-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
+
+
+?TOPDIR??BZIP2?.PHONY dist-all: dist-bzip2
+?TOPDIR??BZIP2?.PHONY: dist-bzip2
+?TOPDIR??BZIP2?dist-bzip2: distdir
+?TOPDIR??BZIP2?	$(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2
+?TOPDIR??BZIP2?	-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
+
+
+?TOPDIR??COMPRESS?.PHONY dist-all: dist-tarZ
+?TOPDIR??COMPRESS?dist-tarZ: distdir
+?TOPDIR??COMPRESS?	$(AMTAR) chof - $(distdir) | compress -c >$(distdir).tar.Z
+?TOPDIR??COMPRESS?	-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
+
+
+?TOPDIR??SHAR?.PHONY dist-all: dist-shar
+?TOPDIR??SHAR?dist-shar: distdir
+?TOPDIR??SHAR?	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+?TOPDIR??SHAR?	-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
+
+
+?TOPDIR??ZIP?.PHONY dist-all: dist-zip
+?TOPDIR??ZIP?dist-zip: distdir
+?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)
Index: Makefile.in
--- Makefile.in Sat, 17 Feb 2001 17:56:59 +0100 akim (am/h/16_Makefile.i 1.12 644)
+++ Makefile.in Sat, 17 Feb 2001 18:15:07 +0100 akim (am/h/16_Makefile.i 1.12 644)
@@ -481,29 +481,13 @@
 	echo "$$dashes"; \
 	echo "$$banner"; \
 	echo "$$dashes"
-dist: distdir
-	-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
-	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
-	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
-	  ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
-	|| 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)
-dist-all: distdir
-	-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
-	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
-	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
-	  ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
-	|| 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 \
+	@if sed 15q $(srcdir)/NEWS | fgrep -e "$(VERSION)" >/dev/null; then :; else \
 	  echo "NEWS not updated; not releasing" 1>&2; \
 	  exit 1; \
 	fi
-	-chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
+	-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
 	mkdir $(distdir)
 	$(mkinstalldirs) $(distdir)/. .
 	@for file in $(DISTFILES); do \
@@ -527,6 +511,15 @@
 	      || exit 1; \
 	  fi; \
 	done
+	-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+	  ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+	|| chmod -R a+r $(distdir)
+
+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)
 	$(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-info
 info-am: $(INFO_DEPS)
 info: info-recursive
@@ -577,6 +570,8 @@

 clean-am: clean-generic mostlyclean-am

+dist-all: dist
+
 distclean: distclean-recursive
 	-rm -f config.status

@@ -593,10 +588,10 @@
 mostlyclean-am: mostlyclean-aminfo mostlyclean-generic mostlyclean-vti

 .PHONY: all all-am all-recursive check check-am check-recursive clean \
-	clean-generic clean-recursive 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 \
+	clean-generic clean-recursive dist dist-all 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 \
 	install-data-recursive install-dist_pkgdataDATA \
 	install-dist_scriptDATA install-exec install-exec-am \
 	install-exec-recursive install-info-am install-recursive \


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]