automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

revision of Akim's patch for PR/46 and running ./config.status once


From: Alexandre Duret-Lutz
Subject: revision of Akim's patch for PR/46 and running ./config.status once
Date: Sun, 13 Apr 2003 00:45:45 +0200
User-agent: Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.2 (gnu/linux)

Here is a rewrite of Akim's patch using $?.  While augmenting 
the test cases, I've found two issues related to the
way configure's dependencies are handled (Makefile.in lacks
the dependency on %CONFIGURE_DEPS%, and each such depency
should start with `$(top_srcdir)').  The patch takes care of them.

subdir8.test is a new test case that fails.  I think fixing
this requires rules for $(top_builddir)/confif.status and
$(top_srcdir)/configure in each directory.

It just occured to me that both issues are also related to
PR/355, but it's too late to think seriously about it (or even
to think about thinking about it).

make check is running.

2003-04-13  Akim Demaille  <address@hidden>
            Alexandre Duret-Lutz  <address@hidden>

        For automake PR/46:
        * lib/am/configure.am (%MAKEFILE-IN%): If Makefile.in is rebuilt
        because of one of configure's dependency, run automake without
        argument to update the whole tree at once.  Depend upon
        %CONFIGURE_DEPS%.
        (%MAKEFILE%): If Makefile is rebuilt because config.status has
        been updated, run config.status without arguments.
        * automake.in (scan_autoconf_traces): Prepent $(top_srcdir)
        before all files in @configure_deps.
        * tests/subdir5.test: Modernize configure.in, make sure
        maude/Makefile was actually created, and exercize %CONFIGURE_DEPS%.
        * tests/subdir8.test: New file.
        * tests/Makefile.am (TESTS): Add subdir8.test.
        (XFAIL_TESTS): Replace subdir5.test by subdir8.test.

Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1444
diff -u -r1.1444 automake.in
--- automake.in 12 Apr 2003 11:16:51 -0000      1.1444
+++ automake.in 12 Apr 2003 22:30:33 -0000
@@ -5330,7 +5330,7 @@
          # m4_include's performed during Autoconf's startup.
          # Obviously we don't want to distribute Autoconf's files
          # so we skip absolute filenames here.
-         push @configure_deps, $args[1]
+         push @configure_deps, '$(top_srcdir)/' . $args[1]
            unless $here =~ m,^(?:\w:)?[\\/],;
        }
    }
Index: lib/am/configure.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/configure.am,v
retrieving revision 1.15
diff -u -r1.15 configure.am
--- lib/am/configure.am 10 Oct 2002 17:37:38 -0000      1.15
+++ lib/am/configure.am 12 Apr 2003 22:30:36 -0000
@@ -1,5 +1,5 @@
 ## automake - create Makefile.in from Makefile.am
-## Copyright 2001
+## Copyright (C) 2001, 2002, 2003
 ## Free Software Foundation, Inc.
 
 ## This program is free software; you can redistribute it and/or modify
@@ -22,17 +22,44 @@
 ## --------------------- ##
 
 ## This rule remakes the Makefile.in.
-%MAKEFILE-IN%: %MAINTAINER-MODE% %MAKEFILE-AM% %MAKEFILE-IN-DEPS% 
$(top_srcdir)/%CONFIGURE-AC% $(ACLOCAL_M4)
+%MAKEFILE-IN%: %MAINTAINER-MODE% %MAKEFILE-AM% %MAKEFILE-IN-DEPS% 
$(top_srcdir)/%CONFIGURE-AC% $(ACLOCAL_M4) %CONFIGURE_DEPS%
+## If configure.ac or one of configure's dependencies has changed, all
+## Makefile.in are to be updated; it is then more efficient to run
+## automake on all the Makefiles at once.  It also allow Automake to be
+## run for newly added directories.
+       @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%; \
+             exit 0;; \
+         esac; \
+       done; \
+## Otherwise, rebuild only this file.
+        echo ' cd $(top_srcdir) && $(AUTOMAKE) --%STRICTNESS% %USE-DEPS% 
%MAKEFILE-AM-SOURCES%'; \
        cd $(top_srcdir) && \
          $(AUTOMAKE) --%STRICTNESS% %USE-DEPS% %MAKEFILE-AM-SOURCES%
 
 ## This rule remakes the Makefile.
 %MAKEFILE%: %MAINTAINER-MODE% %MAKEFILE-IN% %MAKEFILE-DEPS% 
$(top_builddir)/config.status
+## If Makefile is to be updated because of config.status, then run
+## config.status without argument in order to (i) rerun all the
+## AC_CONFIG_COMMANDS including those that are not visible to
+## Automake, and (ii) to save time by running config.status all with
+## all the files, instead of once per file (iii) generate Makefiles
+## in newly added directories.
+       @case '$?' in \
+## 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;; \
+         *) \
 ## 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.
-       cd $(top_builddir) && $(SHELL) ./config.status %CONFIG-MAKEFILE% 
$(am__depfiles_maybe)
-
-
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status 
%CONFIG-MAKEFILE% $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status %CONFIG-MAKEFILE% 
$(am__depfiles_maybe);; \
+       esac;
 
 ## --------------------------- ##
 ## config.status & configure.  ##
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.479
diff -u -r1.479 Makefile.am
--- tests/Makefile.am   11 Apr 2003 22:11:43 -0000      1.479
+++ tests/Makefile.am   12 Apr 2003 22:30:36 -0000
@@ -1,6 +1,6 @@
 ## Process this file with automake to create Makefile.in
 
-XFAIL_TESTS = subdir5.test auxdir2.test cond17.test
+XFAIL_TESTS = subdir8.test auxdir2.test cond17.test
 
 TESTS =        \
 acinclude.test \
@@ -376,6 +376,7 @@
 subdir5.test \
 subdir6.test \
 subdir7.test \
+subdir8.test \
 subdirbuiltsources.test \
 subcond.test \
 subcond2.test \
Index: tests/subdir5.test
===================================================================
RCS file: /cvs/automake/automake/tests/subdir5.test,v
retrieving revision 1.6
diff -u -r1.6 subdir5.test
--- tests/subdir5.test  8 Sep 2002 13:07:56 -0000       1.6
+++ tests/subdir5.test  12 Apr 2003 22:30:36 -0000
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -19,6 +19,8 @@
 # Boston, MA 02111-1307, USA.
 
 # Test to make sure that adding a new directory works.
+# This test runs `make' from the top-level directory, subdir8.test
+# do it from a subdirectory.
 # PR automake/46
 
 # This test assumes that the `make' utility is able to start
@@ -26,12 +28,15 @@
 required='GNUmake gcc'
 . ./defs || exit 1
 
+set -e
+
 cat > configure.in << 'END'
-AC_INIT(a.c)
-AM_INIT_AUTOMAKE(maude, 1.0)
+AC_INIT(maude, 1.0)
+AM_INIT_AUTOMAKE
 AM_PROG_CC_C_O
 AC_PROG_CC
-AC_OUTPUT(Makefile)
+AC_CONFIG_FILES(Makefile)
+AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
@@ -48,8 +53,6 @@
 }
 END
 
-set -e
-
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --include-deps --copy --add-missing
@@ -58,13 +61,17 @@
 
 # Now add a new directory.
 cat > configure.in << 'END'
-AC_INIT(a.c)
-AM_INIT_AUTOMAKE(maude, 1.0)
+AC_INIT(maude, 1.0)
+AM_INIT_AUTOMAKE
 AM_PROG_CC_C_O
 AC_PROG_CC
-AC_OUTPUT(Makefile maude/Makefile)
+AC_CONFIG_FILES(Makefile maude/Makefile)
+m4_include([confile.m4])
+AC_OUTPUT
 END
 
+: > confile.m4
+
 mkdir maude
 cat > maude/Makefile.am << 'END'
 include_HEADERS = foo.h
@@ -76,3 +83,17 @@
 
 # We want a simple rebuild to create maude/Makefile automatically.
 $MAKE
+test -f maude/Makefile
+
+# Add yet another directory
+mkdir maude2
+echo 'AC_CONFIG_FILES([maude2/Makefile])AC_SUBST([GREPME])' > confile.m4
+: > maude2/Makefile.am
+echo 'SUBDIRS += maude2' >> Makefile.am
+
+# We want a simple rebuild to create maude2/Makefile and update
+# all other Makefiles automatically.
+$MAKE
+grep GREPME Makefile
+grep GREPME maude/Makefile
+grep GREPME maude2/Makefile
Index: tests/subdir8.test
===================================================================
RCS file: tests/subdir8.test
diff -N tests/subdir8.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/subdir8.test  12 Apr 2003 22:30:36 -0000
@@ -0,0 +1,91 @@
+#! /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 adding a new directory works, even from
+# subdirectories.  (subdir5.test makes sure it works when make
+# is run from the top-level directory.)
+# PR automake/46
+
+# 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 gcc'
+. ./defs || exit 1
+
+set -e
+
+echo 'AC_CONFIG_FILES([sub/Makefile])' >confiles.m4
+
+cat >> configure.in << 'END'
+AM_PROG_CC_C_O
+AC_PROG_CC
+m4_include([confiles.m4])
+AC_OUTPUT
+END
+
+echo 'SUBDIRS = sub' > Makefile.am
+
+mkdir sub
+
+cat > sub/Makefile.am << 'END'
+bin_PROGRAMS = wish
+wish_SOURCES = a.c
+END
+
+cat > sub/a.c << 'END'
+#include <stdio.h>
+int main ()
+{
+   printf ("hi liver!\n");
+   return 0;
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --copy --add-missing
+./configure
+$MAKE
+
+# Now add a new directory.
+
+mkdir sub/maude
+cat > sub/maude/Makefile.am << 'END'
+include_HEADERS = foo.h
+END
+
+: > sub/maude/foo.h
+
+echo 'SUBDIRS = maude' >> sub/Makefile.am
+
+mkdir maude
+: > maude/Makefile.am
+
+# Update confile.m4 *after* updating sub/Makefile.am.
+# (subdir5.test do it in the other way: it updates configure.in
+# before Makefile.am)
+echo 'AC_CONFIG_FILES([maude/Makefile sub/maude/Makefile])' >> confiles.m4
+
+# We want a simple rebuild from sub/ to create sub/maude/Makefile
+# and maude/Makefile automatically.
+cd sub
+$MAKE
+cd ..
+test -f maude/Makefile
+test -f sub/maude/Makefile

-- 
Alexandre Duret-Lutz





reply via email to

[Prev in Thread] Current Thread [Next in Thread]