From f48c7849224e3b2081ca1bd5517bc542eb156bb5 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Wed, 21 Feb 2001 08:20:39 +0000 Subject: [PATCH] * 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. --- ChangeLog | 15 +++++++++ Makefile.in | 42 ++++++++++------------- NEWS | 2 +- aclocal.m4 | 2 +- automake.in | 73 ++++++++-------------------------------- distdir.am | 70 ++++++++++++++++++++++++++++++++++++-- lib/am/distdir.am | 70 ++++++++++++++++++++++++++++++++++++-- tests/target-cflags.test | 23 +++++++++---- 8 files changed, 202 insertions(+), 95 deletions(-) diff --git a/ChangeLog b/ChangeLog index 492a8062..652635b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2001-02-21 Akim Demaille + + * 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. + 2001-02-20 Tom Tromey * m4/init.m4 (AM_INIT_AUTOMAKE): Simplify m4_pattern_allow diff --git a/Makefile.in b/Makefile.in index 8a183c90..34dfb705 100644 --- a/Makefile.in +++ b/Makefile.in @@ -486,29 +486,13 @@ distcheck: dist 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 \ @@ -532,6 +516,15 @@ distdir: $(DISTFILES) || 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 @@ -558,8 +551,7 @@ uninstall-am: uninstall-binSCRIPTS uninstall-info \ uninstall: uninstall-recursive all-am: Makefile $(INFO_DEPS) $(SCRIPTS) $(DATA) install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - INSTALL_PROGRAM_ENV='$(INSTALL_STRIP_PROGRAM_ENV)' install + $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install installdirs: installdirs-recursive installdirs-am: $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(infodir) \ @@ -583,6 +575,8 @@ clean: clean-recursive clean-am: clean-generic mostlyclean-am +dist-all: dist + distclean: distclean-recursive -rm -f config.status @@ -599,10 +593,10 @@ 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 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 \ diff --git a/NEWS b/NEWS index 00408795..c38f9144 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -New in 1.4d: +New in 1.4e: * Support for `configure.ac'. New in 1.4b: diff --git a/aclocal.m4 b/aclocal.m4 index 10a1adbe..663cf238 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,4 +1,4 @@ -# aclocal.m4 generated automatically by aclocal 1.4e +# aclocal.m4 generated automatically by aclocal 1.4c # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000 # Free Software Foundation, Inc. diff --git a/automake.in b/automake.in index 81a339a5..7cb25496 100755 --- a/automake.in +++ b/automake.in @@ -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. @@ -3917,6 +3904,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{$_}; @@ -6626,45 +6616,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. @@ -6759,6 +6710,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 diff --git a/distdir.am b/distdir.am index 45be9468..ac168943 100644 --- a/distdir.am +++ b/distdir.am @@ -23,14 +23,14 @@ distdir: $(DISTFILES) ## 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 @@ distdir: $(DISTFILES) ?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) diff --git a/lib/am/distdir.am b/lib/am/distdir.am index 45be9468..ac168943 100644 --- a/lib/am/distdir.am +++ b/lib/am/distdir.am @@ -23,14 +23,14 @@ distdir: $(DISTFILES) ## 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 @@ distdir: $(DISTFILES) ?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) diff --git a/tests/target-cflags.test b/tests/target-cflags.test index 5f07ba1c..208109de 100755 --- a/tests/target-cflags.test +++ b/tests/target-cflags.test @@ -46,9 +46,20 @@ $needs_autoconf # Likewise for GNU make. ($MAKE --version) > /dev/null 2>&1 || exit 77 -$ACLOCAL \ - && $AUTOCONF \ - && $AUTOMAKE -a \ - && mkdir obj \ - && (cd obj && ../configure && $MAKE && ./foo && ./bar) \ - && ./configure && $MAKE && ./foo && ./bar +set -e + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a +mkdir obj +( + cd obj + ../configure + $MAKE + /foo + ./bar +) +./configure +$MAKE +./foo +./bar -- 2.43.5