[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Patch: FYI:
From: |
Tom Tromey |
Subject: |
Patch: FYI: |
Date: |
09 Jul 2002 23:43:46 -0600 |
I'm checking this in on the trunk.
This fixes PR 286 by adding a new `ctags' target.
Tom
Index: ChangeLog
from Tom Tromey <address@hidden>
For PR automake/286:
* automake.texi (Tags): Document ctags.
* automake.in (handle_tags): Handle ctags.
* lib/am/tags.am (CTAGS): New macro.
(CTAGSFLAGS): Likewise.
(ctags): New target.
(distclean-tags): Remove `tags'.
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1323
diff -u -r1.1323 automake.in
--- automake.in 9 Jul 2002 20:46:17 -0000 1.1323
+++ automake.in 10 Jul 2002 05:34:19 -0000
@@ -3720,6 +3720,7 @@
sub handle_tags
{
my @tag_deps = ();
+ my @ctag_deps = ();
if (variable_defined ('SUBDIRS'))
{
$output_rules .= ("tags-recursive:\n"
@@ -3731,6 +3732,16 @@
. "\tdone\n");
push (@tag_deps, 'tags-recursive');
&depend ('.PHONY', 'tags-recursive');
+
+ $output_rules .= ("ctags-recursive:\n"
+ . "\tlist=\'\$(SUBDIRS)\'; for subdir in \$\$list; do
\\\n"
+ # Never fail here if a subdir fails; it
+ # isn't important.
+ . "\t test \"\$\$subdir\" = . || (cd \$\$subdir"
+ . " && \$(MAKE) \$(AM_MAKEFLAGS) ctags); \\\n"
+ . "\tdone\n");
+ push (@ctag_deps, 'ctags-recursive');
+ &depend ('.PHONY', 'ctags-recursive');
}
if (&saw_sources_p (1)
@@ -3751,7 +3762,8 @@
}
$output_rules .= &file_contents ('tags',
('CONFIG' => "@config",
- 'DIRS' => "@tag_deps"));
+ 'TAGSDIRS' => "@tag_deps",
+ 'CTAGSDIRS' => "@ctag_deps"));
&examine_variable ('TAGS_DEPENDENCIES');
}
elsif (reject_var ('TAGS_DEPENDENCIES',
@@ -3765,6 +3777,8 @@
# Otherwise, it would be possible for a top-level "make TAGS"
# to fail because some subdirectory failed.
$output_rules .= "tags: TAGS\nTAGS:\n\n";
+ # Ditto ctags.
+ $output_rules .= "ctags: CTAGS\nCTAGS:\n\n";
}
}
Index: automake.texi
===================================================================
RCS file: /cvs/automake/automake/automake.texi,v
retrieving revision 1.286
diff -u -r1.286 automake.texi
--- automake.texi 9 Jul 2002 19:12:31 -0000 1.286
+++ automake.texi 10 Jul 2002 05:34:25 -0000
@@ -4323,6 +4323,12 @@
are added directly to the dependencies for the @code{tags} target.
@vindex TAGS_DEPENDENCIES
+Automake also generates a @code{ctags} target which can be used to
+build @command{vi}-style @file{tags} files. The variable @code{CTAGS}
+is the name of the program to invoke (by default @samp{ctags});
address@hidden can be used by the user to pass additional flags,
+and @code{AM_CTAGSFLAGS} can be used by the @file{Makefile.am}.
+
Automake will also generate an @code{ID} target which will run
@code{mkid} on the source. This is only supported on a
directory-by-directory basis.
Index: lib/am/tags.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/tags.am,v
retrieving revision 1.37
diff -u -r1.37 tags.am
--- lib/am/tags.am 6 Jan 2002 20:23:30 -0000 1.37
+++ lib/am/tags.am 10 Jul 2002 05:34:25 -0000
@@ -44,7 +44,7 @@
ETAGS = etags
ETAGSFLAGS =
-TAGS: %DIRS% $(HEADERS) $(SOURCES) %CONFIG% $(TAGS_DEPENDENCIES) \
+TAGS: %TAGSDIRS% $(HEADERS) $(SOURCES) %CONFIG% $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
@@ -70,6 +70,37 @@
$$tags $$unique
+## ------------- ##
+## vi-style tags ##
+## ------------- ##
+
+CTAGS = ctags
+CTAGSFLAGS =
+
+.PHONY: CTAGS ctags
+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)
+ tags=; \
+ here=`pwd`; \
+## Make sure the list of sources is unique.
+ list='$(SOURCES) $(HEADERS) %CONFIG% $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+## Handle VPATH correctly.
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+## Make sure we have something to run ctags on.
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+
## --------------- ##
## `Global' tags. ##
## --------------- ##
@@ -88,4 +119,4 @@
.PHONY distclean-am: distclean-tags
distclean-tags:
- -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Patch: FYI:,
Tom Tromey <=