Michael Haubenwallner writes: > On 08/23/2017 11:24 PM, Mathieu Lirzin wrote: >> Michael Haubenwallner writes: >>> On 08/22/2017 12:40 AM, Mathieu Lirzin wrote: >>>> Michael Haubenwallner 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