[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Automake-NG] [FYI] [ng] tags: move yet more processing to GNU make
From: |
Stefano Lattarini |
Subject: |
[Automake-NG] [FYI] [ng] tags: move yet more processing to GNU make |
Date: |
Fri, 10 Aug 2012 00:05:16 +0200 |
This will also simplify future changes aimed at making the current
'tags.am' makefile fragment included more "verbatim".
* lib/am/tags.am (am.tags.include-option): New internal variable, the
include-like option used by the $(EATGS) problem. This must be
determined dynamically because Exuberant Ctags wants '--etags-include'
while GNU Etags wants '--include'.
(am.tags.subfiles): New, TAGS files in $(SUBDIRS) entries (if any)
that must be included in the top-level TAGS file.
(tags-am): Use them, and simplify accordingly.
Signed-off-by: Stefano Lattarini <address@hidden>
---
lib/am/tags.am | 44 +++++++++++++++++++++-----------------------
1 file changed, 21 insertions(+), 23 deletions(-)
diff --git a/lib/am/tags.am b/lib/am/tags.am
index b4c395e..bd7e2c7 100644
--- a/lib/am/tags.am
+++ b/lib/am/tags.am
@@ -21,6 +21,22 @@ am.tags.files.unique = \
$(call am.memoize,am.tags.files.unique,$(sort \
$(foreach f,$(am.tags.files),$(call am.vpath.rewrite,$f))))
+# Option to include other TAGS files in an etags-generated file.
+# Exuberant Ctags wants '--etags-include', GNU Etags wants '--include'.
+am.tags.include-option = \
+ $(call am.memoize,am.tags.include-option,$(strip $(shell \
+ if { $(ETAGS) --etags-include --version; } >/dev/null 2>&1; then \
+ printf '%s\n' --etags-include; \
+ else \
+ printf '%s\n' --include; \
+ fi)))
+
+# TAGS files in $(SUBDIRS) entries (if any) that must be included in
+# the top-level TAGS file.
+am.tags.subfiles = \
+ $(call am.memoize,am.tags.subfiles,$(strip \
+ $(foreach d,$(filter-out .,$(SUBDIRS)),$(wildcard $d/TAGS))))
+
## ---- ##
## ID. ##
## ---- ##
@@ -45,30 +61,12 @@ endif !%?SUBDIRS%
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am.tags.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; \
-## Exuberant Ctags wants --etags-include.
-## GNU Etags wants --include.
-?SUBDIRS? if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
-?SUBDIRS? include_option=--etags-include; \
-?SUBDIRS? else \
-?SUBDIRS? include_option=--include; \
-?SUBDIRS? fi; \
-?SUBDIRS? list='$(SUBDIRS)'; for subdir in $$list; do \
-## Do nothing if we're trying to look in '.'.
-?SUBDIRS? if test "$$subdir" = .; then :; else \
-?SUBDIRS? test ! -f $$subdir/TAGS || \
-## Note that the = is mandatory for --etags-include.
-?SUBDIRS? set "$$@" "$$include_option=$(CURDIR)/$$subdir/TAGS"; \
-?SUBDIRS? fi; \
-?SUBDIRS? done; \
-## Remove the 'x' we added first:
- shift; \
## Make sure we have something to run etags on.
- test -z "$(ETAGS_ARGS)$$*$(am.tags.files.unique)" || { \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $${1+"$$@"} $(am.tags.files.unique); \
+ test -z '$(ETAGS_ARGS)$(am.tags.subfiles)$(am.tags.files.unique)' || { \
+ $(ETAGS) \
+ $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $(foreach
f,$(am.tags.subfiles),'$(am.tags.include-option)=$(CURDIR)/$f') \
+ $(am.tags.files.unique); \
}
--
1.7.12.rc0
- [Automake-NG] [FYI] [ng] tags: move yet more processing to GNU make,
Stefano Lattarini <=