diff options
author | Stefano Lattarini <stefano.lattarini@gmail.com> | 2012-06-10 13:38:58 +0200 |
---|---|---|
committer | Stefano Lattarini <stefano.lattarini@gmail.com> | 2012-06-10 14:08:41 +0200 |
commit | 06dfdbe38e78c5eedb03f688f0264ec0097a4e21 (patch) | |
tree | 3b9415bbc86d434bb4a47269ba97ccc694d94d06 /automake.in | |
parent | 98b96fccc5df7166a0efc02881a13fbb84e29af6 (diff) | |
download | automake-06dfdbe38e78c5eedb03f688f0264ec0097a4e21.tar.gz |
subdir-objects: improve "make mostlyclean" efficiency and flexibility
Fixes automake bug#10697.
Before this change, the generated Makefile issued one 'rm' invocation
for each subdir object file. Not only was this very inefficient when
there were several such files, but it also caused stale object files
to be left behind when a source file was renamed or removed.
* automake.in (handle_single_transform): When a subdir object is seen,
update '%compile_clean_files' to clean all the compiled objects in its
same subdirectory, and all the libtool compiled objects ('.lo') there
as well is that subdir object is a libtool one.
* t/subobj-clean-pr10697.sh: New test.
* t/subobj-clean-lt-pr10697.sh: Likewise.
* t/list-of-tests.mk: Add them.
* NEWS: Update.
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Diffstat (limited to 'automake.in')
-rw-r--r-- | automake.in | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/automake.in b/automake.in index 5cf5a2c16..6f8ac0c96 100644 --- a/automake.in +++ b/automake.in @@ -1963,18 +1963,22 @@ sub handle_single_transform ($$$$$%) err_am "'$full' should not contain a '..' component"; } - # Make sure object is removed by 'make mostlyclean'. - $compile_clean_files{$object} = MOSTLY_CLEAN; - # If we have a libtool object then we also must remove - # the ordinary .o. - if ($object =~ /\.lo$/) - { - (my $xobj = $object) =~ s,lo$,\$(OBJEXT),; - $compile_clean_files{$xobj} = MOSTLY_CLEAN; - - # Remove any libtool object in this directory. - $libtool_clean_directories{$directory} = 1; - } + # Make sure *all* objects files in the subdirectory are + # removed by "make mostlyclean". Not only this is more + # efficient than listing the object files to be removed + # individually (which would cause an 'rm' invocation for + # each of them -- very inefficient, see bug#10697), it + # would also leave stale object files in the subdirectory + # whenever a source file there is removed or renamed. + $compile_clean_files{"$directory/*.\$(OBJEXT)"} = MOSTLY_CLEAN; + if ($object =~ /\.lo$/) + { + # If we have a libtool object, then we also must remove + # any '.lo' objects in its same subdirectory. + $compile_clean_files{"$directory/*.lo"} = MOSTLY_CLEAN; + # Remember to cleanup .libs/ in this directory. + $libtool_clean_directories{$directory} = 1; + } push (@dep_list, require_build_directory ($directory)); |