[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI: fix --no-force on HEAD
From: |
Alexandre Duret-Lutz |
Subject: |
FYI: fix --no-force on HEAD |
Date: |
Mon, 25 Aug 2003 00:34:42 +0200 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux) |
I'm checking this in on HEAD. This rewrites the --no-force logic to
honor all Makefile.in's dependencies (included Makefile fragments,
m4_included M4 fragments) and all implicit sources of changes (the
creation of a file like README should cause the Makefile.in to be
rewritten although none of its dependencies changed).
2003-08-24 Alexandre Duret-Lutz <address@hidden>
For Debian Bug #206299:
* automake.in ($configure_deps_greatest_timestamp,
$output_deps_greatest_timestamp): New variables.
(initialize_per_input): Reset $output_deps_greatest_timestamp.
(scan_autoconf_traces, scan_autoconf_files, read_am_file):
Update $configure_deps_greatest_timestamp and
$output_deps_greatest_timestamp
(generate_makefile): Rewrite the logic to decide whether
to rewrite the output. Move the leading dup_channel_setup
and trailing drop_channel_setup to MAIN, so that
drop_channel_setup is executed for all exit paths.
* tests/aclocal7.test: Update to check for $AUTOMAKE --no-force
* tests/distcom6.test: New file. Report from Scott James Remnant.
* tests/Makefile.am (TESTS): Add distcom6.test.
Index: NEWS
===================================================================
RCS file: /cvs/automake/automake/NEWS,v
retrieving revision 1.224
diff -u -r1.224 NEWS
--- NEWS 24 Aug 2003 19:56:07 -0000 1.224
+++ NEWS 24 Aug 2003 22:29:17 -0000
@@ -151,6 +151,9 @@
the top level Makefile, and passed to sub-directories when running
`make dist'.
+ - The --no-force option now correctly checks the Makefile.in's
+ dependencies before deciding not to update it.
+
* Miscellaneous
- Targets dist-gzip, dist-bzip2, dist-tarZ, dist-zip are always defined.
Index: THANKS
===================================================================
RCS file: /cvs/automake/automake/THANKS,v
retrieving revision 1.219
diff -u -r1.219 THANKS
--- THANKS 31 Jul 2003 20:27:59 -0000 1.219
+++ THANKS 24 Aug 2003 22:29:18 -0000
@@ -198,6 +198,7 @@
Ryan T. Sammartino address@hidden
Sam Hocevar address@hidden
Sander Niemeijer address@hidden
+Scott James Remnant address@hidden
Sergey Vlasov address@hidden
Seth Alves address@hidden
Shuhei Amakawa address@hidden
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1500
diff -u -r1.1500 automake.in
--- automake.in 24 Aug 2003 02:16:31 -0000 1.1500
+++ automake.in 24 Aug 2003 22:29:22 -0000
@@ -362,9 +362,12 @@
# generation.
my %configure_vars = ();
-# Files included by @configure.
+# Files included by $configure_ac.
my @configure_deps = ();
+# Greatest timestamp of configure's dependencies.
+my $configure_deps_greatest_timestamp = 0;
+
# Hash table of AM_CONDITIONAL variables seen in configure.
my %configure_cond = ();
@@ -437,6 +440,10 @@
my $in_file_name;
my $relative_dir;
+# Greatest timestamp of the output's dependencies (excluding
+# configure's dependencies).
+my $output_deps_greatest_timestamp;
+
# These two variables are used when generating each Makefile.in.
# They hold the Makefile.in until it is ready to be printed.
my $output_rules;
@@ -579,6 +586,8 @@
$in_file_name = '';
$relative_dir = '';
+ $output_deps_greatest_timestamp = 0;
+
$output_rules = '';
$output_vars = '';
$output_trailer = '';
@@ -4376,6 +4385,13 @@
# so we skip absolute filenames here.
push @configure_deps, '$(top_srcdir)/' . $args[1]
unless $here =~ m,^(?:\w:)?[\\/],;
+ # Keep track of the greatest timestamp.
+ if (-e $args[1])
+ {
+ my $mtime = mtime $args[1];
+ $configure_deps_greatest_timestamp = $mtime
+ if $mtime > $configure_deps_greatest_timestamp;
+ }
}
}
}
@@ -4393,6 +4409,15 @@
# that won't always be the case.
%libsources = ();
+ # Keep track of the youngest configure dependency.
+ $configure_deps_greatest_timestamp = mtime $configure_ac;
+ if (-e 'aclocal.m4')
+ {
+ my $mtime = mtime 'aclocal.m4';
+ $configure_deps_greatest_timestamp = $mtime
+ if $mtime > $configure_deps_greatest_timestamp;
+ }
+
scan_autoconf_traces ($configure_ac);
# Set input and output files if not specified by user.
@@ -5196,6 +5221,11 @@
my $am_file = new Automake::XFile ("< $amfile");
verb "reading $amfile";
+ # Keep track of the youngest output dependency.
+ my $mtime = mtime $amfile;
+ $output_deps_greatest_timestamp = $mtime
+ if $mtime > $output_deps_greatest_timestamp;
+
my $spacing = '';
my $comment = '';
my $blank = 0;
@@ -6476,8 +6506,6 @@
# Reset all the Makefile.am related variables.
initialize_per_input;
- # Any warning setting now local to this Makefile.am.
- dup_channel_setup;
# AUTOMAKE_OPTIONS can contains -W flags to disable or enable
# warnings for this file. So hold any warning issued before
# we have processed AUTOMAKE_OPTIONS.
@@ -6612,42 +6640,44 @@
}
my ($out_file) = $output_directory . '/' . $makefile . ".in";
- if (! $force_generation && -e $out_file)
- {
- my ($am_time) = (stat ($makefile . '.am'))[9];
- my ($in_time) = (stat ($out_file))[9];
- # FIXME: should cache these times.
- my ($conf_time) = (stat ($configure_ac))[9];
- # FIXME: how to do unsigned comparison?
- if ($am_time < $in_time || $am_time < $conf_time)
- {
- # No need to update.
- return;
- }
- if (-f 'aclocal.m4')
- {
- my ($acl_time) = (stat _)[9];
- return if ($am_time < $acl_time);
- }
+
+ # We make sure that `all:' is the first target.
+ $output =
+ "$output_vars$output_all$output_header$output_rules$output_trailer";
+
+ # Decide whether we must update the output file or not.
+ # We have to update in the following situations.
+ # * $force_generation is set.
+ # * any of the output dependencies is younger than the output
+ # * the contents of the output is different (this can happen
+ # if the project has been populated with a file listed in
+ # @common_files since the last run).
+ # Output's dependencies are split in two sets:
+ # * dependencies which are also configure dependencies
+ # These do not change between each Makefile.am
+ # * other dependencies, specific to the Makefile.am being processed
+ # (such as the Makefile.am itself, or any Makefile fragment
+ # it includes).
+ my $timestamp = mtime $out_file;
+ if (! $force_generation
+ && $configure_deps_greatest_timestamp < $timestamp
+ && $output_deps_greatest_timestamp < $timestamp
+ && $output eq contents ($out_file))
+ {
+ verb "$out_file unchanged";
+ # No need to update.
+ return;
}
- if (-e "$out_file")
+ if (-e $out_file)
{
unlink ($out_file)
or fatal "cannot remove $out_file: $!\n";
}
- my $gm_file = new Automake::XFile "> $out_file";
- verb "creating $makefile.in";
- print $gm_file $output_vars;
- # We make sure that `all:' is the first target.
- print $gm_file $output_all;
- print $gm_file $output_header;
- print $gm_file $output_rules;
- print $gm_file $output_trailer;
-
- # Back out any warning setting.
- drop_channel_setup;
+ my $gm_file = new Automake::XFile "> $out_file";
+ verb "creating $out_file";
+ print $gm_file $output;
}
################################################################
@@ -6893,7 +6923,13 @@
}
else
{
+ # Any warning setting now local to this Makefile.am.
+ dup_channel_setup;
+
generate_makefile ($output_files{$am_file}, $am_file);
+
+ # Back out any warning setting.
+ drop_channel_setup;
}
}
++$automake_has_run;
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.511
diff -u -r1.511 Makefile.am
--- tests/Makefile.am 24 Aug 2003 02:00:58 -0000 1.511
+++ tests/Makefile.am 24 Aug 2003 22:29:23 -0000
@@ -170,6 +170,7 @@
distcom3.test \
distcom4.test \
distcom5.test \
+distcom6.test \
distdir.test \
distname.test \
dollar.test \
Index: tests/Makefile.in
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.in,v
retrieving revision 1.658
diff -u -r1.658 Makefile.in
--- tests/Makefile.in 24 Aug 2003 02:16:31 -0000 1.658
+++ tests/Makefile.in 24 Aug 2003 22:29:23 -0000
@@ -279,6 +279,7 @@
distcom3.test \
distcom4.test \
distcom5.test \
+distcom6.test \
distdir.test \
distname.test \
dollar.test \
Index: tests/aclocal7.test
===================================================================
RCS file: /cvs/automake/automake/tests/aclocal7.test,v
retrieving revision 1.1
diff -u -r1.1 aclocal7.test
--- tests/aclocal7.test 6 May 2003 12:07:22 -0000 1.1
+++ tests/aclocal7.test 24 Aug 2003 22:29:23 -0000
@@ -19,6 +19,7 @@
# Boston, MA 02111-1307, USA.
# Make sure aclocal does not overwrite aclocal.m4 needlessly.
+# Also make sure automake --no-force does not overwrite Makefile.in needlessly.
. ./defs || exit 1
@@ -26,8 +27,19 @@
cat >> configure.in << 'END'
SOME_DEFS
+AC_CONFIG_FILES([sub/Makefile])
END
+mkdir sub
+: > sub/Makefile.am
+
+cat >> Makefile.am << 'END'
+SUBDIRS = sub
+include fragment.inc
+END
+
+: > fragment.inc
+
mkdir m4
echo 'AC_DEFUN([SOME_DEFS], [])' > m4/somedefs.m4
@@ -35,23 +47,73 @@
$ACLOCAL -I m4
+# Automake will take aclocal.m4 to be newer if it has the same timestamp
+# as Makefile.in. Avoid the confusing by sleeping.
+$sleep
+
+$AUTOMAKE --no-force
+
$sleep
touch foo
$ACLOCAL -I m4
+$AUTOMAKE --no-force
-# aclocal.m4 should not have been updated, so `foo' should be younger
-test `ls -1t aclocal.m4 foo | sed 1q` = foo
+# aclocal.m4 and Makefile.in should not have been updated, so `foo'
+# should be younger
+test `ls -1t aclocal.m4 Makefile.in sub/Makefile.in foo | sed 1q` = foo
$sleep
$ACLOCAL -I m4 --force
test `ls -1t aclocal.m4 foo | sed 1q` = aclocal.m4
+# We still use --no-force for automake, but since aclocal.m4 has
+# changed all Makefile.ins should be updated.
+$sleep
+$AUTOMAKE --no-force
+test `ls -1t Makefile.in foo | sed 1q` = Makefile.in
+test `ls -1t sub/Makefile.in foo | sed 1q` = sub/Makefile.in
touch m4/somedefs.m4
$sleep
touch foo
$sleep
$ACLOCAL -I m4
+$sleep
+$AUTOMAKE --no-force
# aclocal.m4 should have been updated, although its contents haven't changed.
test `ls -1t aclocal.m4 foo | sed 1q` = aclocal.m4
+test `ls -1t Makefile.in foo | sed 1q` = Makefile.in
+test `ls -1t sub/Makefile.in foo | sed 1q` = sub/Makefile.in
+
+touch fragment.inc
+$sleep
+touch foo
+$ACLOCAL -I m4
+$AUTOMAKE --no-force
+# Only ./Makefile.in should change.
+test `ls -1t aclocal.m4 foo | sed 1q` = foo
+test `ls -1t Makefile.in foo | sed 1q` = Makefile.in
+test `ls -1t sub/Makefile.in foo | sed 1q` = foo
+
+grep README Makefile.in && exit 1
+
+: > README
+$sleep
+touch foo
+$AUTOMAKE --no-force
+# Even if no dependency change, the content changed.
+test `ls -1t Makefile.in foo | sed 1q` = Makefile.in
+test `ls -1t sub/Makefile.in foo | sed 1q` = foo
+
+grep README Makefile.in
+
+: > sub/Makefile.in
+$sleep
+touch foo
+$ACLOCAL -I m4
+$AUTOMAKE --no-force
+# Only sub/Makefile.in should change.
+test `ls -1t aclocal.m4 foo | sed 1q` = foo
+test `ls -1t Makefile.in foo | sed 1q` = foo
+test `ls -1t sub/Makefile.in foo | sed 1q` = sub/Makefile.in
Index: tests/distcom6.test
===================================================================
RCS file: tests/distcom6.test
diff -N tests/distcom6.test
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/distcom6.test 24 Aug 2003 22:29:23 -0000
@@ -0,0 +1,74 @@
+#! /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 depcomp and compile required in subdirectories
+# are added to the top-level DIST_COMMON even with --no-force.
+# This is similar to distcom2.test, but with --no-force added.
+# Report from Scott James Remnant (Debian #206299).
+
+. ./defs || exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_CONFIG_FILES([subdir/Makefile])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+SUBDIRS = subdir
+END
+
+mkdir subdir
+: > subdir/foo.c
+
+cat > subdir/Makefile.am << 'END'
+noinst_PROGRAMS = foo
+foo_SOURCES = foo.c
+foo_CFLAGS = -DBAR
+END
+
+rm -f compile depcomp
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing --no-force
+
+test -f compile
+test -f depcomp
+
+sed -n -e '/^DIST_COMMON =.*\\$/ {
+ :loop
+ p
+ n
+ /\\$/ b loop
+ p
+ n
+ }' -e '/^DIST_COMMON =/ p' Makefile.in | grep compile
+
+sed -n -e '/^DIST_COMMON =.*\\$/ {
+ :loop
+ p
+ n
+ /\\$/ b loop
+ p
+ n
+ }' -e '/^DIST_COMMON =/ p' Makefile.in | grep depcomp
--
Alexandre Duret-Lutz
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- FYI: fix --no-force on HEAD,
Alexandre Duret-Lutz <=