From: Alexandre Duret-Lutz Date: Thu, 24 Apr 2003 18:39:32 +0000 (+0000) Subject: For automake PR/46: X-Git-Tag: Release-1-7b~196 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b51046f01969592bed5f197337efd108f8fc2bea;p=thirdparty%2Fautomake.git For automake PR/46: * automake.in (scan_aclocal_m4): Work in all directories, not only the top-level. Prepend $(top_srcdir) in front of each aclocal.m4 dependency. * lib/am/configure.am (config.status, configure, $(ACLOCAL_M4)): Define rebuild rules in each directory. * tests/subdir8.test: Augment to exercise aclocal.m4's dependencies from the top-level directory. * tests/aclocal5.test: New file. Exercise aclocal.m4's dependencies from a subdirectory. * tests/Makefile.am (TESTS): Add aclocal5.test. (XFAIL_TESTS): Replace subdir8.test by aclocal5.test. --- diff --git a/ChangeLog b/ChangeLog index 17f04c81a..5ca133174 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2003-04-24 Alexandre Duret-Lutz + + For automake PR/46: + * automake.in (scan_aclocal_m4): Work in all directories, not only + the top-level. Prepend $(top_srcdir) in front of each aclocal.m4 + dependency. + * lib/am/configure.am (config.status, configure, $(ACLOCAL_M4)): + Define rebuild rules in each directory. + * tests/subdir8.test: Augment to exercise aclocal.m4's dependencies + from the top-level directory. + * tests/aclocal5.test: New file. Exercise aclocal.m4's dependencies + from a subdirectory. + * tests/Makefile.am (TESTS): Add aclocal5.test. + (XFAIL_TESTS): Replace subdir8.test by aclocal5.test. + 2003-04-24 Akim Demaille Alexandre Duret-Lutz diff --git a/NEWS b/NEWS index 77a989d17..2d824e574 100644 --- a/NEWS +++ b/NEWS @@ -83,6 +83,24 @@ New in 1.7a: overridden. Fortunately, it appears that few packages use a non-PHONY `html' rule. +* Any file which is m4_included from configure.ac will appear as + a configure and Makefile.in dependency. + +* The rules for rebuilding Makefiles and Makefile.ins will now rebuild + all Makefiles and all Makefile.ins at once when one of configure's + dependencies has changed. This is considerably faster than + previous implementations, where config.status and automake were run + separately in each directory (this still happens when you change + a Makefile.am locally, without touching configure.ac or friends). + Doing this also solves a longstanding issue: these rebuild rule + failed to work when adding new directories to the tree, forcing + you to run automake manually. + +* For similar reasons, the rules to rebuild configure, config.status, and + aclocal.m4 are now defined in all directories. Note that if you + were using the CONFIG_STATUS_DEPENDENCIES and CONFIGURE_DEPENDENCIES + (undocumented) variables, you will have to define them in all directories. + This is easily done using an AC_SUBST. New in 1.7: * Autoconf 2.54 is required. diff --git a/automake.in b/automake.in index 5a536a84b..03316957e 100755 --- a/automake.in +++ b/automake.in @@ -4294,22 +4294,13 @@ sub scan_aclocal_m4 { my $regen_aclocal = 0; - if (-f 'aclocal.m4') - { - # When using aclocal.m4, define this variable even in subdirectories, - # because every Makefile.in depends on $(ACLOCAL_M4). - &define_variable ("ACLOCAL_M4", '$(top_srcdir)/aclocal.m4', INTERNAL); - } - - return (0, ()) - unless $relative_dir eq '.'; - &examine_variable ('CONFIG_STATUS_DEPENDENCIES'); &examine_variable ('CONFIGURE_DEPENDENCIES'); if (-f 'aclocal.m4') { &push_dist_common ('aclocal.m4'); + &define_variable ("ACLOCAL_M4", '$(top_srcdir)/aclocal.m4', INTERNAL); my $aclocal = new Automake::XFile "< aclocal.m4"; my $line = $aclocal->getline; @@ -4343,7 +4334,7 @@ sub scan_aclocal_m4 foreach my $ac_dep (&my_glob ($amdir . '/*.m4')) { $ac_dep =~ s/^\.\/+//; - push (@ac_deps, $ac_dep) + push (@ac_deps, '$(top_srcdir)/' . $ac_dep) unless $ac_dep eq "aclocal.m4" || $ac_dep eq "acinclude.m4"; } diff --git a/lib/am/configure.am b/lib/am/configure.am index cb265f3f1..6ba9a77b8 100644 --- a/lib/am/configure.am +++ b/lib/am/configure.am @@ -66,37 +66,31 @@ ## --------------------------- ## if %?TOPDIR_P% -## Explicitly look in srcdir for benefit of non-GNU makes. -## Use `$(top_builddir)' for the benefit of Tru64 v5.1 make and also -## NetBSD v1.5 make. These `make's don't know that -## `$(top_builddir)/config.status' and `config.status' are the same -## file when top_builddir==`.'. -$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - $(SHELL) ./config.status --recheck - ## Always require configure.ac and configure at top level, even if they ## don't exist. This is especially important for configure, since it ## won't be created until autoconf is run -- which might be after ## automake is run. DIST_COMMON += configure %CONFIGURE-AC% - -## Explicitly look in srcdir for benefit of non-GNU makes. -$(srcdir)/configure: %MAINTAINER-MODE% $(srcdir)/%CONFIGURE-AC% $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) %CONFIGURE_DEPS% - cd $(srcdir) && $(AUTOCONF) endif %?TOPDIR_P% +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: %MAINTAINER-MODE% $(top_srcdir)/%CONFIGURE-AC% $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) %CONFIGURE_DEPS% + cd $(top_srcdir) && $(AUTOCONF) ## ------------ ## ## aclocal.m4. ## ## ------------ ## -if %?TOPDIR_P% -if %?REGEN-ACLOCAL-M4% -$(ACLOCAL_M4): %MAINTAINER-MODE% %CONFIGURE-AC% %ACLOCAL_M4_DEPS% - cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) -endif %?REGEN-ACLOCAL-M4% -endif %?TOPDIR_P% +## aclocal.m4 must be built by the top-level Makefile, because this is +## where the user is expected to define $(ACLOCAL_AMFLAGS). +if %?REGEN-ACLOCAL-M4% +$(ACLOCAL_M4): %MAINTAINER-MODE% $(top_srcdir)/%CONFIGURE-AC% %ACLOCAL_M4_DEPS% +?TOPDIR_P? $(ACLOCAL) $(ACLOCAL_AMFLAGS) +?!TOPDIR_P? cd $(top_srcdir) && $(MAKE) $(AM_MAKEFLAGS) '$$(ACLOCAL_M4)' +endif %?REGEN-ACLOCAL-M4% ## --------- ## diff --git a/tests/Makefile.am b/tests/Makefile.am index 14783df5f..65f913923 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to create Makefile.in -XFAIL_TESTS = subdir8.test auxdir2.test cond17.test txinfo5.test +XFAIL_TESTS = aclocal5.test auxdir2.test cond17.test txinfo5.test TESTS = \ acinclude.test \ @@ -11,6 +11,7 @@ aclocal.test \ aclocal2.test \ aclocal3.test \ aclocal4.test \ +aclocal5.test \ acoutnoq.test \ acoutpt.test \ acoutpt2.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 12472b215..085e985d2 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -33,7 +33,7 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -DIST_COMMON = Makefile.in Makefile.am defs.in README +DIST_COMMON = Makefile.in Makefile.am aclocal.m4 defs.in README subdir = tests ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/lib/mkinstalldirs @@ -104,7 +104,7 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -XFAIL_TESTS = subdir8.test auxdir2.test cond17.test txinfo5.test +XFAIL_TESTS = aclocal5.test auxdir2.test cond17.test txinfo5.test TESTS = \ acinclude.test \ aclibobj.test \ @@ -114,6 +114,7 @@ aclocal.test \ aclocal2.test \ aclocal3.test \ aclocal4.test \ +aclocal5.test \ acoutnoq.test \ acoutpt.test \ acoutpt2.test \ @@ -600,6 +601,14 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(top_srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(top_srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(top_srcdir)/configure.in + cd $(top_srcdir) && $(MAKE) $(AM_MAKEFLAGS) '$$(ACLOCAL_M4)' defs: $(top_builddir)/config.status defs.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ uninstall-info-am: diff --git a/tests/aclocal5.test b/tests/aclocal5.test new file mode 100755 index 000000000..449de365d --- /dev/null +++ b/tests/aclocal5.test @@ -0,0 +1,61 @@ +#! /bin/sh +# Copyright (C) 2003 Free Software Foundation, Inc. +# +# This file is part of GNU Automake. +# +# GNU Automake is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GNU Automake is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Automake; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# Test to make sure that aclocal.m4's dependencies are honored +# in sub-directories. + +# This test assumes that the `make' utility is able to start +# over and reload Makefiles which have been remade (a non-POSIX feature). +required='GNUmake' +. ./defs || exit 1 + +set -e + +cat >> configure.in << 'END' +MORE_DEFS +AC_CONFIG_FILES([sub/Makefile]) +AC_OUTPUT +END + +cat > Makefile.am << 'END' +SUBDIRS = sub +ACLOCAL_AMFLAGS = -I m4 +END + +mkdir sub +: > sub/Makefile.am + +mkdir m4 +echo 'AC_DEFUN([MORE_DEFS], [])' > m4/moredefs.m4 + +$ACLOCAL -I m4 +$AUTOCONF +$AUTOMAKE --copy --add-missing +./configure +$MAKE + +# Update an aclocal.m4 dependency, then make sure all Makefiles +# are updated, even from a sub-directory. +echo 'AC_DEFUN([MORE_DEFS], [AC_SUBST([GREPME])])' > m4/moredefs.m4 +cd sub +$MAKE +cd .. +grep GREPME Makefile +grep GREPME sub/Makefile diff --git a/tests/subdir8.test b/tests/subdir8.test index 9ef721994..ed8610d04 100755 --- a/tests/subdir8.test +++ b/tests/subdir8.test @@ -36,10 +36,14 @@ cat >> configure.in << 'END' AM_PROG_CC_C_O AC_PROG_CC m4_include([confiles.m4]) +MORE_DEFS AC_OUTPUT END -echo 'SUBDIRS = sub' > Makefile.am +cat > Makefile.am << 'END' +SUBDIRS = sub +ACLOCAL_AMFLAGS = -I m4 +END mkdir sub @@ -57,7 +61,10 @@ int main () } END -$ACLOCAL +mkdir m4 +echo 'AC_DEFUN([MORE_DEFS], [])' > m4/moredefs.m4 + +$ACLOCAL -I m4 $AUTOCONF $AUTOMAKE --copy --add-missing ./configure @@ -89,3 +96,12 @@ $MAKE cd .. test -f maude/Makefile test -f sub/maude/Makefile + +# Make sure the dependencies of aclocal.m4 or honored at least from +# the top-level directory. +echo 'AC_DEFUN([MORE_DEFS], [AC_SUBST([GREPME])])' > m4/moredefs.m4 +$MAKE +grep GREPME Makefile +grep GREPME maude/Makefile +grep GREPME sub/Makefile +grep GREPME sub/maude/Makefile