automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/8] tags: new var $(am__tagged_files) to list all files to run t


From: Stefano Lattarini
Subject: [PATCH 3/8] tags: new var $(am__tagged_files) to list all files to run taggers on
Date: Fri, 8 Jun 2012 10:20:25 +0200

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.
* lib/am/tags.am: Use it in several recipes and dependencies list to
reduce code duplication.

Signed-off-by: Stefano Lattarini <address@hidden>
---
 automake.in    |   17 +++++++++++++++++
 lib/am/tags.am |   18 ++++++++----------
 2 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/automake.in b/automake.in
index 22fbbd7..cd3d7bc 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 = ();
diff --git a/lib/am/tags.am b/lib/am/tags.am
index 9b19eb8..eadb9c0 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) ;; \
-- 
1.7.9.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]