This is the mail archive of the automake@gnu.org mailing list for the automake project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Automake 1.5 - depcomp not added to DIST_COMMON


>>> "Akim" == Akim Demaille <akim@epita.fr> writes:

[...]

 Akim> Given that this is the most important complaint against Automake,
 Akim> please install it.  And NEWS it :P

Ok.  I'm including Pavel's test too.  Here is what I'll commit
once `make check' is finished.

Index: ChangeLog
===================================================================
RCS file: /cvs/automake/automake/ChangeLog,v
retrieving revision 1.1650
diff -u -r1.1650 ChangeLog
--- ChangeLog	2001/11/09 16:27:24	1.1650
+++ ChangeLog	2001/11/09 16:47:10
@@ -1,5 +1,21 @@
 2001-11-09  Alexandre Duret-Lutz  <duret_g@epita.fr>
 
+	Fix for distcommon2.test:
+	* automake.in (automake_needs_to_reprocess_all_files): New
+	variable.
+	("main"): Process all Makefiles a second time if
+	$automake_needs_to_reprocess_all_files is set.
+	(maybe_push_required_file): Return 1 or 0 whether the file is
+	pushed or not.
+	(require_file_internal): Set $automake_needs_to_reprocess_all_files
+	if an added file can't be pushed.
+
+	* test/distcommon2.test: New file.
+	* test/Makefile.am (TESTS): Add distcommon2.test.
+	From Pavel Roskin.
+
+2001-11-09  Alexandre Duret-Lutz  <duret_g@epita.fr>
+
 	* automake.in (exec_dir_p): Remove.  Replace by...
 	(EXEC_DIR_PATTERN):... this.
 	(am_install_var): Adjust to use EXEC_DIR_PATTERN.
Index: NEWS
===================================================================
RCS file: /cvs/automake/automake/NEWS,v
retrieving revision 1.157
diff -u -r1.157 NEWS
--- NEWS	2001/11/09 16:25:02	1.157
+++ NEWS	2001/11/09 16:47:10
@@ -11,6 +11,7 @@
 * Fixed CDPATH portability problems, in particular for MacOS X.
 * Fixed handling of nobase_ targets.
 * Fixed support of implicit rules leading to .lo objects.
+* Fixed late inclusion of --add-missing files (e.g. depcomp) in DIST_COMMON
 
 New in 1.5:
 * Support for `configure.ac'.
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1231
diff -u -r1.1231 automake.in
--- automake.in	2001/11/09 16:27:25	1.1231
+++ automake.in	2001/11/09 16:47:12
@@ -443,6 +443,11 @@
    'install-man' => 1,
   );
 
+# This is set to 1 when Automake needs to be run again.
+# (For instance, this happens when an auxiliary file such as
+# depcomp is added after the toplevel Makefile.in -- which
+# should distribute depcomp -- has been generated.)
+my $automake_needs_to_reprocess_all_files = 0;
 
 
 ################################################################
@@ -966,21 +971,36 @@
 die "$me: no `Makefile.am' found or specified\n"
     if ! @input_files;
 
-# Now do all the work on each file.
-# This guy must be local otherwise it's private to the loop.
-use vars '$am_file';
-local $am_file;
-foreach $am_file (@input_files)
+my $automake_has_run = 0;
+
+do
 {
-    if (! -f ($am_file . '.am'))
+    if ($automake_has_run)
     {
-	&am_error ("`" . $am_file . ".am' does not exist");
+	print "$me: processing Makefiles another time to fix them up.\n";
+	&prog_error ("running more than two times should never be needed.")
+	    if $automake_has_run >= 2;
     }
-    else
+    $automake_needs_to_reprocess_all_files = 0;
+
+    # Now do all the work on each file.
+    # This guy must be local otherwise it's private to the loop.
+    use vars '$am_file';
+    local $am_file;
+    foreach $am_file (@input_files)
     {
- 	&generate_makefile ($output_files{$am_file}, $am_file);
+	if (! -f ($am_file . '.am'))
+	{
+	    &am_error ("`" . $am_file . ".am' does not exist");
+	}
+	else
+	{
+	    &generate_makefile ($output_files{$am_file}, $am_file);
+	}
     }
+    ++$automake_has_run;
 }
+while ($automake_needs_to_reprocess_all_files);
 
 exit $exit_status;
 
@@ -7574,6 +7594,7 @@
     if ($dir eq $relative_dir)
     {
 	push_dist_common ($file);
+	return 1;
     }
     elsif ($relative_dir eq '.' && ! &is_make_dir ($dir))
     {
@@ -7581,7 +7602,9 @@
 	# subdir which does not have a Makefile, then we distribute it
 	# here.
 	push_dist_common ($fullfile);
+	return 1;
     }
+    return 0;
 }
 
 
@@ -7692,8 +7715,24 @@
 			}
 		    }
 
-		    maybe_push_required_file (dirname ($errfile),
-					      $file, $errfile);
+		    if (! maybe_push_required_file (dirname ($errfile),
+                                                    $file, $errfile))
+		    {
+			if (! $found_it)
+			{
+			    # We have added the file but could not push it
+			    # into DIST_COMMON (probably because this is
+			    # an auxiliary file and we are not processing
+			    # the top level Makefile). This is unfortunate,
+			    # since it means we are using a file which is not
+			    # distributed!
+
+			    # Get Automake to be run again: on the second
+			    # run the file will be found, and pushed into
+			    # the toplevel DIST_COMMON automatically.
+			    $automake_needs_to_reprocess_all_files = 1;
+			}
+		    }
 
 		    # Prune the path list.
 		    @require_file_paths = &dirname ($errfile);
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.352
diff -u -r1.352 Makefile.am
--- Makefile.am	2001/11/09 16:25:03	1.352
+++ Makefile.am	2001/11/09 16:47:12
@@ -117,6 +117,7 @@
 dirname.test \
 discover.test \
 distcommon.test \
+distcommon2.test \
 distdir.test \
 distname.test \
 double.test \
Index: tests/Makefile.in
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.in,v
retrieving revision 1.457
diff -u -r1.457 Makefile.in
--- Makefile.in	2001/11/09 16:25:03	1.457
+++ Makefile.in	2001/11/09 16:47:12
@@ -190,6 +190,7 @@
 dirname.test \
 discover.test \
 distcommon.test \
+distcommon2.test \
 distdir.test \
 distname.test \
 double.test \
Index: tests/distcommon2.test
===================================================================
RCS file: distcommon2.test
diff -N distcommon2.test
--- /dev/null	Tue May  5 13:32:27 1998
+++ distcommon2.test	Fri Nov  9 08:47:12 2001
@@ -0,0 +1,53 @@
+#! /bin/sh
+
+# Test to make sure that depcomp and compile are added to DIST_COMMON
+# From Pavel Roskin.
+
+. $srcdir/defs || exit 1
+
+cat > configure.in << 'END'
+AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+PACKAGE=nonesuch
+VERSION=nonesuch
+AC_PROG_CC
+AC_OUTPUT(Makefile subdir/Makefile)
+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 || exit 1
+$AUTOMAKE --add-missing || exit 1
+
+test -f compile || exit 1
+test -f depcomp || exit 1
+
+sed -n -e '/^DIST_COMMON =.*\\$/ {
+   :loop
+   p
+   n
+   /\\$/ b loop
+   p
+   n
+   }' -e '/^DIST_COMMON =/ p' Makefile.in | grep compile || exit 1
+
+sed -n -e '/^DIST_COMMON =.*\\$/ {
+   :loop
+   p
+   n
+   /\\$/ b loop
+   p
+   n
+   }' -e '/^DIST_COMMON =/ p' Makefile.in | grep depcomp || exit 1

-- 
Alexandre Duret-Lutz


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]