Hello,
On Wed, Apr 05, 2006 at 04:26:22PM -0700, Paul Eggert wrote:
> Noah Misch <[EMAIL PROTECTED]> writes:
>
> > With this patch, mktests.sh runs for each edit in lib/autoconf/*.m4
> > but only touches output files that have changed. This eliminates
> > the spurious rebuilds.
>
> I've written my fair share of patches that do something similar, for
> other programs, and have often lived to regret it. I'd rather avoid
> this sort of "file X is actually a time stamp for file Y" business
> unless the efficiency issue really is a major one.
I have created a variation of Noah's patch; please find it attached
below.
It doesn't use any stamp files. The idea is simple: `testsuite' is
generated from handwritten *.at files and from Autoconf sources by
mktests.sh and Autom4te.
The generated *.at files are intermediate files, and the (primary)
make no longer uses them.
In order to avoid spurious rebuilds, mktests.sh doesn't touch *.at
files if they haven't changed (Noah's code), and a secondary make
is then called which decides whether an Autom4te run is necessary.
Paul, would you accept this patch? (Post 2.60, of course.)
Have a nice day,
Stepan
2006-04-05 Noah Misch <[EMAIL PROTECTED]>
and Stepan Kasal <[EMAIL PROTECTED]>
Do not rebuild `testsuite' when a lib/autoconf/*.m4 edit does
not affect the generated test cases.
* tests/mktests: Only touch the products if they would change.
* tests/Makefile.am: Do not call the autom4te for $(TESTSUTE)
directly, use a new rule for $(TESTSUTE).tmp. Move these rules
from the ``maintainer section'' up. Do not distribute
$(TESTSUITE_GENERATED_AT).
(MAINTAINERCLEANFILES): Remove.
Index: tests/Makefile.am
===================================================================
RCS file: /cvsroot/autoconf/autoconf/tests/Makefile.am,v
retrieving revision 1.100
diff -u -r1.100 Makefile.am
--- tests/Makefile.am 9 Apr 2006 11:36:08 -0000 1.100
+++ tests/Makefile.am 9 Apr 2006 14:01:41 -0000
@@ -1,7 +1,7 @@
## Process this file with automake to create Makefile.in. -*-Makefile-*-
## Makefile for Autoconf testsuite.
-## Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005
+## Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006
## Free Software Foundation, Inc.
## This program is free software; you can redistribute it and/or modify
@@ -21,13 +21,12 @@
# We don't actually distribute the testsuite, since one only
# needs m4 to build it, m4 being required anyway to install Autoconf.
-EXTRA_DIST = $(TESTSUITE_AT) local.at mktests.sh \
+EXTRA_DIST = $(TESTSUITE_HAND_AT) local.at mktests.sh \
atlocal.in package.m4 wrapper.as
# Running the uninstalled scripts.
check_SCRIPTS = $(wrappers)
-DISTCLEANFILES = atconfig atlocal $(TESTSUITE)
-MAINTAINERCLEANFILES = Makefile.in
+DISTCLEANFILES = atconfig atlocal $(TESTSUITE) $(TESTSUITE_GENERATED_AT)
# Import the dependencies on Autotest and M4sh.
include ../lib/freeze.mk
@@ -79,20 +78,36 @@
## Test suite. ##
## ------------ ##
+# The files which contain macros we check for syntax.
+AUTOCONF_FILES = \
+ $(top_srcdir)/lib/autoconf/general.m4 \
+ $(top_srcdir)/lib/autoconf/status.m4 \
+ $(top_srcdir)/lib/autoconf/autoheader.m4 \
+ $(top_srcdir)/lib/autoconf/autoupdate.m4 \
+ $(top_srcdir)/lib/autoconf/specific.m4 \
+ $(top_srcdir)/lib/autoconf/functions.m4 \
+ $(top_srcdir)/lib/autoconf/lang.m4 \
+ $(top_srcdir)/lib/autoconf/c.m4 \
+ $(top_srcdir)/lib/autoconf/fortran.m4 \
+ $(top_srcdir)/lib/autoconf/headers.m4 \
+ $(top_srcdir)/lib/autoconf/libs.m4 \
+ $(top_srcdir)/lib/autoconf/types.m4 \
+ $(top_srcdir)/lib/autoconf/programs.m4
+
TESTSUITE_GENERATED_AT = \
- $(srcdir)/aclang.at \
- $(srcdir)/acc.at \
- $(srcdir)/acfortran.at \
- $(srcdir)/acgeneral.at \
- $(srcdir)/acstatus.at \
- $(srcdir)/acautoheader.at \
- $(srcdir)/acautoupdate.at \
- $(srcdir)/acspecific.at \
- $(srcdir)/acfunctions.at \
- $(srcdir)/acheaders.at \
- $(srcdir)/actypes.at \
- $(srcdir)/aclibs.at \
- $(srcdir)/acprograms.at
+ aclang.at \
+ acc.at \
+ acfortran.at \
+ acgeneral.at \
+ acstatus.at \
+ acautoheader.at \
+ acautoupdate.at \
+ acspecific.at \
+ acfunctions.at \
+ acheaders.at \
+ actypes.at \
+ aclibs.at \
+ acprograms.at
TESTSUITE_HAND_AT = \
suite.at \
@@ -103,21 +118,28 @@
autoscan.at \
foreign.at
-TESTSUITE_AT = $(TESTSUITE_GENERATED_AT) $(TESTSUITE_HAND_AT)
TESTSUITE = ./testsuite
# Run the non installed autom4te.
# Don't use AUTOM4TE since `make alpha' makes it unavailable although
# we are allowed to use it (since we ship it).
AUTOTEST = ./autom4te --language=autotest
-$(TESTSUITE): $(srcdir)/package.m4 \
- local.at \
- $(TESTSUITE_AT) \
- $(autotest_m4f_dependencies)
- cd $(top_builddir)/lib/autotest && $(MAKE) $(AM_MAKEFLAGS) autotest.m4f
- $(AUTOTEST) -I $(srcdir) suite.at -o [EMAIL PROTECTED]
+
+# All the dependencies, except the generated *.at files:
+TESTSUITE_dependencies = $(srcdir)/package.m4 local.at \
+ $(autotest_m4f_dependencies) $(TESTSUITE_HAND_AT) mktests.sh
+
+$(TESTSUITE): $(TESTSUITE_dependencies) $(AUTOCONF_FILES)
+ $(srcdir)/mktests.sh $(AUTOCONF_FILES)
+ mv $@ [EMAIL PROTECTED]
+ $(MAKE) $(AM_MAKEFLAGS) [EMAIL PROTECTED]
+ touch [EMAIL PROTECTED]
mv [EMAIL PROTECTED] $@
+$(TESTSUITE).tmp: $(TESTSUITE_dependencies) $(TESTSUITE_GENERATED_AT)
+ cd $(top_builddir)/lib/autotest && $(MAKE) $(AM_MAKEFLAGS) autotest.m4f
+ $(AUTOTEST) -I $(srcdir) suite.at -o $@
+
atconfig: $(top_builddir)/config.status
cd $(top_builddir) && ./config.status tests/$@
@@ -139,33 +161,6 @@
## Maintainer rules. ##
## ------------------ ##
-MAINTAINERCLEANFILES += $(TESTSUITE_GENERATED_AT)
-
-## Producing the test files.
-
-# The files which contain macros we check for syntax. Use $(top_srcdir)
-# for the benefit of non-GNU make. Fix the names in the rule below
-# where we `cd' to $srcdir.
-autoconfdir = $(top_srcdir)/lib/autoconf
-AUTOCONF_FILES = $(autoconfdir)/general.m4 \
- $(autoconfdir)/status.m4 \
- $(autoconfdir)/autoheader.m4 \
- $(autoconfdir)/autoupdate.m4 \
- $(autoconfdir)/specific.m4 \
- $(autoconfdir)/functions.m4 \
- $(autoconfdir)/lang.m4 \
- $(autoconfdir)/c.m4 \
- $(autoconfdir)/fortran.m4 \
- $(autoconfdir)/headers.m4 \
- $(autoconfdir)/libs.m4 \
- $(autoconfdir)/types.m4 \
- $(autoconfdir)/programs.m4
-
-$(TESTSUITE_GENERATED_AT): mktests.sh $(AUTOCONF_FILES)
- cd $(srcdir) && ./mktests.sh \
- `echo " "$(AUTOCONF_FILES) | sed 's, [^ ]*/, ../lib/autoconf/,g'`
-
-
## maintainer-check ##
maintainer-check: maintainer-check-posix maintainer-check-c++
Index: tests/mktests.sh
===================================================================
RCS file: /cvsroot/autoconf/autoconf/tests/mktests.sh,v
retrieving revision 1.53
diff -u -r1.53 mktests.sh
--- tests/mktests.sh 8 Apr 2006 21:44:13 -0000 1.53
+++ tests/mktests.sh 9 Apr 2006 14:01:41 -0000
@@ -217,12 +217,20 @@
# preserves the old version of the file. If there is nothing to
# check, output /rien du tout/[1].
if grep AT_CHECK ac$base.tat >/dev/null 2>&1; then
- mv -f ac$base.tat ac$base.at
- # Help people not to update these files by hand.
- chmod a-w ac$base.at
+ if diff ac$base.at ac$base.tat >/dev/null 2>&1; then
+ rm -f ac$base.tat
+ else
+ diff ac$base.at ac$base.tat || :
+ mv -f ac$base.tat ac$base.at
+ # Help people not to update these files by hand.
+ chmod a-w ac$base.at
+ fi
else
- rm -f ac$base.tat ac$base.at
- touch ac$base.at
+ rm -f ac$base.tat
+ if test \! -f ac$base.at || test -s ac$base.at; then
+ rm -f ac$base.at
+ touch ac$base.at
+ fi
fi
done