[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RFC: defining aclocal.m4/configure/config.status rebuild rules in al
From: |
Alexandre Duret-Lutz |
Subject: |
Re: RFC: defining aclocal.m4/configure/config.status rebuild rules in all directories |
Date: |
Fri, 25 Apr 2003 20:37:42 +0200 |
User-agent: |
Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.2 (gnu/linux) |
>>> "Raja" == Raja R Harinath <address@hidden> writes:
[...]
Raja> Actually, you can use 'am--refresh' for any of the dependencies of the
Raja> toplevel Makefile, but all those are mostly covered by existing rules.
Neat! I feel safer changing all those dependencies to use
am--refresh because that means the "rebuild everything" code is
only at the top-level.
Here is what I'm installing on HEAD.
2003-04-25 Alexandre Duret-Lutz <address@hidden>
* tests/aclocal6.test: New file.
* lib/am/configure.am (am--refresh): New rule.
(%MAKEFILE-IN%, %MAKEFILE%, $(top_builddir)/config.status,
$(top_srcdir)/configure): Call the top-level am--refresh from
subdirectories.
($(ACLOCAL_M4)): Depend upon %CONFIGURE_DEPS%. Call the
top-level am--refresh when not in the top-level directory.
Fix jump directories for VPATH builds.
Suggested by Raja R. Harinath.
Index: NEWS
===================================================================
RCS file: /cvs/automake/automake/NEWS,v
retrieving revision 1.212
diff -u -r1.212 NEWS
--- NEWS 24 Apr 2003 18:54:46 -0000 1.212
+++ NEWS 25 Apr 2003 18:28:43 -0000
@@ -100,7 +100,7 @@
* 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.
+ (undocumented) variables, you should better define them in all directories.
This is easily done using an AC_SUBST.
* aclocal will now use `m4_include' instead of copying local m4 files
@@ -116,8 +116,6 @@
to override the aclocal.m4 dependencies computed (inaccurately) by
older versions of Automake; this variable should be considered obsolete
and will be flagged as such when running `automake -Wobsolete'.
- Note that local m4 files are no longer dependencies of aclocal.m4
- (since it only includes them) but they are dependencies of configure.
New in 1.7:
Index: lib/am/configure.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/configure.am,v
retrieving revision 1.17
diff -u -r1.17 configure.am
--- lib/am/configure.am 24 Apr 2003 18:39:32 -0000 1.17
+++ lib/am/configure.am 25 Apr 2003 18:28:45 -0000
@@ -17,6 +17,17 @@
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
## 02111-1307, USA.
+
+## This dummy rule is called from subdirectories whenever one of the
+## top-level Makefile's dependencies must be updated. It does not
+## need to depend on %MAKEFILE% because GNU make will always make sure
+## %MAKEFILE% is updated before considering the am--refresh target.
+if %?TOPDIR_P%
+.PHONY: am--refresh
+am--refresh:
+endif %?TOPDIR_P%
+
+
## --------------------- ##
## Building Makefile.*. ##
## --------------------- ##
@@ -30,8 +41,9 @@
@for dep in $?; do \
case '$(top_srcdir)/%CONFIGURE-AC% $(ACLOCAL_M4) %CONFIGURE_DEPS%' in
\
*$$dep*) \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --%STRICTNESS%
%USE-DEPS%'; \
- cd $(top_srcdir) && $(AUTOMAKE) --%STRICTNESS% %USE-DEPS%; \
+?TOPDIR_P? echo ' cd $(srcdir) && $(AUTOMAKE) --%STRICTNESS%
%USE-DEPS%'; \
+?TOPDIR_P? cd $(srcdir) && $(AUTOMAKE) --%STRICTNESS% %USE-DEPS%; \
+?!TOPDIR_P? cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS)
am--refresh; \
exit 0;; \
esac; \
done; \
@@ -52,8 +64,9 @@
## Don't prefix $(top_builddir), because GNU make will strip it out
## when it's `.'.
*config.status*) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status'; \
- cd $(top_builddir) && $(SHELL) ./config.status;; \
+?TOPDIR_P? echo ' $(SHELL) ./config.status'; \
+?TOPDIR_P? $(SHELL) ./config.status;; \
+?!TOPDIR_P? cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;;
\
*) \
## FIXME: $(am__depfiles_maybe) lets us re-run the rule to create the
## .P files. Ideally we wouldn't have to do this by hand.
@@ -61,6 +74,7 @@
cd $(top_builddir) && $(SHELL) ./config.status %CONFIG-MAKEFILE%
$(am__depfiles_maybe);; \
esac;
+
## --------------------------- ##
## config.status & configure. ##
## --------------------------- ##
@@ -74,10 +88,12 @@
endif %?TOPDIR_P%
$(top_builddir)/config.status: $(top_srcdir)/configure
$(CONFIG_STATUS_DEPENDENCIES)
- cd $(top_builddir) && $(SHELL) ./config.status --recheck
+?TOPDIR_P? $(SHELL) ./config.status --recheck
+?!TOPDIR_P? cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: %MAINTAINER-MODE% $(top_srcdir)/%CONFIGURE-AC%
$(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) %CONFIGURE_DEPS%
- cd $(top_srcdir) && $(AUTOCONF)
+?TOPDIR_P? cd $(srcdir) && $(AUTOCONF)
+?!TOPDIR_P? cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
## ------------ ##
@@ -86,17 +102,21 @@
## aclocal.m4 must be built by the top-level Makefile, because this is
## where the user is expected to define $(ACLOCAL_AMFLAGS).
+##
+## Whenever a configure dependency changes we need to rebuild
+## aclocal.m4 too. Changing configure.ac, or any file included by
+## aclocal.m4 might require adding more files to aclocal.m4. Hence
+## the %CONFIGURE_DEPS% dependency.
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)'
+$(ACLOCAL_M4): %MAINTAINER-MODE% $(top_srcdir)/%CONFIGURE-AC%
%ACLOCAL_M4_DEPS% %CONFIGURE_DEPS%
+?TOPDIR_P? cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+?!TOPDIR_P? cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
endif %?REGEN-ACLOCAL-M4%
## --------- ##
## cleanup. ##
## --------- ##
-
## We special-case config.status here. If we do it as part of the
## normal clean processing for this directory, then it might be
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.488
diff -u -r1.488 Makefile.am
--- tests/Makefile.am 24 Apr 2003 18:48:06 -0000 1.488
+++ tests/Makefile.am 25 Apr 2003 18:28:45 -0000
@@ -9,6 +9,7 @@
aclocal3.test \
aclocal4.test \
aclocal5.test \
+aclocal6.test \
acoutnoq.test \
acoutpt.test \
acoutpt2.test \
Index: tests/aclocal6.test
===================================================================
RCS file: tests/aclocal6.test
diff -N tests/aclocal6.test
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/aclocal6.test 25 Apr 2003 18:28:45 -0000
@@ -0,0 +1,69 @@
+#! /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.
+
+# Make sure aclocal.m4 is rebuilt whenever a configure
+# dependency changes. Test for VPATH too.
+
+required='GNUmake'
+. ./defs || exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+SOME_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([SOME_DEFS], [])' > m4/somedefs.m4
+echo 'AC_DEFUN([MORE_DEFS], [AC_SUBST([GREPME])])' > m4/moredefs.m4
+
+$ACLOCAL -I m4
+$AUTOCONF
+$AUTOMAKE --copy --add-missing
+
+mkdir build
+cd build
+
+../configure
+$MAKE
+
+# Update an aclocal.m4 dependency, then make sure all Makefiles
+# are updated, even from a sub-directory.
+echo 'AC_DEFUN([SOME_DEFS], [MORE_DEFS])' > ../m4/somedefs.m4
+cd sub
+$MAKE
+cd ..
+grep GREPME Makefile
+grep GREPME sub/Makefile
+
+# Make sure configure dependencies are distributed.
+$MAKE distdir
+test -f aclocal6-1.0/m4/moredefs.m4
+test -f aclocal6-1.0/m4/somedefs.m4
--
Alexandre Duret-Lutz
Re: RFC: defining aclocal.m4/configure/config.status rebuild rules in all directories, Alexandre Duret-Lutz, 2003/04/24
Re: RFC: defining aclocal.m4/configure/config.status rebuild rules in all directories, Raja R Harinath, 2003/04/24