From: Reuben Thomas Date: Sun, 6 Dec 2020 02:11:55 +0000 (-0800) Subject: tags: support setting CTAGS, ETAGS, CSCOPE vars via ./configure. X-Git-Tag: v1.16.4~37 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d2ccbd7eb38d6a4277d6f42b994eb5a29b1edf29;p=thirdparty%2Fautomake.git tags: support setting CTAGS, ETAGS, CSCOPE vars via ./configure. This change fixes https://bugs.gnu.org/45013. * m4/init.m4: add default settings and AC_SUBST calls for the variables `CTAGS', `ETAGS' and `CSCOPE'. * lib/am/tags.am: remove default settings of the above variables. * doc/automake.texi (Tags): mention and index. * NEWS: mention. --- diff --git a/NEWS b/NEWS index df978a54d..8821376f6 100644 --- a/NEWS +++ b/NEWS @@ -64,6 +64,10 @@ New in ?.?.?: +* New features added + + - CTAGS, ETAGS, SCOPE variables can be set via configure. + * Bugs fixed - test-driver less likely to clash with tests writing to the same file. diff --git a/doc/automake.texi b/doc/automake.texi index 7e0ad1b05..040172e66 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -10604,10 +10604,10 @@ GNU Emacs under some circumstances. If any C, C++ or Fortran 77 source code or headers are present, then @code{tags} and @code{TAGS} rules will be generated for the directory. All files listed using the @code{_SOURCES}, @code{_HEADERS}, and -@code{_LISP} primaries will be used to generate tags. Note that -generated source files that are not distributed must be declared in -variables like @code{nodist_noinst_HEADERS} or -@code{nodist_@var{prog}_SOURCES} or they will be ignored. +@code{_LISP} primaries will be used to generate tags. Generated +source files that are not distributed must be declared in variables +like @code{nodist_noinst_HEADERS} or @code{nodist_@var{prog}_SOURCES} +or they will be ignored. A @code{tags} rule will be output at the topmost directory of a multi-directory package. When run from this topmost directory, @@ -10619,10 +10619,12 @@ The @code{tags} rule will also be generated if the variable directories that contain taggable source that @command{etags} does not understand. The user can use the @code{ETAGSFLAGS} to pass additional flags to @command{etags}; @code{AM_ETAGSFLAGS} is also -available for use in @file{Makefile.am}. +available for use in @file{Makefile.am}. The variable @code{ETAGS} +is the name of the program to invoke (by default @command{etags}). @vindex ETAGS_ARGS @vindex ETAGSFLAGS @vindex AM_ETAGSFLAGS +@vindex ETAGS Here is how Automake generates tags for its source, and for nodes in its Texinfo file: @@ -10642,6 +10644,9 @@ build @command{vi}-style @file{tags} files. The variable @code{CTAGS} is the name of the program to invoke (by default @command{ctags}); @code{CTAGSFLAGS} can be used by the user to pass additional flags, and @code{AM_CTAGSFLAGS} can be used by the @file{Makefile.am}. +@vindex CTAGS_ARGS +@vindex CTAGSFLAGS +@vindex CTAGS @trindex id Automake will also generate an @code{ID} rule that will run @@ -10659,6 +10664,9 @@ file names respectively, while @code{AM_CSCOPEFLAGS} can be used by the with non-GNU make implementations (especially with make implementations performing @ref{Automatic Rule Rewriting, , VPATH rewrites, autoconf, The Autoconf Manual}). +@vindex CSCOPE_ARGS +@vindex CSCOPEFLAGS +@vindex CSCOPE Finally, Automake also emits rules to support the @uref{https://www.gnu.org/software/global/, GNU Global Tags program}. diff --git a/lib/am/tags.am b/lib/am/tags.am index a485ff840..c1ec37772 100644 --- a/lib/am/tags.am +++ b/lib/am/tags.am @@ -45,7 +45,6 @@ ID: $(am__tagged_files) ## TAGS. ## ## ------ ## -ETAGS = etags .PHONY: TAGS tags if %?SUBDIRS% AM_RECURSIVE_TARGETS += TAGS @@ -101,7 +100,6 @@ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) ## vi-style tags. ## ## --------------- ## -CTAGS = ctags .PHONY: CTAGS ctags if %?SUBDIRS% AM_RECURSIVE_TARGETS += CTAGS @@ -136,7 +134,6 @@ GTAGS: ## ------- ## if %?TOPDIR_P% -CSCOPE = cscope .PHONY: cscope clean-cscope AM_RECURSIVE_TARGETS += cscope cscope: cscope.files diff --git a/m4/init.m4 b/m4/init.m4 index ba73676c1..f82d756c2 100644 --- a/m4/init.m4 +++ b/m4/init.m4 @@ -116,6 +116,20 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi +AC_SUBST([CTAGS]) +if test -z "$ETAGS"; then + ETAGS=etags +fi +AC_SUBST([ETAGS]) +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi +AC_SUBST([CSCOPE]) + AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This