On 08/27/2017 05:23 PM, Mathieu Lirzin wrote:
> Michael Haubenwallner <michael.haubenwall...@ssi-schaefer.com> writes:
>> On 08/24/2017 11:35 AM, Mathieu Lirzin wrote:
>>
>>> Instead of this dummy target, I would rather prefer adding the dirstamp
>>> dependency for each explicit object file separately.  this should be 
>>> computed
>>> from the '%libsources' variable.  However after a quick look in the code, it
>>> seems that this variable is not properly populated by the
>>> 'scan_autoconf_traces' subroutine.  It only contains the files that are
>>> explicitely defined by scanning the AC_LIBSOURCE macro and not by AC_LIBOBJ 
>>> or
>>> AC_LIBSOURCES in 'configure.ac'.
>>>
>>> Michael: Are you interested in looking into this?
>>>
>>
>> Here's an attempt to use the explicit AC_LIBSOURCE values to depend on the
>> LIBOBJDIR dirstamp. IMHO, tracing AC_LIBOBJ would not provide additional
>> information over AC_LIBSOURCE, as AC_LIBOBJ by itself uses AC_LIBSOURCE.
> 
> I stand corrected.  This is indeed working properly since
> 'scan_autoconf_traces' doesn't simply scan "configure.ac" but the output
> 'autoconf --trace=...'.
> 
>> >From 4465bb9e31c12a8f59c199c61aaef17966e1ffc4 Mon Sep 17 00:00:00 2001
>> From: Michael Haubenwallner <michael.haubenwall...@ssi-schaefer.com>
>> Date: Wed, 16 Aug 2017 18:16:12 +0200
>> Subject: [PATCH] automake: Depend on LIBOBJDIR for LIBOBJS.
>>
>> This change fixes automake bug#27781.
>>
>> * bin/automake.in: Add Makefile dependency on LIBOBJDIR/dirstamp for
>> each LIBOBJS/ALLOCA source file found.
>> ---
> 
> This patch can't be applied on the 'minor' branch, which corresponds to
> the branch of the next release (I know this is confusing [1]).  Could
> resend it after rebasing onto the 'minor' branch?
> 

Here we go, also removing t/libobj-no-dependency-tracking.sh from XFAIL_TESTS.

Thanks,
/haubi/
>From d3ee31dfa106752e82eaa6176451e7126c5bbc08 Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner <michael.haubenwall...@ssi-schaefer.com>
Date: Wed, 16 Aug 2017 18:16:12 +0200
Subject: [PATCH] automake: Depend on LIBOBJDIR for LIBOBJS.

This change fixes automake bug#27781.

* bin/automake.in: Add Makefile dependency on LIBOBJDIR/dirstamp for
each LIBOBJS/ALLOCA source file found.
* t/list-of-tests.mk (XFAIL_TESTS): Drop
t/libobj-no-dependency-tracking.sh.
---
 bin/automake.in    | 30 ++++++++++++++++++------------
 t/list-of-tests.mk |  1 -
 2 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/bin/automake.in b/bin/automake.in
index 3433d3d..376b730 100644
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -2329,13 +2329,14 @@ sub handle_lib_objects
   return $seen_libobjs;
 }
 
-# handle_LIBOBJS_or_ALLOCA ($VAR)
-# -------------------------------
+# handle_LIBOBJS_or_ALLOCA ($VAR, $BASE)
+# --------------------------------------
 # Definitions common to LIBOBJS and ALLOCA.
-# VAR should be one of LIBOBJS, LTLIBOBJS, ALLOCA, or LTALLOCA.
+# VAR should be one of LIBOBJS, LTLIBOBJS, or ALLOCA.
+# BASE should be one base file name from AC_LIBSOURCE, or alloca.
 sub handle_LIBOBJS_or_ALLOCA
 {
-  my ($var) = @_;
+  my ($var, $base) = @_;
 
   my $dir = '';
 
@@ -2357,9 +2358,14 @@ sub handle_LIBOBJS_or_ALLOCA
 	  $dir = backname ($relative_dir) . "/$dir"
 	    if $relative_dir ne '.';
 	  define_variable ('LIBOBJDIR', "$dir", INTERNAL);
-	  $clean_files{"\$($var)"} = MOSTLY_CLEAN;
-	  # libtool might create LIBOBJS as a side-effect of using LTLIBOBJS.
-	  $clean_files{"\$(LIBOBJS)"} = MOSTLY_CLEAN if $var eq "LTLIBOBJS";
+	  if ($dir && !defined $clean_files{"$dir$base.\$(OBJEXT)"}) {
+	    my $dirstamp = require_build_directory ($dir);
+	    $output_rules .= "$dir$base.\$(OBJEXT): $dirstamp\n";
+	    $output_rules .= "$dir$base.lo: $dirstamp\n" if $var eq "LTLIBOBJS";
+	  }
+	  # libtool might create .$(OBJEXT) as a side-effect of using LTLIBOBJS.
+	  $clean_files{"$dir$base.\$(OBJEXT)"} = MOSTLY_CLEAN;
+	  $clean_files{"$dir$base.lo"} = MOSTLY_CLEAN if $var eq "LTLIBOBJS";
 	}
       else
 	{
@@ -2380,14 +2386,14 @@ sub handle_LIBOBJS
   $var->requires_variables ("\@${lt}LIBOBJS\@ used", $lt . 'LIBOBJS')
     if ! keys %libsources;
 
-  my $dir = handle_LIBOBJS_or_ALLOCA "${lt}LIBOBJS";
-
   foreach my $iter (keys %libsources)
     {
-      if ($iter =~ /\.[cly]$/)
+      my $dir = '';
+      if ($iter =~ /^(.*)(\.[cly])$/)
 	{
-	  saw_extension ($&);
+	  saw_extension ($2);
 	  saw_extension ('.c');
+	  $dir = handle_LIBOBJS_or_ALLOCA ("${lt}LIBOBJS", $1);
 	}
 
       if ($iter =~ /\.h$/)
@@ -2415,7 +2421,7 @@ sub handle_ALLOCA
   my ($var, $cond, $lt) = @_;
   my $myobjext = $lt ? 'lo' : 'o';
   $lt ||= '';
-  my $dir = handle_LIBOBJS_or_ALLOCA "${lt}ALLOCA";
+  my $dir = handle_LIBOBJS_or_ALLOCA ("${lt}ALLOCA", "alloca");
 
   $dir eq '' and $dir = './';
   $var->requires_variables ("\@${lt}ALLOCA\@ used", $lt . 'ALLOCA');
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index dab4a7c..ebf9651 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -38,7 +38,6 @@ t/override-conditional-pr13940.sh \
 t/dist-pr109765.sh \
 t/instdir-cond2.sh \
 t/java-nobase.sh \
-t/libobj-no-dependency-tracking.sh \
 t/objext-pr10128.sh \
 t/remake-timing-bug-pr8365.sh \
 t/lex-subobj-nodep.sh \
-- 
2.10.2

Reply via email to