[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Automake-NG] [PATCH 09/14] [ng] clean: don't remove object files in
From: |
Akim Demaille |
Subject: |
Re: [Automake-NG] [PATCH 09/14] [ng] clean: don't remove object files in '.' unconditionally |
Date: |
Thu, 21 Jun 2012 14:59:11 +0200 |
Le 21 juin 2012 à 12:32, Stefano Lattarini a écrit :
> Do that only if some source file is actually present in the current
> directory (which might not be the case for, say, projects that use
> a non-recursive make setup and have all sources in the 'src' and 'lib'
> subdirectories).
>
> * lib/am/compile.am (am__mostlyclean_files): Don't append '*.$(OBJEXT)'
> unconditionally.
> * lib/am/libtool.am (am__mostlyclean_files): Don't append '*.lo'
> unconditionally.
> * automake.in (handle_single_transform): Update '%compile_clean_files'
> also for sources in the current directory. Some related adjustments.
> Remove obsolete comments while we are at it.
> (handle_LIBOBJS_or_ALLOCA): Update '%compile_clean_files' to list
> all the object files in the directory of the extra sources brought
> in. Adjust comments accordingly.
>
> Signed-off-by: Stefano Lattarini <address@hidden>
> ---
> automake.in | 71 ++++++++++++++++++++++-------------------------------
> lib/am/compile.am | 2 +-
> lib/am/libtool.am | 1 -
> 3 files changed, 30 insertions(+), 44 deletions(-)
>
> diff --git a/automake.in b/automake.in
> index 324553a..dd9cb25 100644
> --- a/automake.in
> +++ b/automake.in
> @@ -1838,43 +1838,34 @@ sub handle_single_transform ($$$$$%)
> $linkers_used{$linker} = 1;
>
> push (@result, $object);
> + $directory = '.' if $directory eq '';
>
> if (! defined $object_map{$object})
> - {
> + {
> $object_map{$object} = $full;
>
> - # If resulting object is in subdir, we need to make
> - # sure the subdir exists at build time.
> - if ($object =~ /\//)
> - {
> - # FIXME: check that $DIRECTORY is somewhere in the
> - # project
> -
> - # For Java, the way we're handling it right now, a
> - # '..' component doesn't make sense.
> - if ($lang && $lang->name eq 'java' && $object =~ /(\/|^)\.\.\//)
> - {
> - err_am "'$full' should not contain a '..' component";
> - }
> -
> - # 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;
> - }
> - }
> - }
> + # For Java, the way we're handling it right now, a
> + # '..' component doesn't make sense.
> + err_am "'$full' should not contain a '..' component"
> + if $lang && $lang->name eq 'java' && $object =~ m{(/|^)\.\./};
> +
> + # Make sure *all* objects files in this object's subdirectory
object files
> + # 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.
either "its directory" or "the same directory"
> + $compile_clean_files{"$directory/*.lo"} = MOSTLY_CLEAN;
> + # Remember to cleanup .libs/ in this directory.
> + $libtool_clean_directories{$directory} = 1;
Can't libtool's stuff be regular %clean_dirs?
Nice.
- Re: [Automake-NG] [PATCH 06/14] [ng] automake: new global variable '%clean_dirs', (continued)
- [Automake-NG] [PATCH 05/14] [ng] clean: do not ignore errors while removing files, Stefano Lattarini, 2012/06/21
- [Automake-NG] [PATCH 08/14] [ng] cleanup: remove 'depend.am', Stefano Lattarini, 2012/06/21
- [Automake-NG] [PATCH 11/14] [ng] cleanup: merge '%compile_clean_files' in '%clean_files', Stefano Lattarini, 2012/06/21
- [Automake-NG] [PATCH 09/14] [ng] clean: don't remove object files in '.' unconditionally, Stefano Lattarini, 2012/06/21
- Re: [Automake-NG] [PATCH 09/14] [ng] clean: don't remove object files in '.' unconditionally,
Akim Demaille <=
- [Automake-NG] [PATCH 07/14] [ng] refactoring: move definition of $(am__mv) in depend2.am, Stefano Lattarini, 2012/06/21
- [Automake-NG] [PATCH 10/14] [ng] refactoring: no "cleaning" rules in compile.am, Stefano Lattarini, 2012/06/21
- [Automake-NG] [PATCH 12/14] [ng] refactor: prefer '&file_contents' over '&file_contents_internals', Stefano Lattarini, 2012/06/21
- [Automake-NG] [PATCH 14/14] [ng] check: keep cleaning of '.log' and '.trs' files near other rules, Stefano Lattarini, 2012/06/21