From: Stefano Lattarini Date: Thu, 7 Jun 2012 18:13:37 +0000 (+0200) Subject: tags: new var $(am__tagged_files) to list all files to run taggers on X-Git-Tag: v1.12b~132 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=712c083e54d3d7e9971d918d516e19dc383bdcb5;p=thirdparty%2Fautomake.git tags: new var $(am__tagged_files) to list all files to run taggers on This change reduce code duplication a little, and will be needed by future simplifications. * automake.in (handle_tags): Define a new 'am__tagged_files' private make variable that lists all files to run taggers (mkid, cscope, ctags, etc) on. Drop the now-useless transform '%CONFIG%' when including 'tags.am'. * lib/am/tags.am: Use it in several recipes and dependencies list to reduce code duplication. Signed-off-by: Stefano Lattarini --- diff --git a/automake.in b/automake.in index 22fbbd764..b31ac11ee 100644 --- a/automake.in +++ b/automake.in @@ -3607,6 +3607,23 @@ sub handle_data # Handle TAGS. sub handle_tags { + my @config; + foreach my $spec (@config_headers) + { + my ($out, @ins) = split_config_file_spec ($spec); + foreach my $in (@ins) + { + # If the config header source is in this directory, + # require it. + push @config, basename ($in) + if $relative_dir eq dirname ($in); + } + } + + define_variable ('am__tagged_files', + '$(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)' + . "@config", INTERNAL); + my @tag_deps = (); my @ctag_deps = (); my @cscope_deps = (); @@ -3650,21 +3667,8 @@ sub handle_tags || var ('ETAGS_ARGS') || @tag_deps) { - my @config; - foreach my $spec (@config_headers) - { - my ($out, @ins) = split_config_file_spec ($spec); - foreach my $in (@ins) - { - # If the config header source is in this directory, - # require it. - push @config, basename ($in) - if $relative_dir eq dirname ($in); - } - } $output_rules .= &file_contents ('tags', new Automake::Location, - CONFIG => "@config", TAGSDIRS => "@tag_deps", CTAGSDIRS => "@ctag_deps", CSCOPEDIRS => "@cscope_deps"); diff --git a/lib/am/tags.am b/lib/am/tags.am index 9b19eb86d..eadb9c01a 100644 --- a/lib/am/tags.am +++ b/lib/am/tags.am @@ -18,9 +18,9 @@ ## ID. ## ## ---- ## -ID: $(HEADERS) $(SOURCES) %CONFIG% $(TAGS_FILES) $(LISP) +ID: $(am__tagged_files) ## Make sure the list of sources is unique. - list='$(SOURCES) %CONFIG% $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ ## Handle VPATH correctly. if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ @@ -41,8 +41,7 @@ AM_RECURSIVE_TARGETS += tags TAGS endif %?SUBDIRS% tags: TAGS -TAGS: %TAGSDIRS% $(HEADERS) $(SOURCES) %CONFIG% $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) +TAGS: %TAGSDIRS% $(TAGS_DEPENDENCIES) $(am__tagged_files) ## We use the positional parameters to build the subdir list with ## absolute names, without the need to worry about white space in `pwd`. set x; \ @@ -68,7 +67,7 @@ TAGS: %TAGSDIRS% $(HEADERS) $(SOURCES) %CONFIG% $(TAGS_DEPENDENCIES) \ ?SUBDIRS? fi; \ ?SUBDIRS? done; \ ## Make sure the list of sources is unique. - list='$(SOURCES) $(HEADERS) %CONFIG% $(LISP) $(TAGS_FILES)'; \ + list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ ## Handle VPATH correctly. if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ @@ -104,10 +103,9 @@ ctags: CTAGS ## We have a dummy name here because 'tags' has already been in use ## for a long time to mean Emacs-style tags. Oops. This means the ## dependencies here are useless. -CTAGS: %CTAGSDIRS% $(HEADERS) $(SOURCES) %CONFIG% $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) +CTAGS: %CTAGSDIRS% $(TAGS_DEPENDENCIES) $(am__tagged_files) ## Make sure the list of sources is unique. - list='$(SOURCES) $(HEADERS) %CONFIG% $(LISP) $(TAGS_FILES)'; \ + list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ ## Handle VPATH correctly. if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ @@ -153,8 +151,8 @@ cscope.files: clean-cscope %CSCOPEDIRS% cscopelist endif %?TOPDIR_P% .PHONY: cscopelist -cscopelist: %CSCOPEDIRS% $(HEADERS) $(SOURCES) %CONFIG% $(LISP) $(TAGS_FILES) - list='$(HEADERS) $(SOURCES) %CONFIG% $(LISP) $(TAGS_FILES)'; \ +cscopelist: %CSCOPEDIRS% $(am__tagged_files) + list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \