GNU bug report logs - #27781
LIBOBJS should depend on LIBOBJDIR

Previous Next

Package: automake;

Reported by: Michael Haubenwallner <michael.haubenwallner <at> ssi-schaefer.com>

Date: Fri, 21 Jul 2017 09:09:01 UTC

Severity: normal

Tags: confirmed, fixed, patch

Done: Mathieu Lirzin <mthl <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #54 received at 27781 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Lirzin <mthl <at> gnu.org>
To: Michael Haubenwallner <michael.haubenwallner <at> ssi-schaefer.com>
Cc: 27781 <at> debbugs.gnu.org
Subject: Re: bug#27781: LIBOBJS should depend on LIBOBJDIR
Date: Sun, 27 Aug 2017 16:07:58 +0200
[Message part 1 (text/plain, inline)]
Michael Haubenwallner <michael.haubenwallner <at> ssi-schaefer.com> writes:

> On 08/23/2017 11:24 PM, Mathieu Lirzin wrote:
>> Michael Haubenwallner <michael.haubenwallner <at> ssi-schaefer.com> writes:
>>> On 08/22/2017 12:40 AM, Mathieu Lirzin wrote:
>>>> Michael Haubenwallner <michael.haubenwallner <at> ssi-schaefer.com> writes:
>>>>
>>>>>        # 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;
>>>
>> 
>> Regarding that part of the code even before you made it seems to me that
>> the conditional second '$clean_files{"\$($var)"} = MOSTLY_CLEAN'
>> statement is useless. Am I overlooking something?
> It took a while for me too to understand what's going on here:
>
> Consider $var = 'LTLIBOBJS';
>
>> Here is the snippet of the code before your changed.
>> 
>> --8<---------------cut here---------------start------------->8---
>> 	  define_variable ('LIBOBJDIR', "$dir", INTERNAL);
>> 	  $clean_files{"\$($var)"} = MOSTLY_CLEAN;
>
> here, unconditionally: $clean_files{'$(LTLIBOBJS)'} = MOSTLY_CLEAN;
>
>> 	  # 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//;
>
> Crucial here is that trailing { if $var =~ s/^LT// }:
> First, leading 'LT' eventually is dropped: $var = 'LIBOBJS';
> If the leading 'LT' was actually found: $clean_files{'LIBOBJS'} = MOSTLY_CLEAN;

I overlooked the regexp substitution.  This code is too complex for what it
achieves.  I have pushed the following patch in commit
5521219348c55af354878583b99c5f9d66d6d38a

[0001-automake-Handle-LTLIBOBJS-more-specifically.patch (text/x-patch, inline)]
From 5521219348c55af354878583b99c5f9d66d6d38a Mon Sep 17 00:00:00 2001
From: Mathieu Lirzin <mthl <at> gnu.org>
Date: Sun, 27 Aug 2017 15:27:00 +0200
Subject: [PATCH] automake: Handle LTLIBOBJS more specifically

* bin/automake.in (handle_LIBOBJS_or_ALLOCA): Remove complex regexp
substitution when handling LTLIBOBJS.
---
 bin/automake.in | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/bin/automake.in b/bin/automake.in
index d126836..cdea388 100644
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -2306,9 +2306,8 @@ sub handle_LIBOBJS_or_ALLOCA
 	    if $relative_dir ne '.';
 	  define_variable ('LIBOBJDIR', "$dir", INTERNAL);
 	  $clean_files{"\$($var)"} = MOSTLY_CLEAN;
-	  # 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//;
+	  # libtool might create LIBOBJS as a side-effect of using LTLIBOBJS.
+	  $clean_files{"\$(LIBOBJS)"} = MOSTLY_CLEAN if $var eq "LTLIBOBJS";
 	}
       else
 	{
-- 
2.9.5

[Message part 3 (text/plain, inline)]
Thanks for the explanation.

-- 
Mathieu Lirzin
GPG: F2A3 8D7E EB2B 6640 5761  070D 0ADE E100 9460 4D37

This bug report was last modified 7 years and 309 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.