From 2cc85799f4d03c1431167ff31560f6e67b4ecf88 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 27 Apr 1996 19:23:46 +0000 Subject: [PATCH] More fixes --- ChangeLog | 19 +++++++++++++ Makefile.in | 33 ++++++++++++--------- NEWS | 1 + TODO | 11 +++++-- automake.in | 71 ++++++++++++++++++++++++++++------------------ data.am | 2 +- header.am | 2 +- lib/am/data.am | 2 +- lib/am/header.am | 2 +- lib/am/scripts.am | 2 +- lib/am/texinfos.am | 2 +- libraries.am | 2 +- programs.am | 2 +- scripts.am | 2 +- tests/Makefile.in | 5 ++-- tests/instman.test | 2 +- texinfos.am | 2 +- 17 files changed, 105 insertions(+), 57 deletions(-) diff --git a/ChangeLog b/ChangeLog index 72080c51..fc278a89 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +Sat Apr 27 11:39:10 1996 Tom Tromey + + * automake.in (handle_configure): Set mkinstalldirs variable + here. + (handle_dist_worker): Explicitly set distdir in subdir makes. + (handle_dist): Handle separate distdir target. + (handle_dist_worker): Only generate distdir target. + + * texinfos.am (install-info): Use $(mkinstalldirs). + * scripts.am (install-@DIR@SCRIPTS): Use $(mkinstalldirs). + * programs.am (install-@DIR@PROGRAMS): Use $(mkinstalldirs). + * libraries.am (install-@DIR@LIBRARIES): Use $(mkinstalldirs). + * header.am (install-@DIR@HEADERS): Use $(mkinstalldirs). + * data.am (install-@DIR@DATA): Use $(mkinstalldirs). + + * automake.in (read_am_file): Set mkinstalldirs variable. + (handle_man_pages): Use it. + (handle_installdirs): Ditto. + Fri Apr 26 15:10:48 1996 Tom Tromey * automake.in (handle_man_pages): Fix mkinstalldirs invocation. diff --git a/Makefile.in b/Makefile.in index bdb41998..737e227b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -71,6 +71,7 @@ CLEANFILES = automake ETAGS_ARGS = automake.in --lang=none \ --regex='/^@node[ \t]+\([^,]+\)/\1/' automake.texi ACLOCAL = aclocal.m4 +mkinstalldirs = $(top_srcdir)/mkinstalldirs SCRIPTS = $(bin_SCRIPTS) $(pkgdata_SCRIPTS) @@ -96,6 +97,8 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(BUILT_SOURCES) $(HEADERS) \ $(TEXINFOS) $(INFOS) $(MANS) $(EXTRA_DIST) $(DATA) DEP_DISTFILES = $(DIST_COMMON) $(SOURCES) $(BUILT_SOURCES) $(HEADERS) \ $(TEXINFOS) $(INFO_DEPS) $(MANS) $(EXTRA_DIST) $(DATA) + +TAR = tar default: all @@ -114,7 +117,7 @@ automake: $(top_builddir)/config.status automake.in cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status install-binSCRIPTS: $(bin_SCRIPTS) - $(top_srcdir)/mkinstalldirs $(bindir) + $(mkinstalldirs) $(bindir) list="$(bin_SCRIPTS)"; for p in $$list; do \ if test -f $$p; then \ $(INSTALL_SCRIPT) $$p $(bindir)/`echo $$p|sed '$(transform)'`; \ @@ -130,7 +133,7 @@ uninstall-binSCRIPTS: done install-pkgdataSCRIPTS: $(pkgdata_SCRIPTS) - $(top_srcdir)/mkinstalldirs $(pkgdatadir) + $(mkinstalldirs) $(pkgdatadir) list="$(pkgdata_SCRIPTS)"; for p in $$list; do \ if test -f $$p; then \ $(INSTALL_SCRIPT) $$p $(pkgdatadir)/`echo $$p|sed '$(transform)'`; \ @@ -179,7 +182,7 @@ automake.info: automake.texi version.texi TEXINPUTS=$(srcdir):$$TEXINPUTS $(TEXI2DVI) $< install-info: $(INFO_DEPS) - $(top_srcdir)/mkinstalldirs $(infodir) + $(mkinstalldirs) $(infodir) for file in $(INFO_DEPS); do \ for ifile in `cd $(srcdir) && echo $$file*`; do \ $(INSTALL_DATA) $(srcdir)/$$ifile $(infodir)/$$ifile; \ @@ -204,7 +207,7 @@ maintainer-clean-info: rm -f $(INFOS) install-pkgdataDATA: $(pkgdata_DATA) - $(top_srcdir)/mkinstalldirs $(pkgdatadir) + $(mkinstalldirs) $(pkgdatadir) list="$(pkgdata_DATA)"; for p in $$list; do \ if test -f $(srcdir)/$$p; then \ $(INSTALL_DATA) $(srcdir)/$$p $(pkgdatadir)/$$p; \ @@ -263,7 +266,11 @@ distclean-tags: maintainer-clean-tags: distdir = $(PACKAGE)-$(VERSION) -dist: $(DEP_DISTFILES) +dist: distdir + chmod -R a+r $(distdir) + $(TAR) chozf $(distdir).tar.gz $(distdir) + rm -rf $(distdir) +distdir: $(DEP_DISTFILES) @if sed 15q $(srcdir)/NEWS | grep -e "$(VERSION)" > /dev/null; then :; else \ echo "NEWS not updated; not releasing" 1>&2; \ exit 1; \ @@ -284,11 +291,9 @@ dist: $(DEP_DISTFILES) || mkdir $(distdir)/$$subdir \ || exit 1; \ chmod 777 $(distdir)/$$subdir; \ - (cd $$subdir && $(MAKE) dist) || exit 1; \ + (cd $$subdir && $(MAKE) distdir=../$(distdir)/$$subdir distdir) \ + || exit 1; \ done - chmod -R a+r $(distdir) - tar chozf $(distdir).tar.gz $(distdir) - rm -rf $(distdir) info: $(INFO_DEPS) info-recursive dvi: $(DVIS) dvi-recursive @@ -319,7 +324,7 @@ all: all-recursive all-am install-strip: $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install installdirs: installdirs-recursive - ./mkinstalldirs $(bindir) $(pkgdatadir) $(infodir) $(pkgdatadir) + $(mkinstalldirs) $(bindir) $(pkgdatadir) $(infodir) $(pkgdatadir) mostlyclean-generic: @@ -369,10 +374,10 @@ uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \ all-recursive check-recursive installcheck-recursive info-recursive \ dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ maintainer-clean-recursive tags mostlyclean-tags distclean-tags \ -clean-tags maintainer-clean-tags dist info dvi check installcheck-local \ -installcheck all-am install-exec-am install-data-am uninstall-am \ -install-exec install-data install uninstall all installdirs \ -mostlyclean-generic distclean-generic clean-generic \ +clean-tags maintainer-clean-tags distdir info dvi check \ +installcheck-local installcheck all-am install-exec-am install-data-am \ +uninstall-am install-exec install-data install uninstall all \ +installdirs mostlyclean-generic distclean-generic clean-generic \ maintainer-clean-generic clean mostlyclean distclean maintainer-clean diff --git a/NEWS b/NEWS index fcf9b017..0c888525 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,7 @@ New in 0.32: Dieter Baron. Other hooks exist, too. * Preliminary (unfinished) support for libtool * Added short option names. +* Better "dist" support when gluing together multiple packages New in 0.31: * Bug fixes diff --git a/TODO b/TODO index 4e4c8f24..dc35961f 100644 --- a/TODO +++ b/TODO @@ -1,12 +1,19 @@ Priorities for release: -* Fix all mkinstalldirs invocations -* separate dist and distdir targets, so recursive uses of Automake work ok * make the auto-dep code crash if GNU make not in use? (doesn't it already?) * Add no-remake option * scripts are installed in $exec_prefix/bin, not $prefix/bin Bug or feature? +Bug: the mkinstalldirs code will fail unless the top-level Makefile is +done first; "automake lib/Makefile Makefile" will fail. + +Right now, targets generated internally (eg "install") are not +overridable by use code. This should probably be possible, even +though it isn't very important. This could be done by generating all +internal rules via a function call instead of just appending to +$output_rules. + * Should be a way to have "nobuild_PROGRAMS" which aren't even built, but which could be by running the magic make command. diff --git a/automake.in b/automake.in index c3c186dc..62a32fd9 100755 --- a/automake.in +++ b/automake.in @@ -879,12 +879,14 @@ sub handle_texinfo if ! $done; ++$done; + local ($conf_pat); + ($conf_pat = $config_aux_dir) =~ s/(\W)/\\$1/g; $output_rules .= &file_contents_with_transform ('s/\@TEXI\@/' . $info_cursor . '/g; ' . 's/\@VTI\@/' . $vti . '/g; ' . 's/\@VTEXI\@/' . $vtexi . '/g;' - . 's,\@MDDIR\@,' . $config_aux_dir . ',g;', + . 's,\@MDDIR\@,' . $conf_pat . ',g;', 'texi-version'); &push_phony_cleaners ($vti); @@ -992,8 +994,7 @@ sub handle_man_pages foreach (keys %sections) { push (@installdirs, '$(mandir)/man' . $_); - $output_rules .= ("\t" . $config_aux_dir - . '/mkinstalldirs $(mandir)/man' + $output_rules .= ("\t" . '$(mkinstalldirs) $(mandir)/man' . $_ . "\n"); } push (@phony, 'install-man'); @@ -1077,10 +1078,7 @@ sub handle_tags # Generate actual 'dist' (or dist-shar) rule. sub handle_dist_worker { - local ($distshar) = @_; - local ($target) = $distshar ? 'dist-shar' : 'dist'; - - $output_rules .= $target . ': $(DEP_DISTFILES)' . "\n"; + $output_rules .= 'distdir: $(DEP_DISTFILES)' . "\n"; # Initialization; only at top level. if ($relative_dir eq '.') @@ -1142,13 +1140,18 @@ sub handle_dist_worker if (&variable_defined ('SUBDIRS')) { # Test for directory existence here because previous automake - # invocation might have created some directories. + # 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. $output_rules .= ' for subdir in $(SUBDIRS); do \\ test -d $(distdir)/$$subdir \\ || mkdir $(distdir)/$$subdir \\ || exit 1; \\ chmod 777 $(distdir)/$$subdir; \\ - (cd $$subdir && $(MAKE) dist) || exit 1; \\ + (cd $$subdir && $(MAKE) distdir=../$(distdir)/$$subdir distdir) \\ + || exit 1; \\ done '; } @@ -1161,22 +1164,7 @@ sub handle_dist_worker $output_rules .= "\t\$(MAKE) dist-hook\n"; } - # Finalize. - if ($relative_dir eq '.') - { - $output_rules .= ' chmod -R a+r $(distdir)' . "\n\t"; - if ($distshar) - { - $output_rules .= 'shar $(distdir) | gzip > $(distdir).shar.gz'; - } - else - { - $output_rules .= '$(TAR) chozf $(distdir).tar.gz $(distdir)'; - } - $output_rules .= "\n\t" . 'rm -rf $(distdir)' . "\n"; - } - - push (@phony, $target); + push (@phony, 'distdir'); } # Handle 'dist' target. @@ -1246,8 +1234,24 @@ sub handle_dist } # Generate 'dist' target, and maybe dist-shar. - &handle_dist_worker (0); - &handle_dist_worker (1) if defined $options{'dist-shar'}; + if ($relative_dir eq '.') + { + $output_rules .= 'dist: distdir' . "\n\t"; + $output_rules .= 'chmod -R a+r $(distdir)' . "\n\t"; + $output_rules .= '$(TAR) chozf $(distdir).tar.gz $(distdir)'; + $output_rules .= "\n\t" . 'rm -rf $(distdir)' . "\n"; + + if (defined $options{'dist-shar'}) + { + $output_rules .= 'dist-shar: distdir' . "\n\t"; + $output_rules .= 'chmod -R a+r $(distdir)' . "\n\t"; + $output_rules .= 'shar $(distdir) | gzip > $(distdir).shar.gz'; + $output_rules .= "\n\t" . 'rm -rf $(distdir)' . "\n"; + } + } + + # Generate distdir target. + &handle_dist_worker; } # Handle auto-dependency code. @@ -1409,6 +1413,17 @@ sub handle_configure $top_reldir = ''; } + # Set location of mkinstalldirs. + if ($config_aux_dir ne '.') + { + $output_vars .= 'mkinstalldirs = ' . $config_aux_dir; + } + else + { + $output_vars .= 'mkinstalldirs = $(top_srcdir)'; + } + $output_vars .= '/mkinstalldirs' . "\n"; + &am_line_error ('CONFIG_HEADER', "\`CONFIG_HEADER' is an anachronism; now determined from \`configure.in'") if &variable_defined ('CONFIG_HEADER'); @@ -1556,7 +1571,7 @@ sub handle_installdirs push (@phony, 'installdirs'); if (@installdirs) { - &pretty_print_rule ("\t$config_aux_dir/mkinstalldirs ", "\t\t", + &pretty_print_rule ("\t" . '$(mkinstalldirs) ', "\t\t", @installdirs); } $output_rules .= "\n"; diff --git a/data.am b/data.am index 8ea1a47e..f27bbdc8 100644 --- a/data.am +++ b/data.am @@ -16,7 +16,7 @@ ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA ## 02111-1307, USA. install-@DIR@DATA: $(@DIR@_DATA) - $(top_srcdir)/mkinstalldirs $(@DIR@dir) + $(mkinstalldirs) $(@DIR@dir) ## Funny invocation because Makefile variable can be empty, leading to ## a syntax error in sh. list="$(@DIR@_DATA)"; for p in $$list; do \ diff --git a/header.am b/header.am index 7b3b0e7c..63eb1e04 100644 --- a/header.am +++ b/header.am @@ -16,7 +16,7 @@ ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA ## 02111-1307, USA. install-@DIR@HEADERS: $(@DIR@_HEADERS) - $(top_srcdir)/mkinstalldirs $(@DIR@dir) + $(mkinstalldirs) $(@DIR@dir) ## Funny invocation because Makefile variable can be empty, leading to ## a syntax error in sh. list="$(@DIR@_HEADERS)"; for p in $$list; do \ diff --git a/lib/am/data.am b/lib/am/data.am index 8ea1a47e..f27bbdc8 100644 --- a/lib/am/data.am +++ b/lib/am/data.am @@ -16,7 +16,7 @@ ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA ## 02111-1307, USA. install-@DIR@DATA: $(@DIR@_DATA) - $(top_srcdir)/mkinstalldirs $(@DIR@dir) + $(mkinstalldirs) $(@DIR@dir) ## Funny invocation because Makefile variable can be empty, leading to ## a syntax error in sh. list="$(@DIR@_DATA)"; for p in $$list; do \ diff --git a/lib/am/header.am b/lib/am/header.am index 7b3b0e7c..63eb1e04 100644 --- a/lib/am/header.am +++ b/lib/am/header.am @@ -16,7 +16,7 @@ ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA ## 02111-1307, USA. install-@DIR@HEADERS: $(@DIR@_HEADERS) - $(top_srcdir)/mkinstalldirs $(@DIR@dir) + $(mkinstalldirs) $(@DIR@dir) ## Funny invocation because Makefile variable can be empty, leading to ## a syntax error in sh. list="$(@DIR@_HEADERS)"; for p in $$list; do \ diff --git a/lib/am/scripts.am b/lib/am/scripts.am index 997e05f8..d881f1e8 100644 --- a/lib/am/scripts.am +++ b/lib/am/scripts.am @@ -16,7 +16,7 @@ ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA ## 02111-1307, USA. install-@DIR@SCRIPTS: $(@DIR@_SCRIPTS) - $(top_srcdir)/mkinstalldirs $(@DIR@dir) + $(mkinstalldirs) $(@DIR@dir) ## Funny invocation because Makefile variable can be empty, leading to ## a syntax error in sh. list="$(@DIR@_SCRIPTS)"; for p in $$list; do \ diff --git a/lib/am/texinfos.am b/lib/am/texinfos.am index 7b6f7545..7b22be90 100644 --- a/lib/am/texinfos.am +++ b/lib/am/texinfos.am @@ -26,7 +26,7 @@ ## rebuilt in the build directory. Can't cd to srcdir; that might ## break a possible install-sh reference. install-info: $(INFO_DEPS) - $(top_srcdir)/mkinstalldirs $(infodir) + $(mkinstalldirs) $(infodir) for file in $(INFO_DEPS); do \ ## We use these strange circumlocutions because we want the "ifile" to ## be relative, for the install. diff --git a/libraries.am b/libraries.am index cb201879..99a049a5 100644 --- a/libraries.am +++ b/libraries.am @@ -16,7 +16,7 @@ ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA ## 02111-1307, USA. install-@DIR@LIBRARIES: $(@DIR@_LIBFILES) - $(top_srcdir)/mkinstalldirs $(@DIR@dir) + $(mkinstalldirs) $(@DIR@dir) ## Funny invocation because Makefile variable can be empty, leading to ## a syntax error in sh. list="$(@DIR@_LIBFILES)"; for p in $$list; do \ diff --git a/programs.am b/programs.am index 490edcb9..afaa4300 100644 --- a/programs.am +++ b/programs.am @@ -16,7 +16,7 @@ ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA ## 02111-1307, USA. install-@DIR@PROGRAMS: $(@DIR@_PROGRAMS) - $(top_srcdir)/mkinstalldirs $(@DIR@dir) + $(mkinstalldirs) $(@DIR@dir) ## Funny invocation because Makefile variable can be empty, leading to ## a syntax error in sh. list="$(@DIR@_PROGRAMS)"; for p in $$list; do \ diff --git a/scripts.am b/scripts.am index 997e05f8..d881f1e8 100644 --- a/scripts.am +++ b/scripts.am @@ -16,7 +16,7 @@ ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA ## 02111-1307, USA. install-@DIR@SCRIPTS: $(@DIR@_SCRIPTS) - $(top_srcdir)/mkinstalldirs $(@DIR@dir) + $(mkinstalldirs) $(@DIR@dir) ## Funny invocation because Makefile variable can be empty, leading to ## a syntax error in sh. list="$(@DIR@_SCRIPTS)"; for p in $$list; do \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 99a6d19b..dfad26da 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -47,6 +47,7 @@ canon.test installsh.test empty.test rulepat.test insh.test canon2.test \ target.test extra.test noinst.test instman.test EXTRA_DIST = defs $(TESTS) +mkinstalldirs = $(top_srcdir)/mkinstalldirs DIST_COMMON = ChangeLog Makefile.am Makefile.in @@ -73,7 +74,7 @@ TAGS: subdir = tests distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) -dist: $(DEP_DISTFILES) +distdir: $(DEP_DISTFILES) @for file in `cd $(srcdir) && echo $(DISTFILES)`; do \ test -f $(distdir)/$$file \ || ln $(srcdir)/$$file $(distdir)/$$file 2> /dev/null \ @@ -148,7 +149,7 @@ maintainer-clean: maintainer-clean-generic distclean @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." -.PHONY: default tags dist check-TESTS info dvi check installcheck \ +.PHONY: default tags distdir check-TESTS info dvi check installcheck \ install-exec install-data install uninstall all installdirs \ mostlyclean-generic distclean-generic clean-generic \ maintainer-clean-generic clean mostlyclean distclean maintainer-clean diff --git a/tests/instman.test b/tests/instman.test index 4ba14a6b..4aa1b470 100755 --- a/tests/instman.test +++ b/tests/instman.test @@ -13,5 +13,5 @@ EOF $AUTOMAKE || exit 1 -grep '[^/]mkinstalldirs' Makefile.in && exit 1 +grep '[^(/]mkinstalldirs' Makefile.in && exit 1 exit 0 diff --git a/texinfos.am b/texinfos.am index 7b6f7545..7b22be90 100644 --- a/texinfos.am +++ b/texinfos.am @@ -26,7 +26,7 @@ ## rebuilt in the build directory. Can't cd to srcdir; that might ## break a possible install-sh reference. install-info: $(INFO_DEPS) - $(top_srcdir)/mkinstalldirs $(infodir) + $(mkinstalldirs) $(infodir) for file in $(INFO_DEPS); do \ ## We use these strange circumlocutions because we want the "ifile" to ## be relative, for the install. -- 2.43.5