Hi,

On 08/08/2017 11:17 PM, Mathieu Lirzin wrote:
> Michael Haubenwallner <michael.haubenwall...@ssi-schaefer.com> writes:
>>
>> I have no idea for how to fix automake for this situation, but it
>> feels like automake should add this line to src/Makefile.in here:
>>
>> $(LIBOBJS): $(LIBOBJDIR)$(am__dirstamp)

> 
> I confirm that this is an Automake issue.  After some digging I think
> 'automake' should call the 'require_build_directory' subroutine for the
> LIBOBJDIR variable.  However I don't have time to investigate more right
> now.

In this case let me come up with attached patch for now
(without deeper knowledge of automake internals though).

Thanks!
/haubi/
>From c3d51adb53400fc8bf65c0e003d810b2e7166d0d 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 variable used.
---
 bin/automake.in | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/bin/automake.in b/bin/automake.in
index 9c4cb86..b82e8c5 100644
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -2153,10 +2153,19 @@ sub handle_LIBOBJS_or_ALLOCA
       $dir = backname ($relative_dir) . "/$dir"
         if $relative_dir ne '.';
       define_variable ('LIBOBJDIR', "$dir", INTERNAL);
+      my $dirstamp = '';
+      # Abusing $clean_files{"$(VAR)"} as indicator for whether
+      # we have added the "$(VAR): $dirstamp" dependency already.
+      $dirstamp = require_build_directory ($dir)
+	if ! defined $clean_files{"\$($var)"};
       $clean_files{"\$($var)"} = MOSTLY_CLEAN;
+      $output_rules .= "\$($var): $dirstamp\n" if ($dirstamp);
       # If LTLIBOBJS is used, we must also clear LIBOBJS (which might
       # be created by libtool as a side-effect of creating LTLIBOBJS).
-      $clean_files{"\$($var)"} = MOSTLY_CLEAN if $var =~ s/^LT//;
+      if ($var =~ s/^LT//) {
+	$clean_files{"\$($var)"} = MOSTLY_CLEAN;
+	$output_rules .= "\$($var): $dirstamp\n" if ($dirstamp);
+      }
     }
 
   return $dir;
-- 
2.10.2

Reply via email to