From b22021232a2e42c90289a5185ca4ddf6afc688b1 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 28 Sep 1998 01:51:04 +0000 Subject: [PATCH] `.' in SUBDIRS changes order of builds: * Makefile.am (SUBDIRS): Added `.'. Put tests last. * tags.am (TAGS): Don't look for TAGS file in `.'. * automake.texi (Top level): Document SUBDIRS change. * automake.in (handle_installdirs): Create separate installdirs-am target. (handle_merge_targets): Don't put all-am onto @all. Fixed error message. Correctly handle install-info. Give error if install-info-local inappropriately defined. Don't special-case install-data, install-exec, install, uninstall, or all. (handle_subdirs): Don't push `-recursive' target names onto corresponding lists. (do_one_merge_target): Always define `-am' form of rule, and point ordinary form to `-am' or `-recursive' as appropriate. Special-case `all'. (do_check_merge_target): Generate check-am target. (handle_dist_worker): Use target_defined. (handle_dist): Likewise. (handle_merge_targets): Likewise. (do_one_merge_target): Likewise. (do_check_merge_target): Likewise. (do_one_clean_target): Likewise. (initialize_per_input): Initialize $all_target. (do_one_clean_target): Always generate -am form of rule; other changes for new SUBDIRS change. (handle_clean): Always generate clean-am form of rule. (handle_tags): Only build subdir if not `.'. (handle_dist_worker): Skip `.' directory. * subdirs.am: Allow `.' to be specified in SUBDIRS. --- ChangeLog | 32 ++++ Makefile.am | 4 +- Makefile.in | 124 +++++++++------- TODO | 10 +- automake.in | 353 ++++++++++++++++----------------------------- automake.texi | 7 +- lib/am/Makefile.am | 4 +- lib/am/subdirs.am | 29 +++- lib/am/tags.am | 5 +- m4/Makefile.in | 65 +++++---- stamp-vti | 2 +- subdirs.am | 29 +++- tags.am | 5 +- version.texi | 2 +- 14 files changed, 341 insertions(+), 330 deletions(-) diff --git a/ChangeLog b/ChangeLog index 21e83931..a560ae14 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,35 @@ +Mon Sep 28 00:03:45 1998 Tom Tromey + + `.' in SUBDIRS changes order of builds: + * Makefile.am (SUBDIRS): Added `.'. Put tests last. + * tags.am (TAGS): Don't look for TAGS file in `.'. + * automake.texi (Top level): Document SUBDIRS change. + * automake.in (handle_installdirs): Create separate installdirs-am + target. + (handle_merge_targets): Don't put all-am onto @all. Fixed error + message. Correctly handle install-info. Give error if + install-info-local inappropriately defined. Don't special-case + install-data, install-exec, install, uninstall, or all. + (handle_subdirs): Don't push `-recursive' target names onto + corresponding lists. + (do_one_merge_target): Always define `-am' form of rule, and point + ordinary form to `-am' or `-recursive' as appropriate. + Special-case `all'. + (do_check_merge_target): Generate check-am target. + (handle_dist_worker): Use target_defined. + (handle_dist): Likewise. + (handle_merge_targets): Likewise. + (do_one_merge_target): Likewise. + (do_check_merge_target): Likewise. + (do_one_clean_target): Likewise. + (initialize_per_input): Initialize $all_target. + (do_one_clean_target): Always generate -am form of rule; other + changes for new SUBDIRS change. + (handle_clean): Always generate clean-am form of rule. + (handle_tags): Only build subdir if not `.'. + (handle_dist_worker): Skip `.' directory. + * subdirs.am: Allow `.' to be specified in SUBDIRS. + Sun Sep 27 20:02:21 1998 Tom Tromey * automake.texi (Dist): Document EXTRA_DIST change. diff --git a/Makefile.am b/Makefile.am index 7e1e05d2..300d61c6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,7 +3,9 @@ AUTOMAKE_OPTIONS = gnits MAINT_CHARSET = latin1 -SUBDIRS = tests m4 +## We need `.' in SUBDIRS because we want `check' to build `.' before +## tests. +SUBDIRS = . m4 tests bin_SCRIPTS = automake aclocal info_TEXINFOS = automake.texi diff --git a/Makefile.in b/Makefile.in index f9ae8df9..522871cd 100644 --- a/Makefile.in +++ b/Makefile.in @@ -66,7 +66,7 @@ VERSION = @VERSION@ AUTOMAKE_OPTIONS = gnits MAINT_CHARSET = latin1 -SUBDIRS = tests m4 +SUBDIRS = . tests m4 bin_SCRIPTS = automake aclocal info_TEXINFOS = automake.texi @@ -110,8 +110,7 @@ stamp-vti texinfo.tex version.texi ylwrap DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) GZIP = --best -all: all-recursive all-am - +all: all-redirect .SUFFIXES: .SUFFIXES: .dvi .info .ps .texi .texinfo .txi $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) @@ -339,28 +338,46 @@ all-recursive install-data-recursive install-exec-recursive \ installdirs-recursive install-recursive uninstall-recursive \ check-recursive installcheck-recursive info-recursive dvi-recursive: @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ - target=`echo $@ | sed s/-recursive//`; \ echo "Making $$target in $$subdir"; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target) \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done && test -z "$$fail" + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ rev="$$subdir $$rev"; \ + test "$$subdir" = "." && dot_seen=yes; \ done; \ + test "$$dot_seen" = "no" && rev=". $$rev"; \ + target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ - target=`echo $@ | sed s/-recursive//`; \ echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done tags: TAGS @@ -373,7 +390,9 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) tags=; \ here=`pwd`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ - test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ + fi; \ done; \ list='$(SOURCES) $(HEADERS)'; \ unique=`for i in $$list; do echo $$i; done | \ @@ -440,48 +459,49 @@ distdir: $(DISTFILES) d=$(srcdir); \ if test -d $$d/$$file; then \ cp -pr $$/$$file $(distdir)/$$file; \ - else\ + else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || cp -p $$d/$$file $(distdir)/$$file; \ fi; \ done for subdir in $(SUBDIRS); do \ - test -d $(distdir)/$$subdir \ - || mkdir $(distdir)/$$subdir \ - || exit 1; \ - chmod 777 $(distdir)/$$subdir; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \ + if test "$$srcdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ || exit 1; \ + chmod 777 $(distdir)/$$subdir; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \ + || exit 1; \ + fi; \ done $(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-info -info: $(INFO_DEPS) info-recursive -dvi: $(DVIS) dvi-recursive -check: all-am - $(MAKE) $(AM_MAKEFLAGS) check-recursive -installcheck: installcheck-recursive installcheck-local -all-am: Makefile $(INFO_DEPS) $(SCRIPTS) $(DATA) - +info-am: $(INFO_DEPS) +info: info-recursive +dvi-am: $(DVIS) +dvi: dvi-recursive +check-am: all-am +check: check-recursive +installcheck-am: installcheck-local +installcheck: installcheck-recursive install-exec-am: install-binSCRIPTS +install-exec: install-exec-recursive -install-data-am: install-info-am install-pkgdataSCRIPTS install-pkgdataDATA - -uninstall-am: uninstall-binSCRIPTS uninstall-pkgdataSCRIPTS uninstall-info uninstall-pkgdataDATA - -install-exec: install-exec-recursive install-exec-am - @$(NORMAL_INSTALL) - -install-data: install-data-recursive install-data-am - @$(NORMAL_INSTALL) - -install: install-recursive install-exec-am install-data-am - @: - -uninstall: uninstall-recursive uninstall-am +install-data-am: install-info-am install-pkgdataSCRIPTS \ + install-pkgdataDATA +install-data: install-data-recursive +install-am: install-exec-am install-data-am +install: install-recursive +uninstall-am: uninstall-binSCRIPTS uninstall-pkgdataSCRIPTS \ + uninstall-info uninstall-pkgdataDATA +uninstall: uninstall-recursive +all-am: Makefile $(INFO_DEPS) $(SCRIPTS) $(DATA) +all-redirect: all-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install installdirs: installdirs-recursive +installdirs-am: $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(pkgdatadir) \ $(DESTDIR)$(infodir) $(DESTDIR)$(pkgdatadir) @@ -496,30 +516,30 @@ distclean-generic: maintainer-clean-generic: mostlyclean-am: mostlyclean-vti mostlyclean-aminfo mostlyclean-tags \ - mostlyclean-generic + mostlyclean-generic clean-am + +mostlyclean: mostlyclean-recursive clean-am: clean-vti clean-aminfo clean-tags clean-generic \ mostlyclean-am +clean: clean-recursive + distclean-am: distclean-vti distclean-aminfo distclean-tags \ distclean-generic clean-am + -rm -f config.status + +distclean: distclean-recursive maintainer-clean-am: maintainer-clean-vti maintainer-clean-aminfo \ maintainer-clean-tags maintainer-clean-generic \ distclean-am - -mostlyclean: mostlyclean-recursive mostlyclean-am - -clean: clean-recursive clean-am - -distclean: distclean-recursive distclean-am - -rm -f config.status - -maintainer-clean: maintainer-clean-recursive maintainer-clean-am @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." -rm -f config.status +maintainer-clean: maintainer-clean-recursive + .PHONY: uninstall-binSCRIPTS install-binSCRIPTS uninstall-pkgdataSCRIPTS \ install-pkgdataSCRIPTS mostlyclean-vti distclean-vti clean-vti \ maintainer-clean-vti install-info-am uninstall-info mostlyclean-aminfo \ @@ -530,11 +550,13 @@ 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 tags-recursive mostlyclean-tags \ -distclean-tags clean-tags maintainer-clean-tags distdir info dvi \ -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 +distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +dvi-am dvi check check-am installcheck-local installcheck-am \ +installcheck install-exec-am install-exec install-data-am install-data \ +install-am install uninstall-am uninstall all-redirect all-am all \ +installdirs-am installdirs mostlyclean-generic distclean-generic \ +clean-generic maintainer-clean-generic clean mostlyclean distclean \ +maintainer-clean installcheck-local: diff --git a/TODO b/TODO index 83ba35eb..ebdec980 100644 --- a/TODO +++ b/TODO @@ -44,12 +44,6 @@ DONE: but needs to be documented * Should have a --copy like libtoolize Should be able to update files that would be installed with -a -* when cleaning, should recurse depth first - -* quoting bugs - - how to install file with a space in its name? - [ don't bother with this -- make is just too losing ] - * "make diff" capability look at gcc's Makefile.in to see what to do or look at maint program @@ -578,3 +572,7 @@ Is this worth implementing? Scan source directories and warn about missing files, eg .c/.h files that aren't mentioned? [ distcheck makes this less useful ] + +* quoting bugs + - how to install file with a space in its name? + [ don't bother with this -- make is just too losing ] diff --git a/automake.in b/automake.in index 471a5b63..3054f15b 100755 --- a/automake.in +++ b/automake.in @@ -2335,7 +2335,7 @@ sub handle_tags . "\tlist=\'\$(SUBDIRS)\'; for subdir in \$\$list; do \\\n" # Never fail here if a subdir fails; it # isn't important. - . "\t (cd \$\$subdir" + . "\t test \"\$\$subdir\" = . || (cd \$\$subdir" . " && \$(MAKE) \$(AM_MAKEFLAGS) tags); \\\n" . "\tdone\n"); push (@tag_deps, 'tags-recursive'); @@ -2545,22 +2545,24 @@ sub handle_dist_worker # correctly with an enclosing package. $output_rules .= ("\t" . 'for subdir in $(' . $dist_subdir_name . '); do ' . "\\\n" - . "\t" . ' test -d $(distdir)/$$subdir ' . "\\\n" - . "\t" . ' || mkdir $(distdir)/$$subdir ' . "\\\n" - . "\t" . ' || exit 1; ' . "\\\n" - . "\t" . ' chmod 777 $(distdir)/$$subdir; ' . "\\\n" - . "\t" . ' (cd $$subdir' + . "\t" . ' if test "$$srcdir" = .; then :; else ' . "\\\n" + . "\t" . ' test -d $(distdir)/$$subdir ' . "\\\n" + . "\t" . ' || mkdir $(distdir)/$$subdir ' . "\\\n" + . "\t" . ' || exit 1; ' . "\\\n" + . "\t" . ' chmod 777 $(distdir)/$$subdir; ' . "\\\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" . ' || exit 1; ' . "\\\n" + . "\t" . ' fi; ' . "\\\n" . "\tdone\n"); } # 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 defined $contents{'dist-hook'}; + push (@dist_targets, 'dist-hook') if &target_defined ('dist-hook'); local ($targ); foreach $targ (@dist_targets) @@ -2669,7 +2671,7 @@ distcheck: dist mkdir $(distdir)/=build mkdir $(distdir)/=inst dc_install_base=`cd $(distdir)/=inst && pwd`; \\' - . (defined $contents{'distcheck-hook'} + . (&target_defined ('distcheck-hook') ? ("\t\$(MAKE) \$(AM_MAKEFLAGS)" . " distcheck-hook") : '') @@ -2912,11 +2914,6 @@ sub handle_subdirs } &push_phony_cleaners ('recursive'); - push (@check_tests, "check-recursive"); - push (@installcheck, "installcheck-recursive"); - push (@info, "info-recursive"); - push (@dvi, "dvi-recursive"); - $recursive_install = 1; } @@ -3398,10 +3395,18 @@ sub handle_footer sub handle_installdirs { # GNU Makefile standards recommend this. - $output_rules .= ("installdirs:" - . ($recursive_install - ? " installdirs-recursive\n" - : "\n")); + if ($recursive_install) + { + # We create a separate `-am' target so that the -recursive + # rule will work correctly. + $output_rules .= ("installdirs: installdirs-recursive\n" + . "installdirs-am:\n"); + push (@phony, 'installdirs-am'); + } + else + { + $output_rules .= "installdirs:\n"; + } push (@phony, 'installdirs'); if (@installdirs) { @@ -3447,18 +3452,12 @@ sub handle_merge_targets if (defined $options{'no-installinfo'}) { - # FIXME: this is kind of a hack; should find another way to - # know that this is required. - local (@dirs); - if (grep ($_ eq 'install-info-am', @phony)) - { - push (@dirs, 'install-info-am'); - } - if (&variable_defined ('SUBDIRS')) - { - push (@dirs, 'install-info-recursive'); - } - &do_one_merge_target ('install-info', @dirs); + &do_one_merge_target ('install-info', ''); + } + elsif (&target_defined ('install-info-local')) + { + &am_line_error ('install-info-local', + "\`install-info-local' target defined but \`no-installinfo' option not in use"); } # Handle the various install targets specially. We do this so @@ -3468,16 +3467,16 @@ sub handle_merge_targets # targets we handle. "all" is treated as one of these since # "install" can run it. push (@install_exec, 'install-exec-local') - if defined $contents{'install-exec-local'}; + if &target_defined ('install-exec-local'); push (@install_data, 'install-data-local') - if defined $contents{'install-data-local'}; + if &target_defined ('install-data-local'); push (@uninstall, 'uninstall-local') - if defined $contents{'uninstall-local'}; + if &target_defined ('uninstall-local'); local ($utarg); foreach $utarg ('uninstall-data-local', 'uninstall-data-hook', 'uninstall-exec-local', 'uninstall-exec-hook') { - if (defined $contents{$utarg}) + if (&target_defined ($utarg)) { local ($x); ($x = $utarg) =~ s/(data|exec)-//; @@ -3485,163 +3484,69 @@ sub handle_merge_targets } } push (@all, 'all-local') - if defined $contents{'all-local'}; + if &target_defined ('all-local'); - if (defined $contents{'install-local'}) + if (&target_defined ('install-local')) { &am_line_error ('install-local', - "use \`install-data' or \`install-exec', not \`install'"); + "use \`install-data-local' or \`install-exec-local', not \`install-local'"); } - # Step two: if we are doing recursive makes, write out the - # appropriate rules. - local (@install); - if ($recursive_install) + if (@all) { - push (@install, 'install-recursive'); - - if (@all) + local ($one_name); + local ($local_headers) = ''; + foreach $one_name (@config_names) { - local (@hackall) = (); - local ($one_name); - local ($local_headers) = ''; - foreach $one_name (@config_names) + if (&dirname ($one_name) eq $relative_dir) { - if (&dirname ($one_name) eq $relative_dir) - { - $local_headers .= ' ' if $local_headers; - $local_headers .= &basename ($one_name); - } + $local_headers .= ' ' if $local_headers; + $local_headers .= &basename ($one_name); } - if ($local_headers) - { - - # This is kind of a hack, but I couldn't see a better - # way to handle it. In this particular case, we need - # to make sure config.h is built before we recurse. - # We can't do this by changing the order of - # dependencies to the "all" because that breaks when - # using parallel makes. Instead we handle things - # explicitly. - $output_rules .= ("all-recursive-am: ${local_headers}" + } + if ($local_headers) + { + # This is kind of a hack, but I couldn't see a better way + # to handle it. In this particular case, we need to make + # sure config.h is built before we recurse. We can't do + # this by changing the order of dependencies to the "all" + # because that breaks when using parallel makes. Instead + # we handle things explicitly. + $output_rules .= ("all-recursive-am: ${local_headers}" . "\n\t" . '$(MAKE) $(AM_MAKEFLAGS)' . " all-recursive" . "\n\n"); - push (@hackall, 'all-recursive-am'); - push (@phony, 'all-recursive-am'); - } - else - { - push (@hackall, 'all-recursive'); - } - - $output_rules .= ('all-am: ' - . join (' ', @all) - . "\n\n"); - @all = @hackall; - push (@all, 'all-am'); - push (@phony, 'all-am'); - } - else - { - @all = ('all-recursive'); - - # Must always generate `all-am' target, so it can be - # referred to elsewhere. - $output_rules .= "all-am:\n"; - } - if (@install_exec) - { - $output_rules .= ('install-exec-am: ' - . join (' ', @install_exec) - . "\n\n"); - @install_exec = ('install-exec-recursive', 'install-exec-am'); - push (@install, 'install-exec-am'); - push (@phony, 'install-exec-am'); - } - else - { - @install_exec = ('install-exec-recursive'); - } - if (@install_data) - { - $output_rules .= ('install-data-am: ' - . join (' ', @install_data) - . "\n\n"); - @install_data = ('install-data-recursive', 'install-data-am'); - push (@install, 'install-data-am'); - push (@phony, 'install-data-am'); - } - else - { - @install_data = ('install-data-recursive'); - } - if (@uninstall) - { - $output_rules .= ('uninstall-am: ' - . join (' ', @uninstall) - . "\n\n"); - @uninstall = ('uninstall-recursive', 'uninstall-am'); - push (@phony, 'uninstall-am'); - } - else - { - @uninstall = ('uninstall-recursive'); + $all_target = 'all-recursive-am'; + push (@phony, 'all-recursive-am'); } } - # Step three: print definitions users can use. Code below knows - # that install-exec is done before install-data, beware. - $output_rules .= ("install-exec: " - . join (' ', @install_exec) - . "\n"); - $output_rules .= "\t\@\$(NORMAL_INSTALL)\n"; - if (defined $contents{'install-exec-hook'}) + # Print definitions users can use. + &do_one_merge_target ('install-exec', @install_exec); + if (&target_defined ('install-exec-hook')) { - $output_rules .= ("\t" - . '$(MAKE) $(AM_MAKEFLAGS) install-exec-hook' + $output_rules .= ("\t\@\$(NORMAL_INSTALL)\n" + . "\t" . '$(MAKE) $(AM_MAKEFLAGS) install-exec-hook' . "\n"); } $output_rules .= "\n"; - push (@install, 'install-exec') if !$recursive_install; - push (@phony, 'install-exec'); + push (@install, 'install-exec-am'); - $output_rules .= ("install-data: " - . join (' ', @install_data) - . "\n"); - $output_rules .= "\t\@\$(NORMAL_INSTALL)\n"; + &do_one_merge_target ('install-data', @install_data); if (defined $contents{'install-data-hook'}) { - $output_rules .= ("\t" - . '$(MAKE) $(AM_MAKEFLAGS) install-data-hook' + $output_rules .= ("\t\@\$(NORMAL_INSTALL)\n" + . "\t" . '$(MAKE) $(AM_MAKEFLAGS) install-data-hook' . "\n"); } $output_rules .= "\n"; - push (@install, 'install-data') if !$recursive_install; - push (@phony, 'install-data'); - - # If no dependencies for 'install', add 'all'. Why? That way - # "make install" at top level of distclean'd distribution won't - # fail because stuff in 'lib' fails to build. - if (! @install || (scalar (@install) == 2 - && $install[0] eq 'install-exec' - && $install[1] eq 'install-data')) - { - push (@install, 'all'); - } - $output_rules .= ('install: ' - . join (' ', @install) - # Use "@:" as empty command so nothing prints. - . "\n\t\@:" - . "\n\n" - . 'uninstall: ' - . join (' ', @uninstall) - . "\n\n"); - push (@phony, 'install', 'uninstall'); + push (@install, 'install-data-am'); + + &do_one_merge_target ('install', @install); + &do_one_merge_target ('uninstall', @uninstall); - $output_all = 'all: ' . join (' ', @all) . "\n\n"; - push (@phony, 'all'); + &do_one_merge_target ('all', @all); # Generate the new 'install-strip' target. Must set # INSTALL_SCRIPT to avoid stripping scripts. @@ -3650,26 +3555,38 @@ sub handle_merge_targets . "\n"); } -# Helper for handle_merge_targets. +# Helper for handle_merge_targets. Note that handle_merge_targets +# relies on the fact that this doesn't add an extra \n at the end. sub do_one_merge_target { local ($name, @values) = @_; - if (defined $contents{$name . '-local'}) + if (&target_defined ($name . '-local')) { # User defined local form of target. So include it. push (@values, $name . '-local'); push (@phony, $name . '-local'); } - &pretty_print_rule ($name . ":", "\t\t", @values); - push (@phony, $name); + &pretty_print_rule ($name . "-am:", "\t\t", @values); + local ($lname) = $name . ($recursive_install ? '-recursive' : '-am'); + local ($tname) = $name; + # To understand this special case, see handle_merge_targets. + if ($name eq 'all') + { + $tname = 'all-redirect'; + $lname = $all_target if $recursive_install; + push (@phony, 'all-redirect'); + $output_all = "all: all-redirect\n"; + } + &pretty_print_rule ($tname . ":", "\t\t", $lname); + push (@phony, $name . '-am', $name); } # Handle check merge target specially. sub do_check_merge_target { - if (defined $contents{'check-local'}) + if (&target_defined ('check-local')) { # User defined local form of target. So include it. push (@check_tests, 'check-local'); @@ -3677,38 +3594,29 @@ sub do_check_merge_target } # In --cygnus mode, check doesn't depend on all. - if (! $cygnus_mode) + if ($cygnus_mode) { - if (! &variable_defined ('SUBDIRS')) - { - # 'check' must depend on `all', but not when doing - # recursive build. - unshift (@check, 'all'); - } - else - { - # When subdirs are used, do the `all' build and then do - # all the recursive stuff. Actually use `all-am' because - # it doesn't recurse; we rely on the check target in the - # subdirs to do the required builds there. - unshift (@check, 'all-am'); - } + # Just run the local check rules. + &pretty_print_rule ('check-am:', "\t\t", @check); } - - # The check target must depend on the local equivalent of `all', - # to ensure all the primary targets are built. Also it must - # depend on the test code named in @check. - &pretty_print_rule ('check:', "\t\t", @check); - - # Now the check rules must explicitly run anything named in - # @check_tests. This is done via a separate make invocation to - # avoid problems with parallel makes. Every time I write code - # like this I wonder: how could you invent a parallel make and not - # provide any real synchronization facilities? The official - # answer is that you can push the dependencies out to the leaves - # of the dependency tree. That seems fairly gross to me. - &pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ", @check_tests) + else + { + # The check target must depend on the local equivalent of + # `all', to ensure all the primary targets are built. Then it + # must build the local check rules. + $output_rules .= "check-am: all-am\n"; + &pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ", + @check) + if @check; + } + &pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ", + @check_tests) if @check_tests; + + push (@phony, 'check', 'check-am'); + $output_rules .= ("check: " + . ($recursive_install ? 'check-recursive' : 'check-am') + . "\n"); } # Handle all 'clean' targets. @@ -3756,25 +3664,12 @@ sub handle_clean push (@clean, 'generic'); &push_phony_cleaners ('generic'); - local ($target) = $recursive_install ? 'clean-am' : 'clean'; - &do_one_clean_target ($target, 'mostly', '', @clean); - &do_one_clean_target ($target, '', 'mostly', @clean); - &do_one_clean_target ($target, 'dist', '', @clean); - &do_one_clean_target ($target, 'maintainer-', 'dist', @clean); + &do_one_clean_target ('clean', 'mostly', '', @clean); + &do_one_clean_target ('clean', '', 'mostly', @clean); + &do_one_clean_target ('clean', 'dist', '', @clean); + &do_one_clean_target ('clean', 'maintainer-', 'dist', @clean); push (@phony, 'clean', 'mostlyclean', 'distclean', 'maintainer-clean'); - - local (@deps); - if ($recursive_install) - { - # Do -recursive before -am. If you aren't doing a parallel - # make, this can be nicer. - @deps = ('recursive', 'am'); - &do_one_clean_target ('', 'mostly', '', @deps); - &do_one_clean_target ('', '', '', @deps); - &do_one_clean_target ('', 'dist', '', @deps); - &do_one_clean_target ('', 'maintainer-', '', @deps); - } } # Helper for handle_clean. @@ -3782,30 +3677,20 @@ sub do_one_clean_target { local ($target, $name, $last_name, @deps) = @_; - # Special case: if target not passed, then don't generate - # dependency on next "lower" clean target (eg no - # clean<-mostlyclean derivation). In this case the target is - # implicitly known to be 'clean'. - local ($flag) = $target; - $target = 'clean' if ! $flag; - + # Change each dependency `BLARG' into `clean-BLARG'. grep (($_ = $name . 'clean-' . $_) && 0, @deps); - if ($flag) - { - if ($last_name || $name ne 'mostly') - { - push (@deps, $last_name . $target); - } - } + + # Push the previous clean target. + push (@deps, $last_name . $target . '-am'); # If a -local version of the rule is given, add it to the list. - if (defined $contents{$name . $target . '-local'}) + if (&target_defined ($name . $target . '-local')) { push (@deps, $name . $target . '-local'); } # Print the target and the dependencies. - &pretty_print_rule ($name . $target . ": ", "\t\t", @deps); + &pretty_print_rule ($name . $target . "-am: ", "\t\t", @deps); # FIXME: shouldn't we really print these messages before running # the dependencies? @@ -3826,6 +3711,9 @@ sub do_one_clean_target $output_rules .= "\t-rm -f libtool\n" if $seen_libtool; } $output_rules .= "\n"; + $output_rules .= ($name . $target . ": " . $name . $target + . ($recursive_install ? '-recursive' : '-am') + . "\n\n"); } # Handle .PHONY target. @@ -5774,6 +5662,9 @@ sub initialize_per_input # This maps the source extension of a suffix rule to its # corresponding output extension. %suffix_rules = (); + + # This is the name of the recursive `all' target to use. + $all_target = 'all-recursive'; } diff --git a/automake.texi b/automake.texi index d79b66da..85b6ad9a 100644 --- a/automake.texi +++ b/automake.texi @@ -1271,7 +1271,7 @@ SUBDIRS = @@SUBDIRS@@ Then in your @file{configure.in} you can specify: @example -SUBDIRS = "src doc lib po" +SUBDIRS="src doc lib po" AC_SUBST(SUBDIRS) @end example @@ -1290,6 +1290,11 @@ The use of @code{SUBDIRS} is not restricted to just the top-level @file{Makefile.am}. Automake can be used to construct packages of arbitrary depth. +By default, Automake generates @file{Makefiles} which work depth-first +(``postfix''). However, it is possible to change this ordering. You +can do this by putting @samp{.} into @code{SUBDIRS}. For instance, +putting @samp{.} first will cause a ``prefix'' ordering of directories. + @node Programs, Other objects, Top level, Top @chapter Building Programs and Libraries diff --git a/lib/am/Makefile.am b/lib/am/Makefile.am index 7e1e05d2..300d61c6 100644 --- a/lib/am/Makefile.am +++ b/lib/am/Makefile.am @@ -3,7 +3,9 @@ AUTOMAKE_OPTIONS = gnits MAINT_CHARSET = latin1 -SUBDIRS = tests m4 +## We need `.' in SUBDIRS because we want `check' to build `.' before +## tests. +SUBDIRS = . m4 tests bin_SCRIPTS = automake aclocal info_TEXINFOS = automake.texi diff --git a/lib/am/subdirs.am b/lib/am/subdirs.am index 3452df45..d03d890a 100644 --- a/lib/am/subdirs.am +++ b/lib/am/subdirs.am @@ -1,5 +1,5 @@ ## automake - create Makefile.in from Makefile.am -## Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. +## Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -28,14 +28,24 @@ all-recursive install-data-recursive install-exec-recursive \ installdirs-recursive install-recursive uninstall-recursive @INSTALLINFO@ \ check-recursive installcheck-recursive info-recursive dvi-recursive: @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ - target=`echo $@ | sed s/-recursive//`; \ echo "Making $$target in $$subdir"; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target) \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ ## This trick allows "-k" to keep its natural meaning when running a ## recursive rule. || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done && test -z "$$fail" + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" ## We run all `clean' targets in reverse order. Why? It's an attempt ## to alleviate a problem that can happen when dependencies are @@ -46,12 +56,21 @@ check-recursive installcheck-recursive info-recursive dvi-recursive: mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ rev="$$subdir $$rev"; \ + test "$$subdir" = "." && dot_seen=yes; \ done; \ +## If we haven't seen `.', then add it at the beginning. + test "$$dot_seen" = "no" && rev=". $$rev"; \ + target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ - target=`echo $@ | sed s/-recursive//`; \ echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target) \ ## This trick allows "-k" to keep its natural meaning when running a ## recursive rule. diff --git a/lib/am/tags.am b/lib/am/tags.am index 1777fa2c..aca128b9 100644 --- a/lib/am/tags.am +++ b/lib/am/tags.am @@ -25,7 +25,10 @@ TAGS: @DIRS@ $(HEADERS) $(SOURCES) @CONFIG@ $(TAGS_DEPENDENCIES) $(LISP) tags=; \ here=`pwd`; \ SUBDIRS list='$(SUBDIRS)'; for subdir in $$list; do \ -SUBDIRS test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ +## Do nothing if we're trying to look in `.'. +SUBDIRS if test "$$subdir" = .; then :; else \ +SUBDIRS test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ +SUBDIRS fi; \ SUBDIRS done; \ ## Make sure the list of sources is unique. list='$(SOURCES) $(HEADERS)'; \ diff --git a/m4/Makefile.in b/m4/Makefile.in index 7d810c00..dd3ed094 100644 --- a/m4/Makefile.in +++ b/m4/Makefile.in @@ -82,8 +82,7 @@ DIST_COMMON = Makefile.am Makefile.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) GZIP = --best -all: Makefile $(DATA) - +all: all-redirect .SUFFIXES: $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOMAKE) --gnits m4/Makefile @@ -129,27 +128,33 @@ distdir: $(DISTFILES) d=$(srcdir); \ if test -d $$d/$$file; then \ cp -pr $$/$$file $(distdir)/$$file; \ - else\ + else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || cp -p $$d/$$file $(distdir)/$$file; \ fi; \ done -info: -dvi: -check: all -installcheck: -install-exec: - @$(NORMAL_INSTALL) - -install-data: install-m4dataDATA - @$(NORMAL_INSTALL) - -install: install-exec install-data all - @: - -uninstall: uninstall-m4dataDATA - +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +install-exec-am: +install-exec: install-exec-am + +install-data-am: install-m4dataDATA +install-data: install-data-am + +install-am: install-exec-am install-data-am install-exec-am \ + install-data-am +install: install-am +uninstall-am: uninstall-m4dataDATA +uninstall: uninstall-am +all-am: Makefile $(DATA) +all-redirect: all-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install installdirs: @@ -165,20 +170,30 @@ distclean-generic: -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: -mostlyclean: mostlyclean-generic +mostlyclean-am: mostlyclean-generic clean-am + +mostlyclean: mostlyclean-am + +clean-am: clean-generic mostlyclean-am -clean: clean-generic mostlyclean +clean: clean-am -distclean: distclean-generic clean +distclean-am: distclean-generic clean-am -rm -f config.status -maintainer-clean: maintainer-clean-generic distclean +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-generic distclean-am @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." -.PHONY: uninstall-m4dataDATA install-m4dataDATA tags distdir info dvi \ -installcheck install-exec install-data install uninstall all \ -installdirs mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean: maintainer-clean-am + +.PHONY: uninstall-m4dataDATA install-m4dataDATA tags distdir info-am \ +info dvi-am dvi check check-am installcheck-am installcheck \ +install-exec-am install-exec install-data-am install-data install-am \ +install uninstall-am uninstall all-redirect all-am all installdirs \ +mostlyclean-generic distclean-generic clean-generic \ maintainer-clean-generic clean mostlyclean distclean maintainer-clean diff --git a/stamp-vti b/stamp-vti index 067658ac..0415893d 100644 --- a/stamp-vti +++ b/stamp-vti @@ -1,3 +1,3 @@ -@set UPDATED 27 September 1998 +@set UPDATED 28 September 1998 @set EDITION 1.3c @set VERSION 1.3c diff --git a/subdirs.am b/subdirs.am index 3452df45..d03d890a 100644 --- a/subdirs.am +++ b/subdirs.am @@ -1,5 +1,5 @@ ## automake - create Makefile.in from Makefile.am -## Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. +## Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -28,14 +28,24 @@ all-recursive install-data-recursive install-exec-recursive \ installdirs-recursive install-recursive uninstall-recursive @INSTALLINFO@ \ check-recursive installcheck-recursive info-recursive dvi-recursive: @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ - target=`echo $@ | sed s/-recursive//`; \ echo "Making $$target in $$subdir"; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target) \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ ## This trick allows "-k" to keep its natural meaning when running a ## recursive rule. || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done && test -z "$$fail" + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" ## We run all `clean' targets in reverse order. Why? It's an attempt ## to alleviate a problem that can happen when dependencies are @@ -46,12 +56,21 @@ check-recursive installcheck-recursive info-recursive dvi-recursive: mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ rev="$$subdir $$rev"; \ + test "$$subdir" = "." && dot_seen=yes; \ done; \ +## If we haven't seen `.', then add it at the beginning. + test "$$dot_seen" = "no" && rev=". $$rev"; \ + target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ - target=`echo $@ | sed s/-recursive//`; \ echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target) \ ## This trick allows "-k" to keep its natural meaning when running a ## recursive rule. diff --git a/tags.am b/tags.am index 1777fa2c..aca128b9 100644 --- a/tags.am +++ b/tags.am @@ -25,7 +25,10 @@ TAGS: @DIRS@ $(HEADERS) $(SOURCES) @CONFIG@ $(TAGS_DEPENDENCIES) $(LISP) tags=; \ here=`pwd`; \ SUBDIRS list='$(SUBDIRS)'; for subdir in $$list; do \ -SUBDIRS test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ +## Do nothing if we're trying to look in `.'. +SUBDIRS if test "$$subdir" = .; then :; else \ +SUBDIRS test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ +SUBDIRS fi; \ SUBDIRS done; \ ## Make sure the list of sources is unique. list='$(SOURCES) $(HEADERS)'; \ diff --git a/version.texi b/version.texi index 067658ac..0415893d 100644 --- a/version.texi +++ b/version.texi @@ -1,3 +1,3 @@ -@set UPDATED 27 September 1998 +@set UPDATED 28 September 1998 @set EDITION 1.3c @set VERSION 1.3c -- 2.43.5